SAP ABAP – Create SELECTION SCREEN for TMG (Table Maintenance Generator)

SAP ABAP – Create SELECTION SCREEN for TMG (Table Maintenance Generator)

REPORT zpg_pp01_07_del_plan_eff.
CONSTANTSgc_view TYPE   char30  VALUE ‘ZMV_PP_WDEF_A’,
gc_u    TYPE   char1   VALUE ‘U’,
gc_and  TYPE   char3   VALUE ‘AND’.
DATAgt_seltab    TYPE STANDARD TABLE OF vimsellist.
DATAgv_fieldname TYPE vimsellistviewfield.
DATA gv_date TYPE sydatum.
TABLESztb_pp_wdef_amara.
SELECT-OPTIONSs_fac FOR ztb_pp_wdef_afactory OBLIGATORY.
SELECT-OPTIONSs_matnr FOR maramatnr.
SELECT-OPTIONSs_date FOR ztb_pp_wdef_adatab.

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 FIELDSYMBOL(<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 sysubrc <> 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.