Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Why save_ok = ok_code.

Former Member
0 Likes
1,007

Hi all,

foy any reasons - which I cannot remember - it is adviced to copy the OK_Code into save_ok.

e.g: BCALV_EDIT_04

Could anyboly pls. explain why this is advised?

Thx, Regards Mario

*---------------------------------------------------------------------*
*       MODULE PAI INPUT                                              *
*---------------------------------------------------------------------*
module pai input.
  save_ok = ok_code.
  clear ok_code.
  case save_ok.
    when 'SAVE'.
      perform save_data.
    when 'BACK'.
* §10.Unlock your database table.
      perform unlock_sflight.
      leave to screen 0.
    when 'EXIT'.
      perform exit_program.
    when others.
*     do nothing
  endcase.
endmodule.
1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
743

In the program BCALV_EDIT_04, duplicating the ok_code value is useless.

Generally speaking, when you press Enter (or a scroll key in a table ontrol), the ok code (and even sy-ucomm) is not reset, it's why it may be useful to clear the ok code before displaying the screen: the most convenient way is to do it at the beginning of the PAI (in case there's a warning/error message during the PAI, the PBO wouldn't be triggered).

More info here: SAP Library: Reading Function Codes

2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
744

In the program BCALV_EDIT_04, duplicating the ok_code value is useless.

Generally speaking, when you press Enter (or a scroll key in a table ontrol), the ok code (and even sy-ucomm) is not reset, it's why it may be useful to clear the ok code before displaying the screen: the most convenient way is to do it at the beginning of the PAI (in case there's a warning/error message during the PAI, the PBO wouldn't be triggered).

More info here: SAP Library: Reading Function Codes

Read only

Former Member
0 Likes
743

Hi Sandra!

Thanks, it is clear now!

Regards Mario