‎2007 Apr 11 1:22 PM
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
‎2007 Apr 11 1:31 PM
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.
‎2007 Apr 12 6:22 AM
‎2007 Apr 12 6:31 AM
Try to use work area
MODIFY G_TC2_ITAB
FROM G_TC2_WA
INDEX TC2-CURRENT_LINE.
‎2007 Apr 12 9:14 AM
‎2007 Apr 12 9:59 AM
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.
‎2007 Apr 12 10:13 AM
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.
‎2007 Apr 13 1:17 PM