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 / commit

Former Member
0 Likes
1,507

Hello all,

I have written a Z-Programm that generates CO-PA line items and I have written a function module that inserts the document numbers of the generated line items into a Z table.

At the end of the function module i have the coding in file attached.

When I run my Programm I generate like 100 documents, but some documents don't get inserted into my z-table.

How can this be ?

Kind regards,

Max

13 REPLIES 13
Read only

former_member201275
Active Contributor
0 Likes
1,481

Doesn't help when you don't post your complete code, i can only see snip of this i.e. commit work section?

Read only

FredericGirod
Active Contributor
0 Likes
1,481

Hi,

why didn't use COMMIT WORK AND WAIT ?

regards

Fred

Read only

Former Member
0 Likes
1,481

Hi guys,

sorry but I am not allowed to post coding from a customer System.

What does commit work and wait do ?

Thanks !

Max

Read only

0 Likes
1,481

Hi,

Commit work and wait, will wait until everything is updated to the Database(in one sentence).

For more info.

ABAP Keyword Documentation

Regards

Sajid

Read only

0 Likes
1,481

You are not allowed to post coding from, but you did post the commit work section? Would help if you could at least post the relevant sections then, otherwise we can spend days guessing what is the problem.

Read only

Former Member
0 Likes
1,481

Hi,

Check the Primary key combination in your Z-table.

Also use commit work and wait.

Regards

Sajid

Read only

0 Likes
1,481

Well, the insert generally works, but some doc numbers are not inserted. So Primary key can not be an issue.

Commit work and wait didnt' solve the issue.

I generated 22 documents but only 20 document numbers got inserted into my z table.

Thanks for all of your replies !

Read only

0 Likes
1,481

Are you sure the 22 documents have differents primary keys ?

Fred

Read only

0 Likes
1,481

Yes, document numbers 3071 - 3092.

Read only

Former Member
0 Likes
1,480

Hi Max

your posted code is little strange:

why do you insert the COMMIT in a do cycle?

I don't know if the COMMIT and WAIT can halp you, because (I suppose) you don't have any saving proccess running in update task,

So only the COMMIT should be enough.

I don't believe the problema is here, probably yuo have a problem with duplicated key, but I can't be sure without to see how you save the data.

Max

Read only

0 Likes
1,480

If have read in documentation that if commit work Fails the sy-subrc is 4.

So I made this Loop in order to be sure commit has been performed before leaving the function module.

You are right, I am not running any processes in update task.

Also duplicate keys are no issue as the document numbers generated by CO-PA are distinct

Regards,

Max

Read only

0 Likes
1,481

Hi

the COMMIT is not your problem

You need to post how you save the data in your Z-TABLE: it's not easy to help you without to know it

Max

Read only

0 Likes
1,481

This may sound ridicolous, but I fail to copy & paste my coding into this Formular. When I try to do so, nothing happens 😞

Regards

Max