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

ok_code?

Former Member
0 Likes
529

Hi,

I have the following code that is not working:

ZPROG_TOP:


DATA: save_ok LIKE sy-ucomm,
           ok_code LIKE sy-ucomm.

0100 PAI:


  save_ok = ok_code.
  CLEAR ok_code.

The ok_code always is empty, what else do i need to do?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
492

Hi,

In SE51 give the program and screen number..Press change..

In the element list give the OK_CODE in the row which says OK..

This will populate the OK_CODE variable..

Thanks

Naren

3 REPLIES 3
Read only

Former Member
0 Likes
493

Hi,

In SE51 give the program and screen number..Press change..

In the element list give the OK_CODE in the row which says OK..

This will populate the OK_CODE variable..

Thanks

Naren

Read only

Former Member
0 Likes
492

Hi,

Your code should be

save_ok = sy-ucomm.

clear: sy-ucomm.

Now, the actual function code stored in the system variable sy-ucomm will be transfered to your variable save_ok. If you want it in the variable ok_code also, then you can add:

save_ok = ok_code = sy-ucomm.

Hope this helps. Please award points.

Regards,

Nithya

Read only

Former Member
0 Likes
492

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.

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