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

Database Updation and Insertion using Modify Statement

Former Member
0 Likes
1,241

Hi All,

I am using Modify statment for data insertion and updation

MODIFY zmpit_ven_bgg_rg FROM TABLE t_ven_bgg .

But I am getting error

The type of the database table and work area (or internal table) "T_VEN_BGG" are not compatible.

I have defined my internal table of below type :

TYPES : BEGIN OF ty_ven_bgg,

mandt TYPE mandt,

lifnr TYPE lfa1-lifnr,

bgg TYPE zmpit_ven_bgg_rg-matkl,

ind TYPE zmpit_ven_bgg_rg-active_ind,

created_by TYPE zmpit_ven_bgg_rg-created_by,

created_on TYPE zmpit_ven_bgg_rg-created_on,

last_changed_by TYPE zmpit_ven_bgg_rg-last_changed_by,

last_changed_on TYPE zmpit_ven_bgg_rg-last_changed_on,

remarks TYPE zmpit_ven_bgg_rg-remarks,

ind1(1) TYPE c,

END OF ty_ven_bgg.

Here, ind1 is not field of the table.

I have added a new field Remarks in the table and thus i included it in the Internal table also.

Above Modify statement was working fine without Remarks field. I am not able to understand the error

as work area is also of type ty_ven_bgg.

Please suggest some solution.

Regards,

Nibha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,216

Hi,

When u modify the data in database table using internal table or work area ,database table and internal table structure should be same.

11 REPLIES 11
Read only

Former Member
0 Likes
1,217

Hi,

When u modify the data in database table using internal table or work area ,database table and internal table structure should be same.

Read only

0 Likes
1,216

I made another type definition without including the field IND1 and Internal Table of that type. It is working now.

Read only

0 Likes
1,216

I have excluded the field from another type definition and appended the data from old table to new table and it is working fine now. Thank you everyone.

Edited by: NIBHA Priya on Jan 5, 2009 1:44 PM

Read only

Former Member
0 Likes
1,216

verify whether you have included all the fields from the "ztable" in your internal table....both the structures needs to be similar

Read only

Former Member
0 Likes
1,216

Hi Priya,

You have only create a userdefined type ty_ven_bgg with the TYPES (TYPES : BEGIN OF ty_ven_bgg,)

statement.so the system does not consider this as an internal table that is the reason why an error has occured when you used modify statement.please create an internal table using DATA keyword.This should be helpful.

Regards

Vasavi

Read only

ThomasZloch
Active Contributor
0 Likes
1,216

Did you activate the database table after the modification?

Also, you could try using this syntax:


TYPES: BEGIN OF ty_ven_bgg.
         INCLUDE STRUCTURE zmpit_ven_bgg_rg.
TYPES:   ind1(1) TYPE c,
       END OF ty_ven_bgg.

Thomas

Read only

Former Member
0 Likes
1,216

Hi,

when the field ind1(1) TYPE c is not in the Table , when you are modifying from the workarea into the Database table .

It will show the database Compatible only.

Check that field exists in the database table.

Regards,

Madhavi

Read only

0 Likes
1,216

I have excluded the field from another type definition and appended the data from old table to new table and it is working fine now. Thank you everyone,

Read only

0 Likes
1,216

Better reference the DDIC structure in your type definition as I suggested above, no need for error-prone double maintenance then.

Thomas

Read only

former_member156446
Active Contributor
0 Likes
1,216
MODIFY zmpit_ven_bgg_rg FROM TABLE t_ven_bgg .

Your internal table must be declared like this.. or use all the fields of the Ztable..

data: begin of t_ven_bgg.
include structure of zmpit_ven_bgg_rg.
data: end of t_ven_bgg.

Read only

Former Member
0 Likes
1,216

Hi,

Though you have creaated one more internal tsble without the indc field, but you can do it using the same intrenal table by simply using

1. MOVE-CORRESPONDING <internal table> to <ztable>.

2.MODIFY <ztable>.

will solve your problem

Secondly declare the internal table using DATA after structure has been declared using TYPES.

This is better approach to follow.

Pooja