‎2009 Mar 05 3:04 PM
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.
‎2009 Mar 05 5:06 PM
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.
.
‎2009 Mar 06 12:58 PM
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