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/modify : It won't commit?!

Former Member
0 Likes
1,036

Hi guys,

I am trying to insert several line into a Z db table.

I use : modify zmm_modif from zmm_modif.

I do it 10 times with different value but i get only 1 line into my DBtable.

After searching forums, i tries several solutions :

I added : COMMIT WORK AND WAIT.

or 'COMMIT WORK'

or CALL FUNCTION 'DB_COMMIT'.

But none of these solutions work.

The only addition that works is : 'WAIT up to 1 seconds'. But it takes ages (10 sec) to do the job.

Its the same result with insert or modify.

Anyone has an idea?

Thank for your help.

Olivier.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,000

I do it 10 times with different value but i get only 1 line into my DBtable.

You should disregard some of the answers...doing this from within a loop is NOT efficient and should be avoided. My tables update without the commit work, since my program ends normally...

As last previous poster noted, what are you changing? Unless you change the KEY fields values, there will be no additional rows.

8 REPLIES 8
Read only

former_member194669
Active Contributor
0 Likes
1,000

data : begin of it_zmm_modif occurs 0.
include structure zmm_modif.
data : end of it_zmm_modif.

loop....
append value to it_zmm_modif.
endloop...
" Collect all your data in internal table within loop then

modify zmm_modif from FROM TABLE  it_zmm_modif.
commit work.

a®

Read only

Former Member
0 Likes
1,000

data : begin of it_zmm_modif occurs 0.

include structure zmm_modif.

data : end of it_zmm_modif.

loop at it_zmm_modif.

modify zmm_modif from it_zmm_modif.

endloop

Read only

0 Likes
1,000

Hi,

Are you in a loop or do you want to do your insert from an internal table.?

because with the additionnal key word: from wa you must do in a loop if you have severals lines.

Best regards Sylvain

Read only

Former Member
0 Likes
1,000

Hi,

Do the operation in the lOOP-----ENDLOOP.

Before endloop .use AAPEND .It will work.

Regards,

Pravin

Read only

Former Member
0 Likes
1,000

Hi joskin...

the modify statemente overwrite the record with the same key fields and create new record if the

aren't record without key fields equals to the new record...

so check you are changing the value of the key field in the new records.

Best regards

Marco

Read only

Former Member
0 Likes
1,001

I do it 10 times with different value but i get only 1 line into my DBtable.

You should disregard some of the answers...doing this from within a loop is NOT efficient and should be avoided. My tables update without the commit work, since my program ends normally...

As last previous poster noted, what are you changing? Unless you change the KEY fields values, there will be no additional rows.

Read only

deepak_dhamat
Active Contributor
0 Likes
1,000

hi ,

Please check table's primary key .

Regards

Deepak.

Read only

0 Likes
1,000

I changed the index and it works. Thank for your help guys !

Olivier.