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 into table corresponding fields - syntax

Former Member
0 Likes
9,518

Hi!

I have an structure with a lot of fields and I have a database table with less field. Some of the fields of the structure match the database table fields.

is there a way of doing an "INSERT INTO dtbase CORRESPONDING FIELDS FROM struct"??

Or do I have to move each field by:

dbase_table-field1 = struct-field1

dbase_table-field2 = struct-field2

dbase_table-field6 = struct-field6

and so on??

regards

baran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,817

I think the structure of datase table and internal table should be same while inserting , INTO CORRESPONDING will not work,

you have to go for ur second option

3 REPLIES 3
Read only

former_member404244
Active Contributor
0 Likes
3,817

HI Baran,

u can directly move the fields by writing

move : struct_field1 to dbtable_field1,

struct_field2 to dbtable_field2.

also u can use move-corresponding .

Regards,

Nagaraj

Read only

Former Member
0 Likes
3,818

I think the structure of datase table and internal table should be same while inserting , INTO CORRESPONDING will not work,

you have to go for ur second option

Read only

anversha_s
Active Contributor
0 Likes
3,817

hi baran,

there is an easier way.

code like this.

______________________________________________

data : struct like database_structure.

*suppose there are 3 fields and we want to fill 2 *fields. ie field1 and field3.

struct-field1 = 'val1';

struct-field3= 'val3';

MODIFY data_base_table FROM struct.

_________________________________

this will work.

kindly award points, if u r comfortable with this.

for any clarification just mail me.

Regards,

Anversha.

anversha.shahul@wipro.com

mob 0984 66 77 531