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

change batch trough bapi in badi

Former Member
0 Likes
3,045

Hi all,

i am trying to update the batch during the process order release,i want to update the batch when i press save button after release of process order in cor2.i am using badi workorder_update.

there i have methods

in_update,

before_update

at_save.

when i try to call bapi_batch_change in the update it is trowing dump saying that creating nested perform on commit.

than i tried to update in before_update there also same problem than i created a FM as update module and calling the bapi inside the FM there also i got the dump.

now i called my FM as update task in method at_save it is giving dump..

can't i call bapi or update module in update task methods or before update.

thanks alot.

babita

Hi all,

i am trying to update the batch during the process order release,i want to update the batch when i press save button after release of process order in cor2.i am using badi workorder_update.

there i have methods

in_update,

before_update

at_save.

when i try to call bapi_batch_change in the update it is trowing dump saying that creating nested perform on commit.

than i tried to update in before_update there also same problem than i created a FM as update module and calling the bapi inside the FM there also i got the dump.

now i called my FM as update task in method at_save it is giving dump..

can't i call bapi or update module in update task methods or before update.

thanks alot.

babita

9 REPLIES 9
Read only

darren_bambrick2
Active Participant
0 Likes
2,452

Hi

Are you issueing a commit work statement anywhere in your code ? This may be causing it in an update badi.

Also in the bapi BAPI_BATCH_CHANGE there is a fm called CALL FUNCTION 'TRANSACTION_END, this is issuing a commit work. Set a break point and see if this is causing your issue

Read only

0 Likes
2,452

Hi,

thanks for your time for taking to reply,

i am had done my coding in before_update method only but if i call the bapi_batch_change it is giving dump directly when i save the process order.

so i created a FM as update task and coded the bapi inside the FM all these in Before_update even than i got express error message and did not update the batch...

i tried the same FM as update task even in At_save method it did not work..

at at_save method it works if i use the bapi directly but by than the orginal batch itself is not commited by sap so only the required field is updated and remaining all are blank which is not a desired solution.

we have in_update method if i use the bapi there i am getting the dump...

please suggest.

Babita

Read only

0 Likes
2,452

Call your BAPI for Batch creation in a RFC enabled fm - Starting New Task.

In case the Batch does not get created when you return to your BADI you may need to add a Wait.

Read only

0 Likes
2,452

Hi Debashri

Its a 4 year old thread

Nabheet

Read only

0 Likes
2,452

Yes I know i thought in case someone needs it,

I have a requirement - in COR1 when the Process ORder is created i want to create a Batch with the same number and assign it to the Process Order,

I am looking for a BADI or Exit for this requirement which triggers after the Process Order number is generated and where I can update the batch  number.

The WORKORDER_UPDATE badi does not allow me to change the interface tables, though it would be useful.

Any ideas?

Read only

0 Likes
2,452

Why dont you make a TRFC call in workorder_upadte which will run and update process order after it has been saved..? What is the issue you are facing in this cases.

Normally when a process order is released then batch creation is triggered via configuration and recently only i worked on a similar requirement we have so many exits. Just put a break point on call custom function you will get ther idea

Nabheet

Read only

0 Likes
2,452

Hi Debashri.

Could you solve this problem?

I'm having the same problem when I try to call the BAPI BAPI_PR_CREATE inside the BADI WORKORDER_UPDATE in method BEFORE_UPDATE.

Regards

Felipe Yansen

Read only

0 Likes
2,452

Create an RFC enabled function module, inside this call BAPI_PR_CREATE, exporting whatever you need.

Call this RFC inside BEFORE_UPDATE - with the addition STARTING NEW TASK.

So while the processing continues - the Batch will be updated.

If you need to get back a confirmation to complete your processing you can export and import some flag/details using the memory id. Use database memory.

In my case I needed to create and assign a Batch to the Process Order, with the same number as the PO number. I used an implicit enhancement inside CO_BT_ORDER_POST.

This was the only place in the processing where the newly created PO number was available.

I needed this PO number to create and assign a batch with the same number.

Please let me know if you need any further information.

Regards

Debashri

Read only

former_member585060
Active Contributor
0 Likes
2,452

Hi,

Try the code in Before_Update Method, the error might be as you are already trying to save values or changes with Transaction, so system won't allow to change any other values until Commit work is done. So best change Batch value in Before_Update Method.

Regards

Bala Krishna