Skip to Content
author's profile photo Former Member
Former Member

difference b/w ok_code and sy-ucomm in module pool ?

hai abap gurus,

ok_code and sy-ucomm store the function code of the element.. then y do v use ok-code in the program. y dont v use sy-ucomm... pls clear my doubt...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 29, 2008 at 06:40 AM

    Both are same and contains function code

    diff:

    1) OK_CODE is of type SY-UCOMM created with screen by default.

    but SY-UCOMM is present in the DDIC structure (SYST structure)

    2) when some even occurs, SY-UCOMM is set with the value and we need to explicitly assign the value to the OK_CODE.

    so in short ..

    OK_CODE is a screen element and SY-UCOMM is present inthe general DDIC structure SYST which is also called system field table

    reward points if useful

    Edited by: Reji Prabhakaran Konnasseri on May 29, 2008 8:40 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 29, 2008 at 06:31 AM

    Hi

    During internal processing value of sy-ucomm may change. So we store its value in ok_code.

    Aditya

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2008 at 06:31 AM

    hi,

    both are the same. they contain fct code.

    as sy-ucomm is a system variable its value keeps on changing

    so if its a push button sysytem places the fct code in ok_code(screen specific) for further usage

    regards

    prasanth

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2008 at 06:34 AM

    Hi Friend,

    SY-UCOMM and OK_CODE both stored function code.

    OK_CODE is screen specific; if you have declared in a screen it will contain values for that screen. And if screen changes the value will not change or does not conatin next screen's function code.

    SY_UCOMM contains both screen's fcode and does not depend on screen or any other object.

    Regards

    Krishnendu

    Add a comment
    10|10000 characters needed characters exceeded

    • hi,

      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.

  • author's profile photo Former Member
    Former Member
    Posted on May 29, 2008 at 06:38 AM

    Difference b/w ok_code and sy-ucomm

    It is not obligatory that you write OK_CODE, it is just a denomination from SAP. You can declare any name for the variable in your code that is going to trap the transaction code of the button that the user pressed.

    OK_CODE is used in SAP Dialog Programming, while SY-UCOMM is used all around SAP (classes, SAP Dialog Programming, ABAP, forms, and a long etc.).

    receive the contents of the corresponding screen fields means the transaction code that you assign at development time to the objects on the screen, which should trigger an event (buttons tipically or folders in a folder control).

    Regards,

    Raj.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.