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

Insert database from 2 tables

former_member582701
Contributor
0 Likes
459

Hi!

I have field-symbol table with some components. And i have another internal table with other fields. Example:

itab (field1, field2, field3)

fs (component1, component2) " like zstruct

I have a table with

field1

field2

field3

struct (zstrcut with 2 fields)

How i can insert into database table?

Regards

pd: really it is not 2 internal tables. It is 2 work areas.

Message was edited by:

Manel Casadesus

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
438

First copy the values of itab & fs into workarea whcih is type of database table.

To move from itab- Use MOVE

To move from fs - Use ASSIGN COMPONENT

then using INSERT statement u insert the record into DB table.

Regards,

Sail

Message was edited by:

Aarun Sailyendran Murugesan

3 REPLIES 3
Read only

suresh_datti
Active Contributor
0 Likes
438

loop at itab into wa.

insert into dbtab values wa.

endloop.

~Suresh

Read only

Former Member
0 Likes
439

First copy the values of itab & fs into workarea whcih is type of database table.

To move from itab- Use MOVE

To move from fs - Use ASSIGN COMPONENT

then using INSERT statement u insert the record into DB table.

Regards,

Sail

Message was edited by:

Aarun Sailyendran Murugesan

Read only

Former Member
0 Likes
438

Create one more work area which has the same structure as the Z table.

And move values from those 2 work areas to the new work area.

wa_ztable-field1 = itab-field1.

..

and insert this work area into z table.

INSERT INTO ztable VALUES wa_ztable.