How to create custom button in TMG

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.

pic1.PNG

   Create Table maintenance generator for ZTEST.

pic2.PNG

Now Go to the Event tab on table maintenance generator as shown in below screen shot.

Go to Environment->modification->events.

 

pic3.PNG

 

Click on New entries.

pic4.PNG

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.

pic5.PNG

pic6.PNG

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.

pic7.PNG

pic23.PNG

Now enter the correct routine name and press enter.

pic8.PNG

Now click on Editor. Menu painter screen will open.

pic9.PNG

 

Now click on ‘Copy Interface’ as shown below.

pic10.PNG

 

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.

 

pic11.PNG

Press Continue.

You will get one popup of language compatibility. Press Continue.

pic12.PNG

pic13.PNG

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.

pic14.PNG

Now enter status name as ‘EULG’ and press Change.

pic15.PNG

Add another button.

pic16.PNG

Save and activate.

Now go to TMG. Go to Environment->Modification->Maintenance Screens.

pic17.PNG

Press Enter.

 

pic18.PNG

Now create a module in PAI.

pic19.PNG

pic20.PNG

pic21.PNG

pic22.PNG

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.

 

 

pic24.PNG

pic25.PNG

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.

pic26.PNG

pic27.PNG

 

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.

pic28.PNG

Give file name and enter.

 

pic29.PNG

pic30.PNG

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值