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

MODIFY Statement

Former Member
0 Likes
1,157

Hello All,

I have a small issue with MODIFY statement.

The following is the table structure

ZZB_MANDT MANDT CLNT 3 Client

ZZB_KUNNR KUNNR CHAR 10 Customer number

ZZB_KTOKD ZB_KTOKD CHAR 4 BEST Customer Account Group

ZZB_VKORG VKORG CHAR 4 Sales organization

ZZB_VTWEG VTWEG CHAR 2 Distribution channel

ZZB_PARVW PARVW CHAR 2 Partner function ID (e.g. SH f

ZZG_PARTN ZG_KUNNR CHAR 10 GLOBE Customer Number

ZZB_PARTN ZB_KUNNR CHAR 10 BEST Customer Number

ZZG_KUNNR ZG_KUNNR CHAR 10 GLOBE Customer Number

ZZG_KTOKD CHAR 4 GLOBE Account Group

ZZG_VKORG CHAR 4 GLOBE Sales Organization

ZZG_VTWEG CHAR 2 GLOBE Distribution Channel

ZZG_PARVW PARVW CHAR 2 Partner function ID (e.g. SH f

ZZB_KNFLG CHAR 1 KNVP Flag

ZZB_TELX1 TELX1 CHAR 30 Telex number

ZZB_LSTCHGDT ZLSTCHG DATS 8 Date last changed

ZZB_LSTCHGTM AEZET TIMS 6 Time last change was made

ZZB_CHGBY ZCHGBY CHAR 12 Created / Changed By

I am trying to insert some records in to the above database by using the modify statement as below:

modify zg_patnr_tab from table a00_mandt_data.

the following is the data:

0204062407|0001 |NUSA |00 |RE |0000944819|0300000019 |

0204062407|0001 |NUSA |00 |RE |0000944819|0300000401 |

0204062407|0001 |NUSA |00 |RE |0000944819|0312345940 |

when the above statement is executed it inserts only one record into the database rather than inserting all the three records.

I tried using INSERT statement.. its giving me short dump.

I want all the three records to get inserted into the database.

Could anyone help me on the above issue..

Thank You,

Suresh

12 REPLIES 12
Read only

Former Member
0 Likes
1,108

ZZB_MANDT MANDT CLNT 3 Client

ZZB_KUNNR KUNNR CHAR 10 Customer number

ZZB_KTOKD ZB_KTOKD CHAR 4 BEST Customer Account Group

ZZB_VKORG VKORG CHAR 4 Sales organization

ZZB_VTWEG VTWEG CHAR 2 Distribution channel

ZZB_PARVW PARVW CHAR 2 Partner function ID (e.g. SH f

ZZG_PARTN ZG_KUNNR CHAR 10 GLOBE Customer Number

are the key fields in the above database.

Read only

Former Member
0 Likes
1,108

Hi,

Make sure all the key fields are filled in the internal table including MANDT..

And also check if the other 2 records are already available in the table..As modify will update if the record is already in the table..

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

Read only

0 Likes
1,108

Narendran,

Wat is happening is its inserting the first record into the table and its modifying the same statement twice, rather than inserting all the three records.

Is it because i am using the MODIFY statement.

-Suresh

Read only

Former Member
0 Likes
1,108

Yes..MODIFY will update if the record is already there in the table with the key combinations..

Otherwise it will insert..

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

Read only

0 Likes
1,108

If i use INSERT then i am getting a short dump

Read only

Former Member
0 Likes
1,108

Hi,

Please send the short dump description..

Thanks,

Naren

Read only

0 Likes
1,108

ABAP runtime errors SAPSQL_ARRAY_INSERT_DUPREC

Occurred on 08/25/2006 at 15:05:13

The ABAP/4 Open SQL array insert results in duplicate database records.

What happened?

The current ABAP/4 program "ZMDR2090 " had to be terminated because

one of the statements could not be executed.

This is probably due to an error in the ABAP/4 program.

Read only

Former Member
0 Likes
1,108

Hi,

The reason is you try to INSERT the records which are already there in the database table..

If you use ACCEPTING DUPLICATES then it will ignore the records that are already there.And I believe the sy-subrc will be set to 4.

Please award if it helps..

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

Read only

0 Likes
1,108

I solved the problem on my own.. i made the field ZZB_PARTN Key Field.

Now it is working...

Thank You For your help

Read only

Former Member
0 Likes
1,108

hey Suresh,

Yes it is because of Modify statement only....

modify will either insert or update depending on the key fields...

here in your case all the 3 records are having same key so first time it will insert the record and next two times it updates the same record in the table...

insert will give short dump for the 2nd and 3rd records as you are trying to insert a record which is having same key combination as your first record

if you want add all the 3 records to the table then make the next field also as key...this will solve your problem.

Read only

0 Likes
1,108

that means add ZZB_PARTN ZB_KUNNR as key field in your table....

Read only

Former Member
0 Likes
1,108

Suresh Babu

please remember to award points for helpful answers and mark your post as solved when solved completely.