Scenario:
In a custom development scenario, a Table Maintenance Generator (TMG) was implemented for a custom database table (ZSAG_MARA). During the record creation or editing process in the TMG screen, there was a frequent need to cross-reference data from another database table (ZREFERENCE_TABLE) for validation or lookup purposes.
To streamline the process and avoid manual navigation to SE16N, a custom button was added to the TMG application toolbar using the GUI status enhancement. This button enables direct navigation to the data browser screen for the referenced table.
Technical Implementation:
Table:
TMG creation screen:
Create a TMG event:
And choose the status for your screen (you can find it in system-> status ->GUI).
Click on User Interface and copy the program into your program. (you can find it in your target screen where you want to create custom button : system->status-> program GUI):
Create a custom button(Naviagtion
Function Attributes:
Now the button should be added in Table view Maintenance: Initial screen. For adding the logics for ‘Navigation’ button. Go to maintenance screens.
Add a module in PAI(ZSAG_POPUP).
Added logic in ‘ZSAG_POPUP’ as per my requirement is:
MODULE zsag_popup INPUT.
data: lv_ans TYPE c.
case sy-ucomm.
when ‘NAVIGATION’.
CALL FUNCTION ‘POPUP_TO_CONFIRM’
EXPORTING
TITLEBAR = ‘Confirm Action’
text_question = ‘Do you want to redirect to these Tcode?’
TEXT_BUTTON_1 = TEXT-001
ICON_BUTTON_1 = TEXT-002
TEXT_BUTTON_2 = TEXT-003
ICON_BUTTON_2 = TEXT-004
DEFAULT_BUTTON = ‘1’
DISPLAY_CANCEL_BUTTON = ‘X’
IMPORTING
ANSWER = LV_ANS
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF sy-subrc <> 0.
clear sy-ucomm.
ENDIF.
ENDCASE.
ENDMODULE.
In SM30: (Button should be added (Navigation)).
Click on ‘Navigation’ button:( A popup will appear).
Function code for these buttons will be ‘OPT1’ & ‘OPT2’. To debug popup You have to drag and drop a txt file on those buttons with this codes should be written inside. [Function]
Command=/H
Type=SystemCommand
To write a logic we have to create another Module in PAI (ZSAG_Redirect).
MODULE zsag_redirect INPUT.
case sy-ucomm.
when ‘OPT1’.
CALL TRANSACTION ‘SE14’.
when ‘OPT2’.
call TRANSACTION ‘SE16N’.
ENDCASE.
ENDMODULE.
After clicking on Tcode ‘SE16N’, It will navigate to Database utility.
Or If user clicks on Tcode ‘SE14’, it will navigate to ‘Data Browsing or General Table Display’.
Conclusion:
By integrating direct navigation to Data Browser (SE16N) and Database Utilities (SE14) within the TMG screen:
Users save time and avoid context switching. Enhances data validation and table administration during record maintenance. Delivers a more user-friendly and efficient TMG interface for functional users and administrators.
Reference: How to create custom button in TMG – SAP Community
Scenario: In a custom development scenario, a Table Maintenance Generator (TMG) was implemented for a custom database table (ZSAG_MARA). During the record creation or editing process in the TMG screen, there was a frequent need to cross-reference data from another database table (ZREFERENCE_TABLE) for validation or lookup purposes. To streamline the process and avoid manual navigation to SE16N, a custom button was added to the TMG application toolbar using the GUI status enhancement. This button enables direct navigation to the data browser screen for the referenced table. Technical Implementation: Table: TMG creation screen: Create a TMG event:And choose the status for your screen (you can find it in system-> status ->GUI). Click on User Interface and copy the program into your program. (you can find it in your target screen where you want to create custom button : system->status-> program GUI): Create a custom button(Naviagtion Function Attributes: Now the button should be added in Table view Maintenance: Initial screen. For adding the logics for ‘Navigation’ button. Go to maintenance screens. Add a module in PAI(ZSAG_POPUP).Added logic in ‘ZSAG_POPUP’ as per my requirement is: MODULE zsag_popup INPUT.
data: lv_ans TYPE c.
case sy-ucomm.
when ‘NAVIGATION’.
CALL FUNCTION ‘POPUP_TO_CONFIRM’
EXPORTING
TITLEBAR = ‘Confirm Action’
text_question = ‘Do you want to redirect to these Tcode?’
TEXT_BUTTON_1 = TEXT-001
ICON_BUTTON_1 = TEXT-002
TEXT_BUTTON_2 = TEXT-003
ICON_BUTTON_2 = TEXT-004
DEFAULT_BUTTON = ‘1’
DISPLAY_CANCEL_BUTTON = ‘X’
IMPORTING
ANSWER = LV_ANS
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF sy-subrc <> 0.
clear sy-ucomm.
ENDIF.
ENDCASE.
ENDMODULE. In SM30: (Button should be added (Navigation)).Click on ‘Navigation’ button:( A popup will appear).Function code for these buttons will be ‘OPT1’ & ‘OPT2’. To debug popup You have to drag and drop a txt file on those buttons with this codes should be written inside. [Function]
Command=/H
Type=SystemCommand To write a logic we have to create another Module in PAI (ZSAG_Redirect).MODULE zsag_redirect INPUT.
case sy-ucomm.
when ‘OPT1’.
CALL TRANSACTION ‘SE14’.
when ‘OPT2’.
call TRANSACTION ‘SE16N’.
ENDCASE.
ENDMODULE. After clicking on Tcode ‘SE16N’, It will navigate to Database utility. Or If user clicks on Tcode ‘SE14’, it will navigate to ‘Data Browsing or General Table Display’. Conclusion:By integrating direct navigation to Data Browser (SE16N) and Database Utilities (SE14) within the TMG screen: Users save time and avoid context switching. Enhances data validation and table administration during record maintenance. Delivers a more user-friendly and efficient TMG interface for functional users and administrators. Reference: How to create custom button in TMG – SAP Community Read More Application Development and Automation Blog Posts articles
#SAP