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

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

Former Member
0 Likes
423

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

2 REPLIES 2
Read only

Former Member
0 Likes
384

Hi,

cnange all occurence of

<b> if itab[] is not initial to

if not itab[] is initial.</b>

Regards

Amole

Read only

Former Member
0 Likes
384

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.