‎2006 Oct 19 11:35 AM
Hi All,
Inserting record in database through table control but only first record is getting insert i want to insert multiple record in the database table.
my code is :
PROCESS BEFORE OUTPUT.
MODULE STATUS_0001.
LOOP at itab WITH CONTROL TBLCTRL cursor TBLCTRL-current_line.
*MODULE move_data_to_table.
ENDLOOP.
PROCESS AFTER INPUT.
***LOOP WITH CONTROL TBLCTRL.
***MODULE move_data_from_table.
***ENDLOOP.
LOOP AT itab.
FIELD ITAB-ZEMPID MODULE MODIFY_SEL ON REQUEST.
FIELD ITAB-ZEMPNM MODULE MODIFY_SEL1 ON REQUEST.
FIELD ITAB-ZEMPPHN MODULE MODIFY_SEL2 ON REQUEST.
FIELD ITAB-ZDEPID MODULE MODIFY_SEL3 ON REQUEST.
ENDLOOP.
MODULE USER_COMMAND_0001.
TABLES : ZYEMP_DTL.
DATA : ITAB LIKE ZYEMP_DTL OCCURS 0 WITH HEADER LINE.
CONTROLS : TBLCTRL TYPE TABLEVIEW USING SCREEN '0001'.
MODULE USER_COMMAND_0001 INPUT.
CASE SY-UCOMM.
WHEN 'INS'.
insert zyemp_dtl from table itab.
if sy-subrc eq 0.
commit work.
endif.
MESSAGE I001(ABC) WITH : 'RECORD INSERTED'.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0001 INPUT
&----
*& Module MODIFY_SEL INPUT
&----
text
----
MODULE MODIFY_SEL INPUT.
if itab[] is not initial.
modify itab index TBLCTRL-current_line transporting ZEMPID.
else.
append itab.
endif.
ENDMODULE. " MODIFY_SEL INPUT
MODULE MODIFY_SEL1 INPUT.
if itab[] is not initial.
modify itab index TBLCTRL-current_line transporting ZEMPNM .
else.
append itab.
endif.
ENDMODULE. " MODIFY_SEL1 INPUT
MODULE MODIFY_SEL2 INPUT.
if itab[] is not initial.
modify itab index TBLCTRL-current_line transporting ZEMPPHN.
else.
append itab.
endif.
ENDMODULE. " MODIFY_SEL2 INPUT
MODULE MODIFY_SEL3 INPUT.
if itab[] is not initial.
modify itab index TBLCTRL-current_line transporting ZDEPID.
else.
append itab.
endif.
Pls Help,
Thanks & Regards,
yunus
‎2006 Oct 19 12:09 PM
Hi,
cnange all occurence of
<b> if itab[] is not initial to
if not itab[] is initial.</b>
Regards
Amole
‎2006 Oct 19 12:10 PM
just create a new functiongroup and go with SE11 in your Table and use the Table maintain generator in menue "utilities".
why do you want to code standard things yourself ?
then you can modify the generated code if you really need something special.