Monday, April 13, 2009

Add a 'List' button in the application toolbar of a table for SM30 tcode



Follow the following given steps to add a 'List' button in the application toolbar of a table for SM30 tcode.

1. In the table maintenance generator of a table check the Function group(FG).
2. Check the Main screen no for that FG and the main program of that FG.
3. Go to the screen of the main program.In the PAI part of that screen add a module
MODULE custom_pf_button..

4. In this module add the code for data selection from that table.

Let's for example:
DATA: itab TYPE TABLE OF z00__3_2_3_4_001.
SELECT * FROM z00__3_2_3_4_001 INTO TABLE itab.
CASE function.
WHEN 'LIST'.
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_structure_name = 'Z00__3_2_3_4_001'
TABLES
t_outtab = itab.
ENDCASE.
whenever the List button will be pressed the selected data from table Z00__3_2_3_4_001 will be displayed.

5. After that check the PF status for that screen and add button 'LIST' in the application toolbar.
we need to make sure that all the required gui status contains the 'LIST' button in the application toolbar.

6. Then come back to the Table maintenance generator and maintain the program name in the Event of the table maintenance generator.

to do this follow the path Environment->Modification->Events.

Add a new item Maintenance event as 'ST' and Form routine as ' Main Program name' of that screen.

7.Save and activate all the screens.






No comments:

Post a Comment