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

How to use function module SAPGUI_SET_FUNCTIONCODE?

Former Member
0 Likes
6,210

Hi all,

I understand that the function module SAPGUI_SET_FUNCTIONCODE is being used to manully trigger the PAI/PBO at the POV. However, I was not able to get it to even trigger anything. Need suggestion as of how to use this function module. I try to call it at the end of the POV but to no avail. Any help is greatly appreciated and rewarded.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,710

Hi,

Refer program : MSPAMO01

*----


  • PBO time event

*----


<b>PROCESS BEFORE OUTPUT.</b>

MODULE refresh_pat03?.

MODULE status_conversion. "For compatibility with Rel. 30A-30C

MODULE read_packages_and_queue.

MODULE check_attributes. "Ensure that PAT03 is consistent

MODULE purge_old_pat01_entries. "Ensure that queue is consistent

MODULE delete_q_from_indx. "For consistency with 3.1H/4.0A +

MODULE read_ocs_semaphore.

MODULE read_batch_jobs.

MODULE set_title.

MODULE set_status.

MODULE set_fields.

<b> MODULE suppress_dialog.</b>

*----


  • PAI time event

*----


PROCESS AFTER INPUT.

MODULE ok_code.

MODULE ok_code AT EXIT-COMMAND.

MODULE suppress_dialog OUTPUT.

IF gv_start_import = on.

ok_code = 'IMPL'.

gv_suppress_ok_code = ok_code.

<b> CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'</b>

EXPORTING

functioncode = ok_code

EXCEPTIONS

function_not_supported = 1

OTHERS = 99.

IF sy-subrc <> 0.

SUPPRESS DIALOG.

ENDIF.

ENDIF.

Best regards,

Prashant

ENDMODULE. "SUPPRESS_DIALOGUE OUTPUT

7 REPLIES 7
Read only

Former Member
0 Likes
2,710

Hi,

I've implemented it like this in one of the requirements.

MODULE user_command_9000 INPUT.

okcode = sy-ucomm.

CASE okcode.

WHEN 'CLOS'.

WAIT UP TO 10 SECONDS.

CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'

EXPORTING

functioncode = 'CLOS'

EXCEPTIONS

function_not_supported = 1

OTHERS = 2.

MESSAGE i002(sy) WITH text-002.

DELETE DATASET fname.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE.

Thanks,

Jyoti

Read only

0 Likes
2,710

Hi Jyoti,

Does it actually proceed to fire the PBO/PAI event?

Read only

0 Likes
2,710

I've used it in PAI event.

Read only

Former Member
0 Likes
2,711

Hi,

Refer program : MSPAMO01

*----


  • PBO time event

*----


<b>PROCESS BEFORE OUTPUT.</b>

MODULE refresh_pat03?.

MODULE status_conversion. "For compatibility with Rel. 30A-30C

MODULE read_packages_and_queue.

MODULE check_attributes. "Ensure that PAT03 is consistent

MODULE purge_old_pat01_entries. "Ensure that queue is consistent

MODULE delete_q_from_indx. "For consistency with 3.1H/4.0A +

MODULE read_ocs_semaphore.

MODULE read_batch_jobs.

MODULE set_title.

MODULE set_status.

MODULE set_fields.

<b> MODULE suppress_dialog.</b>

*----


  • PAI time event

*----


PROCESS AFTER INPUT.

MODULE ok_code.

MODULE ok_code AT EXIT-COMMAND.

MODULE suppress_dialog OUTPUT.

IF gv_start_import = on.

ok_code = 'IMPL'.

gv_suppress_ok_code = ok_code.

<b> CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'</b>

EXPORTING

functioncode = ok_code

EXCEPTIONS

function_not_supported = 1

OTHERS = 99.

IF sy-subrc <> 0.

SUPPRESS DIALOG.

ENDIF.

ENDIF.

Best regards,

Prashant

ENDMODULE. "SUPPRESS_DIALOGUE OUTPUT

Read only

Former Member
0 Likes
2,710

Hi,

Afer POV control will not go to PBO until y pressed ENTER . for overcome this you need to set a dummy OKCODE. in the following way.

CALL FUNCTION “SAPGUI_SET_FUNCTIONCODE”

EXPORTING

FUNCTIONCODE = “=”

EXCEPTION

FUNCTION_NOT_SUPPORTED = 1

OTHERS = 2

Here is the sample code

PROCESS BEFORE OUTPUT.

MODULES l201_blanklines.

LOOP RK intdrad WITH CONTROL tab_x CURSOR tab_x-current_line.

MODULES l201_init.

FINAL LOOP.

PROCESS AFTER INPUT.

MODULES l201_new.

LOOP RK intdrad.

CHAIN.

FIELD equi equnr.

MODULES l201_bear.

FINAL CHAIN.

FINAL LOOP.

MODULES l201_end.

Importantly

PROCESS ON VALUE REQUEST.

field EQUI EQUNR of modules ZZ_DMS_MULTIPLE_EQUIS.

Importantly

--End to screen Logic

Modules ZZ_DMS_MULTIPLE_EQUIS

CALL FUNCTION “F4IF_FIELD_VALUE_REQUEST”

EXPORTING

TABNAME = “EQUI”

FIELDNAME = “EQUNR”

SEARCHHELP = “EQUI”

SHLPPARAM = “EQUNR”

DYNPPROG = system-repid

DYNPNR = system-dynnr

DYNPROFIELD = “EQUI EQUNR”

MULTIPLE_CHOICE = “X”

TABLES

RETURN_TAB = lt_return_tab

EXCEPTION

FIELD_NOT_FOUND = 1

NO_HELP_FOR_FIELD = 2

INCONSISTENT_HELP = 3

NO_VALUES_FOUND = 4

OTHERS = 5

.

CALL FUNCTION “SAPGUI_SET_FUNCTIONCODE”

EXPORTING

FUNCTIONCODE = “=”

EXCEPTION

FUNCTION_NOT_SUPPORTED = 1

OTHERS = 2

.

...

CALL FUNCTION “DYNP_VALUES_UPDATE”

EXPORTING

DYNAME = system-repid

DYNUMB = system-dynnr

TABLES

DYNPFIELDS = lt_dynpfields

EXCEPTION

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

MORE INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

UNDEFIND_ERROR = 7

OTHERS = 8

Regards

Sudheer

Read only

0 Likes
2,710

Hi Sudheer,

I have used it in the POV event just like you did, but it didn't event fire PBO once I select an entry from the search help. A lot of people here claim that they are able to get PBo fired with this function module and I wonder how they actually did it. At least I was not able to get it working.

Read only

0 Likes
2,710

Example

A screen contains a single output field:

Counter ____

with the field reference "count".

This field is changed in the single flow logic module:

process before output.

module pbo.

and the default function code "=" is processed:

module pbo output. add 1 to count. if count > 20.

leave to screen 0.

endif.

call function 'SAPGUI_SET_FUNCTIONCODE'.

endmodule.