REPORT zpg_pp01_07_del_plan_eff.
CONSTANTS: gc_view TYPE char30 VALUE ‘ZMV_PP_WDEF_A’,
gc_u TYPE char1 VALUE ‘U’,
gc_and TYPE char3 VALUE ‘AND’.
DATA: gt_seltab TYPE STANDARD TABLE OF vimsellist.
DATA: gv_fieldname TYPE vimsellist–viewfield.
DATA gv_date TYPE sy–datum.
TABLES: ztb_pp_wdef_a, mara.
SELECT-OPTIONS: s_fac FOR ztb_pp_wdef_a–factory OBLIGATORY.
SELECT-OPTIONS: s_matnr FOR mara–matnr.
SELECT-OPTIONS: s_date FOR ztb_pp_wdef_a–datab.
gv_fieldname = ‘FACTORY’.
CALL FUNCTION ‘VIEW_RANGETAB_TO_SELLIST’
EXPORTING
fieldname = gv_fieldname
append_conjunction = gc_and
TABLES
sellist = gt_seltab
rangetab = s_fac.
gv_fieldname = ‘MATNR’.
CALL FUNCTION ‘VIEW_RANGETAB_TO_SELLIST’
EXPORTING
fieldname = gv_fieldname
append_conjunction = gc_and
TABLES
sellist = gt_seltab
rangetab = s_matnr.
gv_fieldname = ‘DATAB’.
CALL FUNCTION ‘VIEW_RANGETAB_TO_SELLIST’
EXPORTING
fieldname = gv_fieldname
append_conjunction = gc_and
TABLES
sellist = gt_seltab
rangetab = s_date.
LOOP AT gt_seltab ASSIGNING FIELD–SYMBOL(<lfs_seltab>).
IF <lfs_seltab>–viewfield = ‘DATAB’.
gv_date = <lfs_seltab>–value.
CALL FUNCTION ‘CONVERT_DATE_TO_EXTERNAL’
EXPORTING
date_internal = gv_date
IMPORTING
date_external = <lfs_seltab>–value
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
IF sy–subrc <> 0.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION ‘VIEW_MAINTENANCE_CALL’
EXPORTING
action = gc_u
view_name = gc_view
complex_selconds_used = ‘X’
TABLES
dba_sellist = gt_seltab.