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

Internal table not getting modified from Table Control

former_member434229
Active Participant
0 Likes
1,044

Hi Guys,

I am developing a <b>Module Pool </b>Program where I am inserting data directly in table control of the main screen.

In the flow logic of the Table control I have written :

PROCESS BEFORE OUTPUT.

LOOP AT itab WITH CONTROL tc1 CURSOR tc1-current_line.

MODULE read_data.

ENDLOOP.

MODULE status_0100.

PROCESS AFTER INPUT.

LOOP AT itab.

MODULE mod_data.

ENDLOOP.

MODULE user_command_0100.

Module mod_data input.

MODIFY itab INDEX tc1-current_line.

Endmodule.

At modify, when I am debugging it's showing sy-subrc = 4 (Entry not appending in Int Table though it is there in the header line). But, if I use append itab, it's working (Problem is that while inserting 2nd record a copy of first record is also appending which I don't want).

Please let me know what's wrong in Modify statement or what is solution for inserting records of tablecontrol in internal table.

TIA,

Nitin

7 REPLIES 7
Read only

Former Member
0 Likes
816

Try using the read statement as below:

Module mod_data input.

READ TABLE itab INDEX tc1-current_line.

if sy-subrc = 0.

MODIFY itab INDEX sy-tabix..

endif.

Endmodule.

Read only

0 Likes
816

Still not working.

Read only

0 Likes
816

Try to use work area

MODIFY G_TC2_ITAB

FROM G_TC2_WA

INDEX TC2-CURRENT_LINE.

Read only

Vijay
Active Contributor
0 Likes
816

hi...

refer the program zpurcr_71945 in ecc.

it should help you out.

regards

vijay

Read only

Former Member
0 Likes
816

Hi Nitin,

use the following code wor module.

Module mod_data input.

READ ITAB INDEX TC1-CURRENT_LINE.

IF SY-SUBRC = 0.

MODIFY itab INDEX tc1-current_line.

ELSE.

APPEND ITAB.

ENDIF.

Endmodule.

Read only

Former Member
0 Likes
816

Hi Nitin,

Try the following code for Module.

MODULE MOD_DATA INPUT.

READ TABLE ITAB INDEX TC1-CURRENT_LINE.

IF SY-SUBRC = 0.

MODIFY itab INDEX tc1-current_line.

ELSE.

APPEND ITAB.

ENDIF.

Endmodule.

Read only

former_member434229
Active Participant
0 Likes
816

Thanks Sankar.