<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ok_code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365646#M523763</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;suresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your application programs, the first step in PAI processing should be to save the function code in an auxiliary variable and then initialize the OK_CODE field. You can then read the function code from the auxiliary variable (for example, using a CASE structure), and control the program flow from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The OK_CODE field can have a different name on each screen. However, common practice is to use the same name for the field on each screen of an ABAP program. You then only need one field in the ABAP program, with the same name, into which the function code is placed, and from which you can read it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls. reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jun 2007 05:44:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-19T05:44:34Z</dc:date>
    <item>
      <title>ok_code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365643#M523760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the ok_code serves what purpose&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 05:38:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365643#M523760</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T05:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: ok_code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365644#M523761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ok_code is of the type sy-ucomm.. Any interaction, which the user does with the screen, the function code gets returned in the system variable sy-ucomm. Even if you double click, it has a function code assigned to it. You capture these function codes and then depending on your requirement, you do further processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, you are displying a standard sales order details. on double clicking on any of the order no. you wish to show the item details in the next screen. In this case, as soon as the user double clicks, the function code &amp;amp;IC1 (can be found out by debugging ) is returned in the system variable sy-ucomm (or you declare variable ok_code type sy-ucomm). nOw check this variable and do further processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all Helpful Answers,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Padmam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 05:40:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365644#M523761</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T05:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: ok_code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365645#M523762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Suresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do note the difference between Sy-ucomm and ok_code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &amp;lt;pfstatus&amp;gt; &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok_code acts just as a temporary variable that stores the value of sy-ucomm. &lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 05:43:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365645#M523762</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T05:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: ok_code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365646#M523763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;suresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your application programs, the first step in PAI processing should be to save the function code in an auxiliary variable and then initialize the OK_CODE field. You can then read the function code from the auxiliary variable (for example, using a CASE structure), and control the program flow from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The OK_CODE field can have a different name on each screen. However, common practice is to use the same name for the field on each screen of an ABAP program. You then only need one field in the ABAP program, with the same name, into which the function code is placed, and from which you can read it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls. reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 05:44:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365646#M523763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T05:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: ok_code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365647#M523764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do reward points for the helpful replies...&lt;/P&gt;&lt;P&gt;Regards:&lt;/P&gt;&lt;P&gt;Sapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 05:45:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ok-code/m-p/2365647#M523764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-19T05:45:52Z</dc:date>
    </item>
  </channel>
</rss>

