Add Custom Button in TMG Screen
Add Custom Button in TMG Screen
Step 1
➢ Go to F4 and Select Event number ST Give name of Event with prefix SAPL (Table name ) then enter then we
redirect to SE41 Screen automatically .
Step 4
➢ Select the user interface from application bar .
Step 5
Step 6
➢ Give name of standard pf status name then edit go to change mode of user interface and
add our button in menu bar .
Step 7
Step 8
➢ Double click on Screen number .
Step 9
➢ Create Module in PAI Event of Screen for our button logic implement .
Step 10
Necessary Code require
IF sy-ucomm = 'SORT'.
CLEAR lt_tab_agent[].
LOOP AT extract.
APPEND INITIAL LINE TO lt_tab_agent ASSIGNING <lfs_xto> CASTING.
ASSIGN extract TO <lfs_xfrom> CASTING.
<lfs_xto> = <lfs_xfrom>.
ENDLOOP.
REFRESH extract.
SORT lt_tab_agent[] BY gjahr DESCENDING.
LOOP AT lt_tab_agent INTO DATA(zmrp).
APPEND INITIAL LINE TO extract ASSIGNING <lfs_xto> CASTING.
ASSIGN zmrp TO <lfs_xfrom> CASTING.
<lfs_xto> = <lfs_xfrom>.
ENDLOOP.
* ENDIF.
REFRESH extract.
SORT lt_tab_agent[] BY gjahr ASCENDING.
LOOP AT lt_tab_agent INTO DATA(zmrp1).
APPEND INITIAL LINE TO extract ASSIGNING <lfs_xto> CASTING.
ASSIGN zmrp1 TO <lfs_xfrom> CASTING.
<lfs_xto> = <lfs_xfrom>.
ENDLOOP.
* ENDIF.
ELSEIF SY-ucomm = 'BACK' OR SY-ucomm = 'EXIT' OR SY-ucomm = 'CANCEL' OR SY-UCOMM = 'EABR' OR SY-UCOMM = 'ENDE'.
LEAVE TO SCREEN 0.
ENDIF.
CLEAR sy-ucomm.