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

Problem : BAPI in Background Mode.

Former Member
0 Likes
2,242

Dear Experts,

I am executing two BAPI's(BAPI_SALESORDER_CHANGE and BAPI_GOODSMVT_CREATE)
in a report.My problem is for first material both the BAPI's are running fine but for the second material salesorder_change

BAPI is executed but for goodsmvt_create BAPI its showing an error that material is locked by certain user, which is not true.As I run the same in debugger I donot encounter any of this Problems.

Please Help,

Reagrds

SUHAS.

7 REPLIES 7
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,402

Hi Suhas

Please share your sample code for the same

Nabheet

Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
1,402

Hi Suhas,

While update the material tables using BAPI_SALESORDER_CHANGE, material will be locked and it will be released after some times.

You can use wait up to <number> seconds.

It will resolve your issue.

Arivazhagan S

Read only

Former Member
0 Likes
1,402

Use BAPI_TRANSACTION_COMMIT after BAPI_SALESORDER_CHANGE.

Regards

Vivek

Read only

former_member187651
Active Participant
0 Likes
1,402

Hello Suhas,

You can try with calling BAPI: BAPI_TRANSACTION_COMMIT after execution of (BAPI_SALESORDER_CHANGE and BAPI_GOODSMVT_CREATE).

Sample code:

IF wa-type NA 'EA' OR wa-type NA 'E'.


    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' DESTINATION xyz
     EXPORTING
       WAIT          = 'X'
*    IMPORTING
*      RETURN        =


ENDIF.              .

Check the error status of your BAPI and if no error then call commit BAPI to commit your work.

I think it may solve your problem.

Regards,

Chandan

Read only

0 Likes
1,402

Hi Suhas,

Pass WAIT as 'X' to 'BAPI_TRANSACTION_COMMIT' which should solve the problem. If you still encounter the same issue, you can choose to introduce some delay manually as below before calling BAPI_GOODSMVT_CREATE.

WAIT UP TO 2 SECONDS.  " System waits for specified time units so that the locks are released

Regards,

Prashanth

Read only

Former Member
0 Likes
1,402

Dear Suhas,

Use Call Function 'BAPI_TRANSACTION_COMMIT'. after "BAPI_SALESORDER_CHANGE".


then use WAIT UP TO 3 SECONDS.


then use Call Function 'BAPI_GOODSMVT_CREATE'.


This will resolve your problem.


Regards,

NG.


Read only

Former Member
0 Likes
1,402

HI Suhas,

                    After passing data in BDC  code using work area or structure please clear work area & refresh internal table ....