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

BADI Execution

Former Member
0 Likes
502

Hi,

MD01, for a single plant it must create a purchase requisition consolidating all the material assosiated to it, instead of creating different PR for each planned order.If the BADI is executed for the first time we are calling bapi_requistion_create for the summed up material quantity,for the next execution of badi we are calling bapi_pr_change to add the items in the PR.We were able to change but not able to add new items to the existing PR.Can we use bapi_pr_change to add new items to the existing PR?How can we identify that the BADI is executed for the 2nd time so that we can find out where we are going wrong while adding items to an existing PR.

Thanks.

2 REPLIES 2
Read only

Former Member
0 Likes
448

Declare a Variable in your BADI as

data : Flag .

inside the Badi follow this

IMPORT FLAG FROM MEMORY ID 'FL'.

IF NOT FLAG IS INITIAL .

<Badi code>

Move X to FLAG.

EXPORT FLAG TO MEMORY ID 'FL'.

Endif.

****************************

So when you enter the BADI for the first time FLAG will have no value when you import & after you execute it for the firs time you will find the value X & so next time on it will not pass the IF condition & so your requirement can be achieved.

regards,

Kevin.

regards,

Kevin.

.

Read only

0 Likes
448

Hi,

I had checked in Debugging if the PRNo is initial it is processing bapi_requisition_create else it is processing bapi_pr_change and it is indeed including the items in PR.But,sometimes it is not.

Do we need to call BAPI_TRANSACTION_COMMIT even after bapi_requisition_create ?I am calling BAPI_TRANSACTION_COMMIT only for/after

bapi_pr_change.Is that the problem ?

Thanks,

Edited by: k464748 on Mar 9, 2009 3:29 AM