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

Table control data gets refreshed on *enter*

Former Member
0 Likes
3,043

Hi guys,

I am using table control...the problem with it is that...when ever i hit the ENTER buttom

all the data in the fields of the table control refreshes. Though when i hit save i am able to get

the data in my internal table. How can i stop the data from disappearing on hitting the enter button.

thanks in advance,

Mayank.

9 REPLIES 9
Read only

Former Member
0 Likes
1,665

Hi,

->Try populating your data from the internal table onto your table control columns in the PBO as well. Whenever your press ENTER, the PAI is triggered where you would have written data that populates the internal table and then the PBO is invoked where there is no data to display your internal table values.

->Restrict this portion of code using


loop at itab with control tc.
   module display_data.
endloop.

module display_data.
if sy-ucomm eq 'ENTER'.
<screen-field1> = itab-field1. "Repopulate values in the PBO
<screen-field2> = itab-field2.
endif.
endmodule.

->If you want to set a sy-ucomm value for ENTER, go to PF-STATUS -> Application Tool bar -> first icon with a tick mark (Enter) -> assign function code as ENTER and use this sy-ucomm value in your code.

Read only

venkat_o
Active Contributor
0 Likes
1,665

Hi Mayyank, Try this way. <li> Flow logic of the screen

"Flow Logic of the screen.
PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  LOOP AT ITAB WITH CONTROL TABC.
  ENDLOOP.

PROCESS AFTER INPUT.
  LOOP AT ITAB.
    MODULE READ_TABLE_CONTROL.
  ENDLOOP.
<li>Write the read_table_control module like below
MODULE read_table_control INPUT.
   MODIFY itab INDEX tabc-current_line. 
   "The above will update the entered data on table control
 ENDMODULE.
Thanks Venkat.O

Read only

Former Member
0 Likes
1,665

HI venkat,

Thnx for the prompt reply i did as you said my...... internal table was without a

header line so i used the following code

LOOP WITH CONTROL ctrl.

CHAIN.

FIELD wa_rpmno-zrpmno1 MODULE check_rpno. ---> here i validate the data

ENDCHAIN.

MODULE table. --> i populate the internal table

MODULE display_data.

ENDLOOP.

MODULE display_data INPUT.

MODIFY it_rpmno INDEX ctrl-current_line FROM wa_rpmno .

ENDMODULE.

still data gets refreshed on hitting enter

Read only

Former Member
0 Likes
1,665

Hi,

Try this,


PROCESS BEFORE OUTPUT.

  LOOP AT gt_itab1 WITH CONTROL tabcontrol.
    MODULE display_data.
  ENDLOOP.

PROCESS AFTER INPUT.

  MODULE clear_internal_table.
  LOOP AT gt_itab1.
    MODULE read_data.
  ENDLOOP.

MODULEclear_internal_table INPUT.
   clear gt_itab1[].
   clear gt_itab1.
ENDMODULE.

MODULE read_data INPUT.
if sy-ucomm eq 'ENTER'.  "Set the function code for ENTER as I mentioned in my previous post
   "Populate your internal table
endif.
ENDMODULE.

MODULE display_data OUTPUT.
   if sy-ucomm eq 'ENTER'.
     "Populate the table control with data in the internal table
  endif.
ENDMODULE.

Read only

Former Member
0 Likes
1,665

Hi Nitwick,

I understood where the problem lies.I am able to populate my internal table in PAI

i am getting the following error when i loop the inernal table in PBO --- The addition "WITH CONTROL CTRL" is missing in a LOOP in PBO.


PROCESS BEFORE OUTPUT.
  MODULE status_9001.
  LOOP at it_rpmno WITH CONTROL ctrl CURSOR ctrl-current_line.
    MODULE display_data2.                                                               --->> here i am assigin the values to the screen.
  ENDLOOP.

Thanks,

Mayank

Read only

Former Member
0 Likes
1,665

Hi Nitwick,

I understood where the problem lies.I am able to populate my internal table in PAI

i am getting the following error when i loop the inernal table in PBO --- The addition "WITH CONTROL CTRL" is missing in a LOOP in PBO.

i have declared my internal table in the following way

it_rpmno TYPE TABLE OF ZVAL WITH HEADER LINE. ---> where zval is a structure.


PROCESS BEFORE OUTPUT.
  MODULE status_9001.
  LOOP at it_rpmno WITH CONTROL ctrl CURSOR ctrl-current_line.
    MODULE display_data2.                                                               --->> here i am assigin the values to the screen.
  ENDLOOP.

Thanks,

Mayank

Edited by: Mayyank on Aug 26, 2009 11:09 AM

Read only

Former Member
0 Likes
1,665

HI,

In the PBO and PAI you will need to run a loop on the table control and read the data in PBO while modify it in PAI.

Use the statement

Read internal table contents into your table control based on the index of the current line of the table control in the PBO

while

Modify the internal table contents again using the index of the current line of the table control in the PAI.

The reason that the data is refreshed is probably because after you hit enter the PAI is called and thereafter PBO is called again. Now if you are using the read statement in the PBO it will display the data after displaying the records and when you press enter, if you don not modify the records, then the PBO is called again and the non modified or the old data is redisplayed (in your case it is refreshed). So the modify statement in the should take care of your isseu.

Regards,

Sachin

Read only

Former Member
0 Likes
1,665

Thanks a lot nitwick and venkat....

Read only

Former Member
0 Likes
1,665

Thanks a lot nitwick and venkat....