Application Development and Automation 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: 
Read only

Trigger PAI on specific toolbar button

alejiandro_sensejl
Active Participant
0 Likes
1,587

Hello everyone,

I have a toolbar (in a docking container) attached to a dynpro which contains two buttons (save and refresh). I want to have the save button to invoke PAI, but the refresh button should not!

I only found method SET_REGISTERED_EVENTS with eventid CL_GUI_TOOLBAR=>M_ID_FUNCTION_SELECTED that applies the event handling to the complete toolbar. Is it possible to do this function code specific?

Regards,

Alej

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
975

Hello Alej

If I am right the executing toolbar functions do not trigger PAI but just raise event USER_COMMAND (in case of custom-defined buttons). If you want to trigger PAI explicitly you simply have to use statement:


CALL METHOD cl_gui_cfw=>set_new_ok_code(...)

The ALV framework will finish the event handling method and then jump to PAI with the newly set OK-code.

Instead of doing any "SAVE" functionality within the event handler method I recommend to do this at a module / routine at PAI.

Regards

Uwe

4 REPLIES 4
Read only

MarcinPciak
Active Contributor
0 Likes
975

Hi Alej,

You should be able to achieve that using this method, however you have to set the flag APPL_EVENT for certain event id. This way this event will entail PAI after triggering.

As for the event id to register please refer toolbar specific events [here|http://help.sap.com/saphelp_470/helpdata/es/1b/8c2eb4c57511d2bd8e080009b4534c/frameset.htm]

Regards

Marcin

Read only

0 Likes
975

Hello Marcin,

unfortunately I'm not sure what you are suggesting... Method SET_REGISTERED_EVENTS applies the state trigger or don't trigger PAI on click to the complete toolbar, doesn't it?

My requirement is that function code SAVE runs the dynpro field checks, but the refresh function should not (like an exit command).

Regards,

Alej

Read only

0 Likes
975

Indeed this most likely applies to whole toolbar, but is set for specific event type (the one which you pass for eventid ).

But for your requirement I think may help the following: in handling method once SAVE button is pressed force the screen processing once again with LEAVE TO SCREEN main_screen_number. This should then entail dialog step once again. Try it out, it worked once for me.

Regards

Marcin

Read only

uwe_schieferstein
Active Contributor
0 Likes
976

Hello Alej

If I am right the executing toolbar functions do not trigger PAI but just raise event USER_COMMAND (in case of custom-defined buttons). If you want to trigger PAI explicitly you simply have to use statement:


CALL METHOD cl_gui_cfw=>set_new_ok_code(...)

The ALV framework will finish the event handling method and then jump to PAI with the newly set OK-code.

Instead of doing any "SAVE" functionality within the event handler method I recommend to do this at a module / routine at PAI.

Regards

Uwe