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: 

inserting into table

Former Member
0 Kudos

Hi,

i have created 2 tables and i need to insert the records into them from screens. i have created my internal table according to the screen fields and also tables.but i'm getting a error message as

" The type of the database table and work area (or internal table)

"IT_HEADER" are not compatible. "

any help..

1 ACCEPTED SOLUTION

Sathish
Employee
Employee
0 Kudos

1. Check the definition of work area.

2. The fields in the table are not the same as fields in work area. Do check on this.

12 REPLIES 12

Former Member
0 Kudos

Can you pls share how you have declared

Regards

MD

Former Member
0 Kudos

Hi,

I think your database table and internal table structure is different. just change your internal table field based upon database tabel and try.

0 Kudos

my database table and internal table have same structure.

but in screens the fieldlengths is my concern..

in screen if the length has 18.

in table i have declared it as length is 14 and decimals 2..so ouput length is 18..is it the right way..

0 Kudos

Apart from being same structure, the field length should also match. Otherwise loop at the internal table and assign the value to the table field.

Loop at itab.

dbtab-f1 = itab-f1. (Or) move itab-f1 to dbtab-f1.

endloop.

0 Kudos

Hi,

If its a decimal, then for lenght 14 with decimal 2 means,

12(whole number).2(decimal places)

You said you have declared a structure for the screen. Make sure that the data types used in that structure correspond to those used in ur underlying database tables.

Best regards,

Advait.

0 Kudos

the visible length in the screen for the field is 18.

but it accepts only 13.its of type decimal in the screen..

then how should i declare it in the table for the field?

0 Kudos

Hi,

Post your code segment for troubleshooting.

Regards

Karthik D

Former Member
0 Kudos

Hi,

Use MOVE-CORRESPONDING to move the files from the Screen to the work area of first itab. This work area should be of the same type as ur first table.

The use MOVE-CORRESPONDING to move the fields of the Screen to the work are of the second itab. This work area should be of the same type as ur second table.

After moving the screen fields to the respective work areas, perform the insert operation on the 2 DB tables from its respective workarea's.

Best regards,

Advait.

Sathish
Employee
Employee
0 Kudos

1. Check the definition of work area.

2. The fields in the table are not the same as fields in work area. Do check on this.

satsrockford
Active Participant
0 Kudos

Hi,

Check these demo programs

demo_dynpro_tabcont_loop.

demo_dynpro_tabcont_loop_at.

DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement

DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB

to know more, read into

https://forums.sdn.sap.com/click.jspa?searchID=2934287&messageID=673474

Regards

Satish

Former Member
0 Kudos

Hi,

Declare like this....

No.of Characters : 13

Decimal place : 3

Now total output length : 18

Hope it will helps

Former Member
0 Kudos

Hi,

1st of all when designing the fields in the screen press F6 to get the fields from the program. do not manually create any screen fields. otherwise there would be a lot of mismatch...