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

sy-ucomm

Former Member
16,959

hello all,

can we know possible values of sy-ucomm.

thanks,

raj

1 ACCEPTED SOLUTION
Read only

Former Member
4,281

sy-ucomm is for doing the functions what the user wishes to do at that particular event. You use it in menus and PF-status.

ok_code acts just as a temporary variable that stores the value of sy-ucomm.

When user interacts with the screen elements, the function code that you have assigned is filled in the sy-ucomm field which is turn gets reflected in OK_CODE.

In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:

In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

hello all,

can we know possible values of sy-ucomm.

thanks,

raj

6 REPLIES 6
Read only

Former Member
0 Likes
4,281

hi Raj,

Sy-ucomm is a system field in to which fct code of a pushbutton will get stored when you click on the push button. In module pool program you will store this sy-ucomm data in a user defined variable called ok code, using this variable you will code the program. Values that it stores depends on the <b>fcode that you assign to that particular button </b>

Regards,

Santosh

Read only

Former Member
0 Likes
4,281

Hi,

sy-ucomm is system field.

in the code you can check the value of sy-ucomm to do processing.

it can have any value,

e.g.- in module on the push button click, fcode given is sy-ucomm.

Read only

Former Member
0 Likes
4,281

we can know the possible values of SY-UCOMM by debugging the code; checking the SY-UCOMM value for all the functioncodes specified in the object.

Read only

Former Member
4,282

sy-ucomm is for doing the functions what the user wishes to do at that particular event. You use it in menus and PF-status.

ok_code acts just as a temporary variable that stores the value of sy-ucomm.

When user interacts with the screen elements, the function code that you have assigned is filled in the sy-ucomm field which is turn gets reflected in OK_CODE.

In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:

In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
4,281

Hello,

'sy-ucomm' will contain the function codes of any screen element clicked on or used.

e.g.

there's a button on a screen and you have assigned 'PUSH' as its function code.

<u>In ABAP program:</u>

DATA: ok_code LIKE sy-ucomm.

MODULE PAI INPUT.

CASE ok_code.

WHEN 'PUSH'.

// your logic.

ENDCASE.

ENDMODULE.

ok_code, will contain function codes of any screen element clicked or used.

Regards,

Shehryar Dahar

Read only

Former Member