Application Development 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: 

problem with ok_code from generate tablecontrol

Former Member
0 Kudos

hello

i've generated two tablecontrols with the wizard in one dynpro and when i scroll or interact with that table the last ok_code is executed.

for example:

i push the save button and data is saved, then i scroll down the tablecontrol and it saves again. or when i toggle display/change and then scroll the tablecontrol it toggles display/change again.

i don't know what to do... but it just shouldnt do that when you scroll the table...

thx in advance, rafe.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

i made it just like that...

----


  • MODULE user_command_0110 INPUT

----


*

----


MODULE user_command_0110 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'BACK'.

PERFORM clear_fields.

CALL SCREEN 0100.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'UNLOCK'.

PERFORM unlock_entry.

WHEN 'SAVE'.

PERFORM save_entry.

WHEN 'DELETE'.

PERFORM delete_entry.

ENDCASE.

CLEAR ok_code.

ENDMODULE. "user_command_0110 INPUT

but when i interact with the tablecontrol there is a pai event where the ok_code is the same than the previous action (save, delete etc.) like i described it before...

5 REPLIES 5

Former Member
0 Kudos

You have to create a extra variabl for ok_code,

ie, in top include

data:

save_ok type sy-ucomm.

and in PAI where u write the CASE statements for function codes, write like this,

ie, In PAI

save_ok = ok_code.

clear ok_code.

case save_ok.

when 'SAVE'.

your conditions..etc.

endcase.

venkat_o
Active Contributor
0 Kudos

Hi Rafe, You have to write code like this in the PAI by writing MODULE.

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_1000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_1000 input.
case ok_code.
  when 'SAVE'.   "Write save related code here
  when 'CHANGE'. "Change related.
endcase.
endmodule.
You have to differentiate for each function code. Regards, Venkat.O

Former Member
0 Kudos

i made it just like that...

----


  • MODULE user_command_0110 INPUT

----


*

----


MODULE user_command_0110 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'BACK'.

PERFORM clear_fields.

CALL SCREEN 0100.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'UNLOCK'.

PERFORM unlock_entry.

WHEN 'SAVE'.

PERFORM save_entry.

WHEN 'DELETE'.

PERFORM delete_entry.

ENDCASE.

CLEAR ok_code.

ENDMODULE. "user_command_0110 INPUT

but when i interact with the tablecontrol there is a pai event where the ok_code is the same than the previous action (save, delete etc.) like i described it before...

0 Kudos

Hi Rafe,

Do one thing,just before you scroll,put /h and enter a break point..then scroll...see what is the sy-ucomm captured..

if it is any of your custom sy-ucomms it means you have not cleared it properly..so in the code do the needful clearing....

Just check and revert back

Regards

Byju

0 Kudos

clear sy-ucomm solved the problem...

i think u helped me most... so you will be rewarded with 10pt 😃