Adding Custom button in Table maintenance Generator and their functionality :
Multiple events are defined by SAP to handle PF status.
Following are the steps to create our own custom button on TMG.
Our example table is ZTEST.
Create Table maintenance generator for ZTEST.
Now Go to the Event tab on table maintenance generator as shown in below screen shot.
Go to Environment->modification->events.
Click on New entries.
SAP has predefined events maintained for TMG, in which you can write your own logic if you want to do some processing. This events are triggered based on its criteria.
We are going to add one custom button in PF status.So enter event no as ‘ST’.Enter Form Routine no and press enter.You will get an error message as shown below.
Now enter the correct routine name and press enter.
Now click on Editor. Menu painter screen will open.
Now click on ‘Copy Interface’ as shown below.
We will copy all the user interface of the main table maintenance program to our Function Group. Table maintenance runtime uses the user interface from the program SAPLSVIM. So, we are unable to find any user interface in our FG.
Press Continue.
You will get one popup of language compatibility. Press Continue.
Now interface from the main program is copied to our FG.
We can check the status our table is using. Go to SM30.Give your table name.
Go to System->status->GUI status.
Now enter status name as ‘EULG’ and press Change.
Add another button.
Save and activate.
Now go to TMG. Go to Environment->Modification->Maintenance Screens.
Press Enter.
Now create a module in PAI.
You can add your functionality of pushbutton here.
Add this piece of code to your module.
CASE function.
WHEN 'POP'.
CALL FUNCTION 'POPUP_TO_INFORM'EXPORTING
titel = 'Information'
txt1 = 'No of selected entries are'
txt2 = mark_extract.endcase.
ENDCASE.
Scenario 2:
Add another pushbutton to our status.
Functionality: To download all the entries on action of a pushbutton.
Add the below code to your same module to achieve this functionality.
data l_filename like IBIPPARMS-PATH.data l_filename1 type string.
when 'DOWNLOAD'.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = sy-repid*
DYNPRO_NUMBER = SYST-DYNNR*
FIELD_NAME = ' '
IMPORTING
FILE_NAME = l_filename
.
l_filename1 = l_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING* BIN_FILESIZE =
filename = l_filename1* FILETYPE =
tables
data_tab = extract[] .
Test the POPUP functionality:
Go TO SM30 and enter out table name ‘ZTEST’. Click on Maintain.
Remember that our TMG should be in change mode as we have added the pushbuttons to our change view status i.e. EULG.
Now we have 4 entries.
Select 3 entries and click on Pushbutton POPUP.
Test the DOWNLOAD functionality:
Now go back and click on DOWNLOAD pushbutton.
You will be asked to enter your file name into which you want to download your entries.
Give file name and enter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |