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

Problem with create two OT with the same storage unit.

Former Member
0 Likes
691

Hi,

I only speak a little englis so I wait that you can understandme.

I have a storage unit thay I want to move. I need to move from a storage bin A to storage bin B, and, move the same unit from storage bin B to storage bin D.

So, I have, two L_TO_CREATE_MULTIPLE.

I need use a SAP LUW because, if one bapi fail, I don't want to execute anything.

I try it to use SET UPDATE TASK LOCAL or in the parameters of L_TO_CREATE_MULTIPLE check I_UPDATE_TASK. However, when I do the second bapi, this return an error because the data of first bapi aren't in the database.

How can I make it?

Thank you very much.

1 ACCEPTED SOLUTION
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
644

I think it can't be done as just one LUW because you have to commit the update after the first BAPI run. Otherwise the second BAPI just has nothing to work with.

If I understand the task correctly, it should go like this:

1) Run first BAPI. If everything is OK, commit work. Otherwise do not commit and exit.

2) Run second BAPI. If there is a problem with the second BAPI, either you'll have to accept this and have it handled manually or run a "reverse" of the first BAPI, i.e. put the stock back where it was.

It seems to be a rather strange process though (why do A->B->C and not just move from A to C?) and I would ask your functional consultant if there could be a better solution.

4 REPLIES 4
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
645

I think it can't be done as just one LUW because you have to commit the update after the first BAPI run. Otherwise the second BAPI just has nothing to work with.

If I understand the task correctly, it should go like this:

1) Run first BAPI. If everything is OK, commit work. Otherwise do not commit and exit.

2) Run second BAPI. If there is a problem with the second BAPI, either you'll have to accept this and have it handled manually or run a "reverse" of the first BAPI, i.e. put the stock back where it was.

It seems to be a rather strange process though (why do A->B->C and not just move from A to C?) and I would ask your functional consultant if there could be a better solution.

Read only

0 Likes
644

Hello Jelena,

You are ok, is not possible use two times bapi create ot, because, it's necesary update changes in the database.

My problem, is, in the bapi, there is a case in that the bapi fail, and don't pass for the exceptions. Then, I can't try to reverse the first bapi. I want use the luw in this case. I try to see how can I capture this error to manage the exception in the program.

Thank you very much.

Best regards.

Read only

0 Likes
644

If this is really a 'hard' error, BAPI should return it IMHO. Otherwise you might want to send a note to SAP (in the worst case you'll get some explanation). But sometimes BAPI returns a type I or W message when it's really an error in the business sense. Unfortunately, these are not easy to catch and it requires a lot of testing and trial and error.

Make sure to analyze all the messages returned by BAPI. Once I had to catch a specific error message by class/number and it was actually discovered only after we went live (a very rare exception).

Read only

0 Likes
644

Thank you very much Jelena.