Difference between ok_code and sy-ucomm

Hi,
Can any one tell me the difference between ok_code and sy-ucomm

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.

Similar Messages

  • What is the diff between OK_CODE and SY-UCOMM

    Dear All,
    I am trying to develop on module pool program using push buttons to pass the data to input/out filed. When I do the debugging the sy-ucomm is showing the data but not OK_CODE in case statement.
    Case OK_CODE.
    When 'one'.
    num = '1'.
    call function 'ZCA_INPUT_OUT'.
    Import
    numz = num
    export
    number = inputi. " input/output field in screen painter
    end case.
    Can you pls give me a solutions what is the main mistake I did here.
    I could not able to pass the data through push button to input/out field.
    Regards,
    Chandra.

    Hi all,
    still I have same problem.
    below is my program code.
    REPORT  ZCA_CALCULATOR_DEMO.
    DATA INPUTI TYPE string.
    Data num type string.
    DATA: OK_CODE TYPE SY-UCOMM,
          save_ok like ok_code.
    call screen '100'.
    INCLUDE ZCA_CALCULATOR_DEMO_STATUS_O03.
    ***INCLUDE ZCA_CALCULATOR_DEMO_STATUS_O03 .
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'GUI100'.
      SET TITLEBAR 'ZCHAR'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    INCLUDE ZCA_CALCULATOR_DEMO_USER_COI01.
    ***INCLUDE ZCA_CALCULATOR_DEMO_USER_COI01 .
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    save_ok = ok_code.
    clear ok_code.
    CASE save_ok.
        WHEN 'one'.
          num = '1'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
        WHEN 'two'.
          num = '2'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
        WHEN 'three'.
          num = '3'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    WHEN 'FOUR'.
          num = '4'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    WHEN 'FIVE'.
          num = '5'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    WHEN 'SIX'.
          num = '6'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    WHEN 'SEVEN'.
          num = '7'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    WHEN 'EIGHT'.
          num = '8'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    WHEN 'NINE'.
          num = '9'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    WHEN 'ZERO'.
          num = '0'.
          CALL FUNCTION 'ZCA_CAL_INPUT'
            EXPORTING
              NUM    = num
            IMPORTING
              NUMBER = inputi.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    function zca_cal_input.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(NUM) TYPE  STRING
    *"  EXPORTING
    *"     REFERENCE(NUMBER) TYPE  STRING
    data: nextnum type string,
          currnum type string.
    loop at screen.
    if screen-name = 'inputi'.
    nextnum = num.
    concatenate currnum nextnum into currnum.
    number = currnum.
    endif.
    endloop.
    endfunction.
    this is my entire program code. 
    now I have mention OK_code type ok in screen painter attribute also.
    but still haveing sample problem .......
    can you pls some one will explain what need to be done in this case.
    Regards,
    Chandra V

  • Regarding  ok_code and sy-ucomm.

    hi experts ,
                    regarding the difference between ok_code and sy-ucomm i searched and found this lines......
    answer:::
    In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM <b>receive the contents of the corresponding screen fields</b> in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event.
    cud u plz tell me what is the meaning of contents of corresponding screen fields...plz explain it ...and second thing can i declare another variable name instead of ok_code ..is it necessary to write ok_code....thnx in advance...

    <b>sy-ucomm</b> 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.
    Regards,
    Pavan

  • 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...

    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.

  • Difference between Null and null?

    What is the difference between null and NULL?
    When is each used?
    Thanks,

    veryConfused wrote:
    There is a null in java, but no NULL. null means no value. However, when assigning value, the following is different:Although the empty String has no special role. Null means, the referential type is not assigned (doesn't refer) to a specific object. The empty String is just another object though, so seeing it or pointing it out as something special when it actually isn't at all (no more special than new Integer(0) or new Object[0]) just adds to the confusion.

  • Difference between GUI_UPLOAD and WS_UPLOAD

    Hi,
    Please make me clear about the difference between GUI_UPLOAD and WS_UPLOAD. In which cases we need to use these modules...??
    Thanks,
    Satish

    I would suggest to always use the GUI_UPLOAD.  I say this because this is the function module which is used in the GUI_UPLOAD method of the class CL_GUI_FRONTEND_SERVICES.   Really, you should probably use the class/method instead of the function module.
      data: filename type string.
      filename = p_file.
      call method cl_gui_frontend_services=>gui_upload
             exporting
                  filename                = filename
                  filetype                = 'ASC'
             changing
                  data_tab                = iflatf
             exceptions
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  no_authority            = 6
                  unknown_error           = 7
                  bad_data_format         = 8
                  unknown_dp_error        = 12
                  access_denied           = 13
                  others                  = 17.
    Regards,
    Rich Heilman

  • Difference between char and varchar, also the difference between varchar2

    Hi,
    Can anyone explain me the difference between char and varchar, and also the difference between varchar and varchar2...

    Varchar2 is variable width character data type, so if you define column with width 20 and insert only one character to tis column only, one character will be stored in database. Char is not variable width so when you define column with width 20 and insert one character to this column it will be right padded with 19 spaces to desired length, so you will store 20 characters in the dattabase (follow the example 1). Varchar data type from Oracle 9i is automaticlly promoted to varchar2 (follow example 2)
    Example 1:
    SQL> create table tchar(text1 char(10), text2 varchar2(10))
    2 /
    Table created.
    SQL> insert into tchar values('krystian','krystian')
    2 /
    1 row created.
    SQL> select text1, length(text1), text2, length(text2)
    2 from tchar
    3 /
    TEXT1 LENGTH(TEXT1) TEXT2 LENGTH(TEXT2)
    krystian 10 krystian 8
    Example 2:
    create table tvarchar(text varchar(10))
    SQL> select table_name,column_name,data_type
    2 from user_tab_columns
    3 where table_name = 'TVARCHAR'
    4 /
    TABLE_NAME COLUMN_NAME DATA_TYPE
    TVARCHAR TEXT VARCHAR2
    Best Regards
    Krystian Zieja / mob

  • The difference between Lion and Mountain Lion

    Can some one explain to me the difference between Lion and Mtn Lion? I'm currently 10.6.8 Is it beneficiall for me to upgrade?

    Mountain Lion is an enhanced version of previous OS X and so that is Mavericks.
    About upgrading it all depends on what your needs are and if your hardware supports it.
    System requirements for OS X Lion
    System requirements for OS X Mountain Lion
    OS X Mavericks: System Requirements
    Please check also applications compatibility. From Lion onward, you cannot run PPC application.

  • The difference between N80 and N80IE ?

    What is the difference between M80 and N80ie?

    02-Jan-2007
    07:45 PM
    korngear wrote:
    The Nokia N80 Internet Edition is a new version of this handset with the same hardware as the normal N80. It is due for release in Q4 of 2006 and will be available in Patina Bronze or Pearl Black, and has the following additional software included.
    Yahoo Go! for Mobile
    Flickr
    Some Amazon Branded Software
    'Download!' App management
    Internet Telephone - SIP VOIP Frontend
    WLAN Wizard
    Gizmo VOIP - Gizmo Project VOIP Frontend.
    \\en.wikipedia.org//
    @Korngear
    Thanks.
    Could N80 be upgraded to N80IE?

  • The difference between SFP+ and X2

    Dear Expert,
    I need to know what is the difference between SFP+ and X2! and can I use SFP+ card and module instead of X2?
    Thanks,
    Mohammad Saeed

    Hi,
    They are both used for 10Gig interfaces.  The difference is the connector type.
    SFP+ is LC and X2 is SC.
    You can not put an SFP+ into an X2 slot or X2 optic into a SFP+.
    HTH

  • What is difference between abstraction and encapsulation ?

    Hi,
    I am trying to figure out the difference between abstraction and encapsulation but confused.
    Both are used for data hiding then what is the exact difference ?
    Thanks.

    Tushar-Patel wrote:
    I am trying to figure out the difference between abstraction and encapsulation but confused.
    Both are used for data hiding then what is the exact difference ?This is the picture I have:
    When you encapsulate something you get an inside and an outside. The outside is the abstraction. It describes how the encapsulated entity behaves viewed from the outside. This is also called the type. Hidden inside is the implementation. It holds detail information about how the type's behaviour is accomplished.
    It's a very simplified picture but I think it's quite accurate and it works for me.

  • What is difference between Iterator and Collection Wrapper?

    Hi all,
                  I dont understand the actual difference between Iterator and Collection Wrapper. I observed both are used for the same purpose. Could any one please let me know when to use Collection Wrapper and when to use Iterator??
    Thanks,
    Chinnu.

    L_Kiryl is right.
    Collections support global iteration (through collection->get_next( )) and local iteration (through iterator->get_next( )).
    Each collection has a focus object. Initially, the first object has the focus.
    Any global iteration moves the focus, which is published by the event FOCUS_CHANGED of the collection.
    If you want to iterate on the collection without moving the focus (and without triggering timeconsuming follow-up processes) you can use local iteration. To do so, request an iterator object from the collection and use this to iterate.
    And one more advantage of using iterator: it takes care of deleted entities. If you use global iteration then when you reach deleted entity it will be an exception. But there is no exception with iterator in the same situation.

  • What is difference between modify and update i am using

    hi
    what is difference between mofify and update
    my requiremen is to have three condition checkec while mofifying or updating from a internal table
    the three fields are
    cus no
    status
    date these all are primary key in the database table
    so which sould i use modify or update
    there might be entry already existing in database table or new entry to be created if already existin it should check on the primary keys and updatat if not it should add a record
    pls suggest whihc to use and how to implement the check on teh threee primary key
    like if modify ztable from table it_test
    now where condition ? can be used or not with modify? and if yes how
    if not should i use update will update create a new entry if no entry is there and please give syntex
    regards
    Arora

    Hi Nishant Arora,
    Modify: It works in performing two actions.
    They are: Insert + Update.
    For Example If a record that is exited in database, so you are modifying that record, it updates that particular record.
    Similarly, If the is not existed in the database, you are modifying it, it inserts a new record.
    Update: Update means just it updates the status, I mean it only updates the record. It doesn't inserts any new record if that particular record is not present in the database.
    These are the cases you need to write these statements.
    Syntaxes: :
    Go through this links please.,
    http://help.sap.com/saphelp_nw04/helpdata/en/e7/968aa8b2384dd9835f91e7f8470064/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35eb358411d1829f0000e829fbfe/content.htm
    Reward points if useful
    Cheers,
    Swamy Kunche
    Edited by: Swamy Kunche on Jun 11, 2008 2:41 PM

  • What is Difference between SXMB_MONI and SXMB_MONITOR?

    what is Difference between SXMB_MONI and SXMB_MONITOR?
    Can any explain to this question.please?

    Hello,
    Both are same.
    SXMB_MONI is area menu which will contain all multiple transactions pertaining to monitoring.
    SXMB_MONI contains some functions viz monitoring for Bridging, Archived Msgs, Job overview, persistence layer analysis.
    SXI_monitor directly leads to the message monitoring for the IS, which is part of the SXMB_MONI.
    SXI_MONITOR directly executes the monitoring report.
    Thanks,
    Satya

  • Can Oracle be forced to use the spatial index for sdo_filter in combination with an or clause? Difference between Enterprise and SE?

    We’re seeing the following issue: sql - Can Oracle be forced to use the spatial index for sdo_filter in combination with an or clause? - Stack Overflow (posted by a colleague of mine) and are curious to know if this behaviour is due to a difference between standard and enterprise, or could we doing something else wrong in our DB config.?
    We have also reproduced the issue on the following stacks:
    Oracle SE One 11.2.0.3 (with Spatial enabled)
    Redhat Linux 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    11.2.0.3.0 Standard Edition and 11.2.0.4.0 Standard Edition (both with Spatial enabled)
    Microsoft Windows Server 2003R2 Standard x64 Edition
    However, the SQL works fine if we try it on Oracle 11.2.0.3.0 *Enterprise* Edition.
    Any help or advice would be much appreciated.
    Kindest Regards,
    Kevin

    In my experience sdo_filter ALWAYS uses the spatial index, so that's not the problem. Since you did not provide the explain plans, we can't say for sure but I think yhu is right: Standard Edition can't use the bitmap operations, and thus it'll take longer to combine the results of the two queries (because the optimizer will surely split this OR up in two parts, then combine them).
    BTW: when asking questions about queries here, it would be nice if you posted the queries here as well, so that we do not have to check another website in order to see what you are doing. Plus it will probably get you more answers, because not everyone can be bothered to click on that link. It would also have been nice if you had posted your own answer on the other post here as well, because my recommendation would have been to use union all - but since you already found that out for yourself my recommendation would have been a little late.

Maybe you are looking for

  • Create a report based on Workflow entities status.

    Hello guys! I want to make a report that shows me all entities grouped by workflow status (Not Started, First Pass, Under Review, etc.). It is possible? All answers will be accepted!! Regards! Fabian

  • No reviews in iOS 7 App Store.

    Maybe I'm the only one, but I generally check reviews on new app versions before downloading updates. In iOS 7, you can no longer see current reviews from the updates screen in App Store. Is there any workaround for this?

  • GR/GI number

    hi all in MIGO tranction GR/GI number field is not coming can any body tell me how to activate this ?

  • Packaging EJBs

    Hi I'm learning EJB technology just from books, so please forgive me if this question doesn't make sense or answer is simple :) I'm developing web application that uses EJB. I've about 25-30 entity beans, each in separate jar file. I've recently read

  • IPod Mini STILL dead, though appearing briefly as a zombie.

    Way back on Dec 17, 2007, I wrote "I have an iPod mini 4GB (Second Generation). It has performed without a hitch up until a couple weeks ago. It's usually left plugged in to its AC adaptor, but had been unpowered -- AND unplayed -- for a week. When I