Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

using application toolbar push buttons in report

Former Member
0 Kudos

Hello folks,

I'm new to ABAP and so i'm facing some problems with my code.

I have copied a standard program to my Z program (ZXXXXX). I have added few push buttons to the application toolbar of the Z program (ZXXXXX) and now on click of the 1st button i need to call another standard program.

Where should I write the code for the action to be performed on click of the buttons? I am aware that it is generally written in the PAI module but I did not have this module, its a normal report program and not a module pool.

Need your help.

Thanks in advance.

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos

Welcome on SCN!

Please do not forget to read

As for the question, you would need to clarify where this application toolbar option is placed:

- in selection screen?

- in list (output of program)?

If first applies, do as above suggested (using AT SELECTION-SCREEN event).

If second is what you need, use event AT USER-COMMAND .

In both cases variable sy-ucomm will hold function code of triggered function (i.e sy-ucomm = 'MY_BUTTON' ). If that condition is fulfilled simply use SUBMIT 'MY_PROGRAM' AND RETURN , or just SUBMIT 'MY_PROGRAM' if you don't want to get back to calling program.

Regards

Marcin

7 REPLIES 7

sridhar_meesala
Active Contributor
0 Kudos

Hi,

In a report program you have to write it in the

AT SELECTION-SCREEN Module.

Hope it helps you.

Thanks,

Sri.

Former Member
0 Kudos

Hi,

You can write you code in the at selection-screen event of the prorgam.

Like below:



at selection-screen.
 
  if sy-ucomm = 'PUSH'.                      "Ok-code assigned to the pushutton
   submit progam 'zzzzz' and return.
endif.

If you also want to pass some parameters to the submit program you need press F1 on the submit and you would get the information related to the command.

Regards,

Himanshu Verma

MarcinPciak
Active Contributor
0 Kudos

Welcome on SCN!

Please do not forget to read

As for the question, you would need to clarify where this application toolbar option is placed:

- in selection screen?

- in list (output of program)?

If first applies, do as above suggested (using AT SELECTION-SCREEN event).

If second is what you need, use event AT USER-COMMAND .

In both cases variable sy-ucomm will hold function code of triggered function (i.e sy-ucomm = 'MY_BUTTON' ). If that condition is fulfilled simply use SUBMIT 'MY_PROGRAM' AND RETURN , or just SUBMIT 'MY_PROGRAM' if you don't want to get back to calling program.

Regards

Marcin

0 Kudos

Thanks for your inputs !

When I execute my Z program, the output is an ALV report where in I have the application toolbar with those buttons.

I have used the event AT USER-COMMAND but not able to achieve the thing I want.

Where am I makin the mistake?

0 Kudos

Do you use ALV via FM or via class clu_gui_alv_grid ?

If first, use below to catch commands triggered by user


  DATA: l_repid TYPE sy-repid.
  l_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
       ...
     i_callback_program                = l_repid
     i_callback_user_command           = 'USER_COMMAND'   "this subroutine will be called once you pick otpion from toolbar

FORM user_command USING f_ucomm TYPE sy-ucomm
                        ls_selfield TYPE slis_selfield.
  IF f_ucomm = 'MY_FCODE' . "here you picked function code
      "react here accordingly
  ENDIF.
ENDFORM.    

Regards

Marcin

0 Kudos

Thank you Marcin, it worked.

Thanks a lot !

0 Kudos

No problem. One thing about some rules here. If you got the answer please always close the thread.

That's why I sent you [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] as everyone here in SAP Community should be familiar with and follow them.

Regards

Marcin