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

Lock Issue - with custom program -Intercompany automatic GR with Replenishment delivery .

0 Likes
1,872

Hell expert.

I have a business scenario- when the user use the following transactions - MB11, Co11n, MIGO and QA11. After clicking save it should automatically do everything till GR. So this means that we have to check PO exists or not if not then create PO and then create Replenishment outbound delivery wrt PO and then update picking and then GI and then GR.

So I found the enhancement spot in MM07MFB9_BUCHEN_AUSFUEHREN which is called by all the transactions. Here I read MSEG table and insert values to the custom table and then called my custom program from the enhancement and read data from the custom table and called corresponding BAPI's to accomplish the task.

1. PO is created - BAPI_PO_CREATE1

2. Delivery also created wrt PO - BAPI_OUTB_DELIVERY_CREATE_STO but delivery qty is 0 because the material is locked by me and so i couldn't proceed further.

I am also using COMMIT after BAPI'S.

These locks are obtained at the enhancement spot itself. it is not wise to use dequeue all. Please provide me your input on how can I achieve this.

I am kind of stuck and can not think of the solution. I have no idea how can I achieve this?

looking forward for your inputs and thanks in advance.

Regards

Reshu

Hell expert.

I have a business scenario- when the user use the following transactions - MB11, Co11n, MIGO and QA11. After clicking save it should automatically do everything till GR. So this means that we have to check PO exists or not if not then create PO and then create Replenishment outbound delivery wrt PO and then update picking and then GI and then GR.

So I found the enhancement spot in MM07MFB9_BUCHEN_AUSFUEHREN which is called by all the transactions. Here I read MSEG table and insert values to the custom table and then called my custom program from the enhancement and read data from the custom table and called corresponding BAPI's to accomplish the task.

1. PO is created - BAPI_PO_CREATE1

2. Delivery also created wrt PO - BAPI_OUTB_DELIVERY_CREATE_STO but delivery qty is 0 because the material is locked by me and so i couldn't proceed further.

I am also using COMMIT after BAPI'S.

These locks are obtained at the enhancement spot itself. it is not wise to use dequeue all. Please provide me your input on how can I achieve this.

I am kind of stuck and can not think of the solution. I have no idea how can I achieve this?

looking forward for your inputs and thanks in advance.

Regards

Reshu

5 REPLIES 5
Read only

RaymondGiuseppi
Active Contributor
1,703

Don't execute your program in this include, call a wrapper RFC enabled FM, call it in background so it will execute after the transaction commit and update tasks release the locks.

Read only

0 Likes
1,703

NB: "call it in background" means CALL FUNCTION ... IN BACKGROUND TASK ... (or run it via bgRFC cl_bgrfc_destination_outbound=>create + create_trfc_unit + CALL FUNCTION ... IN BACKGROUND UNIT ...)

(tRFC/bgRFC is triggered after update tasks/after the locks have been released)

Read only

0 Likes
1,703

Thank you expert for guiding me .. i could see - FM has Remote enabled option. So do i have to create a FM passing my program name and call it at enhancement spot but then it will execute it directly .. i am so sorry that i have limited knowledge and i am not able to catch your point .. is to possible to explain me in little more detail please.. ..I read 'call function in background' still it is not clear to me. https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapcall_function_background_task.htm

Read only

1,703

Call function in background task will be executed after commit and execution of high-priority update function modules. Look at Abap documentation of COMMIT WORK.

Read only

0 Likes
1,703

Thanks for the explanation.

So i have created FM with Remote enabled option. and called this FM from the enhancement spot in MM07MFB9_BUCHEN_AUSFUEHREN .

CALL FUNCTION 'ZZZ' in BACKGROUND TASK.

I am calling a custom program using SUBMIT ZPROG and Return in the FM 'ZZZ'. I have tRFC enable the debugging setting and also I am seeing entry at T.code SM58 and from there it is jumping to FM 'ZZZ' also but not to custom program. How should I call custom program from this FM?

When I am changed FM as Update Mode with start delay and called at enhancement as CALL FUNCTION 'ZZZ' in Update TASK, it is jumping to custom program.

Please provide your input.

Thanks in advance.