Skip to Content
0
Former Member
Oct 19, 2006 at 10:35 AM

Problem while Inserting record in database through table control...

17 Views

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