2008 Jan 24 9:19 AM
hi,
what is diff b/w sy-ucomm and ok-code
Regards,
Rani.
2008 Jan 24 9:24 AM
Hi Rani,
sy-ucomm (or better syst-ucomm) is a system defined structure which will always hold the valid "user command code". In module programming any field may be defined to get the user command code from the screen, "ok-code" is one SAP often uses in their programs, but you could use any variable in your own program.
Regards,
John.
2008 Jan 24 9:24 AM
hi Rani,
sy-ucomm takes value of any functional code on the screen.
but for ok_code,
either u have to declare it as type sy-ucomm or in module pool u have to define it in element list.
except this there is no difference between these two.
reward points if useful.
kushagra
2008 Jan 24 9:27 AM
Hi rani priya
Actually both are holding the function code triggered by the user. The main difference is that SY-UCOMM is a system variable so that we should not change that value. OK_CODE is holds the value of SY-UCOMM. In our program logic if needed we can change the OK_CODE.
2008 Jan 24 9:29 AM
Actually OK_CODE and SY-Ucomm are the same. But experts suggest use of OK code for following reason:
In each PAI event that a user triggers by choosing either a pushbutton on the screen or an element in a GUI status, the corresponding function code is placed into the system field SYST-UCOMM or SY-UCOMM and placed in the OK_CODE field (as long as the function code is not empty). Empty function codes are placed in neither the SY-UCOMM field nor the OK_CODE field.
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.
REgards.
2008 Jan 24 9:29 AM
Hi Rani
the only difference is that before you can work
with the OK_CODE field, you must assign a name to it in the Screen Painter. If you don't do this then the function code will be stored in sy-ucomm but never in ok_code.
Cheers
shivika
2008 Jan 24 9:29 AM
hi,
function code that triggered the event in the displayed list.modifications should be made by SET USER -COMMAND
if the user chooses a pushbutton the run time system copies the assosiated function code to a special screen and is usally called ok_code.
eward if its useful
2008 Jan 24 9:30 AM
Hi,
Actually OK_CODE and SY-Ucomm are the same. But experts suggest use of OK code for following reason:
In each PAI event that a user triggers by choosing either a pushbutton on the screen or an element in a GUI status, the corresponding function code is placed into the system field SYST-UCOMM or SY-UCOMM and placed in the OK_CODE field (as long as the function code is not empty). Empty function codes are placed in neither the SY-UCOMM field nor the OK_CODE field.
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.
http://www.sap-img.com/abap/sy-ucomm-and-ok-code-in-dialog-program.htm
http://www.saptechies.com/difference-between-sy-ucomm-and-ok_code-in-dialog-program/
http://www.geekinterview.com/question_details/46351
Regards,
Priyanka Neelam.
2008 Jan 24 9:30 AM
Hi,
sy-ucomm is for doing the functions what the user wishes to do at that particular event. You use it in menus and other place . this mainly in using <pfstatus>
ok_code is generally used in screen as of I have used. You will define the function in the screen. and you can use it in the main program.
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.
2008 Jan 24 11:21 AM
hi,
sy-ucomm is a type declared in the abap dictionary.
u can see the table syst(search for syucomm).
and ok_code is the name generally used in abap to refer to this field.
u can give any name to a variable in ur program right!
ok_code is just a variable which u declare in ur program...its not at all mandatory to give this name only to refer to sy-ucomm.
sy-ucomm is a data type.
in ur element list of screen.
u give ok_code to refer to sy-ucomm and declare in the top include. data ok_code type sy-ucomm.
u can give any other name also.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |