08-03-2009 8:46 AM
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.
08-03-2009 9:08 AM
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
08-03-2009 8:51 AM
Hi,
In a report program you have to write it in the
AT SELECTION-SCREEN Module.
Hope it helps you.
Thanks,
Sri.
08-03-2009 9:00 AM
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
08-03-2009 9:08 AM
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
08-03-2009 10:53 AM
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?
08-03-2009 11:00 AM
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
08-03-2009 12:38 PM
08-03-2009 1:05 PM
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