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

inserting into table

Former Member
0 Likes
1,487

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
Read only

Sathish
Product and Topic Expert
Product and Topic Expert
0 Likes
1,448

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
Read only

Former Member
0 Likes
1,448

Can you pls share how you have declared

Regards

MD

Read only

Former Member
0 Likes
1,448

Hi,

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

Read only

0 Likes
1,448

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..

Read only

Sathish
Product and Topic Expert
Product and Topic Expert
0 Likes
1,448

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.

Read only

0 Likes
1,448

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.

Read only

0 Likes
1,448

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?

Read only

0 Likes
1,448

Hi,

Post your code segment for troubleshooting.

Regards

Karthik D

Read only

Former Member
0 Likes
1,448

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.

Read only

Sathish
Product and Topic Expert
Product and Topic Expert
0 Likes
1,449

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.

Read only

satsrockford
Active Participant
0 Likes
1,448

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

Read only

Former Member
0 Likes
1,448

Hi,

Declare like this....

No.of Characters : 13

Decimal place : 3

Now total output length : 18

Hope it will helps

Read only

Former Member
0 Likes
1,448

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...