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

Append screen inserted row to internal table

Former Member
0 Likes
1,392

Hi Experts,

I have created a program using table control. But after filling a row when i press enter the entire row getting blank.

So i need to append the last inserted row from table control to internal table so that when i press enter that row remains on screen.

Thanks & Regards

Ashutosh Katara

1 ACCEPTED SOLUTION
Read only

former_member192842
Participant
0 Likes
1,247

Hi

Try as below.

PBO

Loop itab into wtab with *****

Module Show data: Here

Endloop

PAI

Loop itab

Module modify_data:

Endloop

Module show_data.

move watab to (structure used in table control)

Endmodule

Module modify_data.

move (table control structure) to watab

modify itab from watab index tctrl-current_line

if sy-subrc <> 0.

append watab to itab.

endif.

Endmodule

Regards

Anand

7 REPLIES 7
Read only

Former Member
0 Likes
1,247

Hi Ashutosh,

Can you try below?

PROCESS BEFORE OUTPUT.

  MODULE STATUS_0100.

  LOOP AT ITAB WITH CONTROL TABC.

  ENDLOOP.

PROCESS AFTER INPUT.

  LOOP AT ITAB.

    MODULE MODIFY_TABLE_CONTROL.

  ENDLOOP.


Write the read_table_control module like below

MODULE modify_table_control INPUT.
   MODIFY itab INDEX tabc-current_line.   
ENDMODULE.

Cheers,

Aditya

Read only

0 Likes
1,247

Hi Aditya,

Thanks for your reply but its not working.

Regards

Ashutosh

Read only

former_member192842
Participant
0 Likes
1,248

Hi

Try as below.

PBO

Loop itab into wtab with *****

Module Show data: Here

Endloop

PAI

Loop itab

Module modify_data:

Endloop

Module show_data.

move watab to (structure used in table control)

Endmodule

Module modify_data.

move (table control structure) to watab

modify itab from watab index tctrl-current_line

if sy-subrc <> 0.

append watab to itab.

endif.

Endmodule

Regards

Anand

Read only

0 Likes
1,247

Hi Anand,

Thanks for you reply it was helpful.

Resolved the query.

Regards

Ashutosh

Read only

Former Member
0 Likes
1,247

Hi,

try this code  in PAI,

IF sy-ucomm = 'ENTER'.

  if  tabc-col1 is NOT INITIAL and

     tabc-col2 is NOT INITIAL and

    tabc-col3 is NOT INITIAL and

     tabc-col4 is NOT INITIAL.

    w_tab-field1 =  tabc-col1.

    w_tab-field2 = tabc-col2.

    w_tab-field3 = tabc-col3.

    w_tab-field3 =  tabc-col4.

   modify <itab> FROM <workarea> INDEX sy-tabix.

ENDIF.

ENDIF

Read only

anubhab
Active Participant
0 Likes
1,247

Hello Ashutosh,

  Firstly, whenever you make any entry in table control, it automatically gets updated in the internal table. This you can check in debugger also (switch ON debugger, just before pressing ENTER).

  Secondly, the sy-ucomm value for ENTER is generally ' ' (Space). So, just check once, if you wrote any code already for sy-ucomm = ' '. If it's so, that part of code will trigger when you press ENTER.  Might be that is why your entire row is getting blank when you press enter.

  Thirdly, please check if you are clearing the work area for the internal table in the PBO/PAI part. In that case, the newly added record might get blank.

  I'll suggest to debug once thoroughly from entering the value in table control till it disappears from the screen and you might end up finding and resolving the issue yourself.

Regards,

Anubhab

Read only

Former Member
0 Likes
1,247

hi Ashutosh,

Please check with this below Code it will work.