Application Development 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: 

Correct Post delivery - Exits or badis!

manuelhildemaro_ramossanc
Active Participant
0 Kudos

Hi.

I have a problem, i need know if a delivery was posted. I'm implementing some badis,

for example, LE_SHP_DELIVERY_PROC, MB_DOCUMENT_BADI, but that don't tell me

that delivery was posted correctly.

I need know this information for update a client table. In case the delivery not posted, client

table is not updated.

Thank 4 ur reply.

PD. Sorry for my English!

3 REPLIES 3

mvoros
Active Contributor
0 Kudos

Hi

you can make your table updates in FM. Then you can call this FM from your BADI in UPDATE TASK. SAP will create a separate process for this FM and it will execute FM on command COMMIT WORK. So in case that SAP transaction fails, it will not be executed. Check ABAP documentation for more information about calling FM in update task.

Cheers

0 Kudos

Hi Martin.. Thanks 4 ur answer.

However, really i need know if delivery was posted(VL01N, VL02N). Because i can have a material document (MKPF) before standard do a "commit". So i can´t take this material doc if not yet posted.

Best regards.

mvoros
Active Contributor
0 Kudos

Hi,

if you call FM in UPDATE TASK, the FM is executed after the first call of the command COMMIT WORK. So you will call your FM in UPDATE TASK after all validations in your BADI (it depends on BADI but usually there is a method like BEFORE_SAVE). So in this moment, you are sure that you want to create a delivery. When SAP creates or updates all delivery data it calls COMMIT WORK. After this call your FM will be executed and you are sure that delivery already exists. If something happened, SAP will not call COMMIT WORK but it will call ROLLBACK. In this case the execution of your FM will be canceled.

Another way how to solve this problem is to use workflow. But it requires more setting and of course workflow skills.

Cheers