Purpose of ok_code in Dialog Program

Could any one can explain the purpose of ok_code in dialog program.

Srinivas

--------------------------------------------------

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.

Global data declarations:

DATA: OK_CODE LIKE SY-UCOMM,
            SAVE_OK LIKE SY-UCOMM.

Your ABAP program must contain a field with the same name as the OK_CODE field on the screen. To specify the type, you should refer to the system field SY-UCOMM, since this always corresponds to the type of the OK_CODE field on the screen. At the same time, you should declare an appropriate auxiliary variable.

PAI module:

MODULE USER_COMMAND_100 INPUT.

  SAVE_OK = OK_CODE.
  CLEAR OK_CODE.

  CASE SAVE_OK.
    WHEN...
   ...
  ENDCASE.

ENDMODULE.

In the first PAI module, you should assign the contents of the OK_FIELD to the auxiliary variable and then clear the OK_CODE field and carry on working with the auxiliary variable.

I hope it will be helpful for you.

Rashi

More Abapers Questions:

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.