Application Development 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: 

How to Insert Records in multiple database using table control

Former Member
0 Kudos

Hi masters so ive been able to insert multiple records in 1 database but i am using table control atm im am not sure if table control is able to insert in multiple database since i can only assign 1 loop in in PBO flow logic of that screen or so i know still new to abap

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

   i will give you a sample code.

   In your PAI create one module inside loop internal table.write logic inside the  module to update database table.the values which are given inside table control in screen are passed into program by assiging workarea of table control to workarea of corresponding table.then pass the value accordingly.

then use insert or update to reflect these values in database.

PROCESS BEFORE OUTPUT.

  LOOP AT IT INTO WA WITH CONTROL TC1.

  ENDLOOP.

  MODULE STATUS_9000.

  PROCESS AFTER INPUT.

  MODULE USER_COMMAND_9000.

LOOP AT IT.

module update."doubleclick here space will be created in se38 program inside write logic to insert in db

ENDLOOP.

*&---------------------------------------------------------------------*

*&      Module  update  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE update INPUT.

    wa_db1-f1 = wa-f1.

   wa_db1-f2 = wa-f2.

   wa_db2-f1= wa-f3.

   wa_db2-f2=  wa-f4.

   INSERT zdb1 FROM wa_db1."or use update

   INSERT zdb2 FROM wa_db2." por use update

   ENDMODULE.                 " update  INPUT

here i have used two database table.likewise we can use any number of database table.

2 REPLIES 2

former_member197916
Active Participant
0 Kudos

hi,

you can create a module and in it you can run loops also you can move data between tables and use modify to update database tables

Former Member
0 Kudos

Hi,

   i will give you a sample code.

   In your PAI create one module inside loop internal table.write logic inside the  module to update database table.the values which are given inside table control in screen are passed into program by assiging workarea of table control to workarea of corresponding table.then pass the value accordingly.

then use insert or update to reflect these values in database.

PROCESS BEFORE OUTPUT.

  LOOP AT IT INTO WA WITH CONTROL TC1.

  ENDLOOP.

  MODULE STATUS_9000.

  PROCESS AFTER INPUT.

  MODULE USER_COMMAND_9000.

LOOP AT IT.

module update."doubleclick here space will be created in se38 program inside write logic to insert in db

ENDLOOP.

*&---------------------------------------------------------------------*

*&      Module  update  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE update INPUT.

    wa_db1-f1 = wa-f1.

   wa_db1-f2 = wa-f2.

   wa_db2-f1= wa-f3.

   wa_db2-f2=  wa-f4.

   INSERT zdb1 FROM wa_db1."or use update

   INSERT zdb2 FROM wa_db2." por use update

   ENDMODULE.                 " update  INPUT

here i have used two database table.likewise we can use any number of database table.