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

Error After BAPI_OBJCL_CHANGE

Former Member
0 Likes
1,801

Hi Folks

I am updating some batch characteristics during Usage decision using  BAPI_OBJCL_CHANGE . then after closing the ud using QA 12 using BDC .

But when QA12 is called using BDC i am getting the error that batch is already locked.

Sometimes this error comes and sometimes not. Please Help.

5 REPLIES 5
Read only

Former Member
0 Likes
1,239

Hi,

do you call BAPI_TRANSACTION_COMMIT with WAIT option after BAPI_OBJCL_CHANGE ?

If not, please try that.

Regards,

Klaus

Read only

former_member187748
Active Contributor
0 Likes
1,239

Hi Nikhil,

can you please post the relavant code you have used in BAPI_OBJCL_CHANGE,  after this are you using any function module BAPI_TRANSACTION_COMMIT . If yes then please pass wait = 'X',

Please post your relevant code here.

Read only

Former Member
0 Likes
1,239

Hi Sanjiv

please find the code format bellow.

CALL FUNCTION 'BAPI_OBJCL_CHANGE'

     EXPORTING

       OBJECTKEY          = LS_BAPI1003_KEY-OBJECT

       OBJECTTABLE      = LS_BAPI1003_KEY-OBJECTTABLE

       CLASSNUM           = LT_ALLOCLIST-CLASSNUM

       CLASSTYPE          = LS_BAPI1003_KEY-CLASSTYPE

     TABLES

       ALLOCVALUESNUMNEW  = LT_VALUES_NUM

       ALLOCVALUESCHARNEW = LT_VALUES_CHAR

       ALLOCVALUESCURRNEW = LT_VALUES_CURR

       RETURN             = LT_RETURN.

*BREAK-POINT.

   READ TABLE LT_RETURN WITH KEY TYPE = 'E'.

   IF SY-SUBRC NE 0.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         WAIT = 'X'.

     WAIT UP TO 10 SECONDS.

     CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

       EXPORTING

         TEXT = 'Done'.

     CALL FUNCTION 'BUFFER_REFRESH_ALL'.

   ELSE.

     CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'

*                      IMPORTING

*                          RETURN        =

                                      .

Read only

0 Likes
1,239

Hi Nikhil,

please change your code as shown below and once pass some values like for objectkey = 'its value' and do it in all the fields of exporting, then please see that it is working or not

CALL FUNCTION 'BAPI_OBJCL_CHANGE'

  EXPORTING

    objectkey          = 'value'

    objecttable        = 'value'

    classnum           = 'value'

    classtype          = 'value'            

  TABLES

    allocvaluesnumnew  = table name

    allocvaluescharnew = table name

    allocvaluescurrnew = table name

    return             = table name

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  EXPORTING

    wait   = 'X'

  IMPORTING

    return = ls_bapiret2.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,239

What is your version, there were note for a similar problem in no longer maintained versions, you should nevertheless perform an OSS note search for your version with keywords like "BAPI_OBJCL_CHANGE" "lock".

Regards,

Raymond