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 with Equipment's lock

Former Member
0 Likes
1,759

Hello everybody,

I have a programm with locked an equi for edition and finally saved it. In my developing system it works fine but in q system the bapi BAPI_EQUI_CHANGE return error "Equipment ... is already locked by user ....".

I have simplified my program to reproduce en errror:


data: lc_equnr type equnr,
      ls_return TYPE bapiret2,
      ls_generx TYPE bapi_itobx,
      ls_specx TYPE bapi_itob_eq_onlyx,
      LS_GENERAL  Type  BAPI_ITOB,
      lS_SPECIFIC Type  BAPI_ITOB_EQ_ONLY.
 
START-OF-SELECTION.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = '10000235'
    IMPORTING
      OUTPUT = lc_equnr.
 
  CALL FUNCTION 'BAPI_EQUI_GETDETAIL'
    EXPORTING
      equipment               = lc_equnr
    IMPORTING
      data_general_exp        = ls_general
      data_specific_exp       = ls_specific
*     DATA_FLEET_EXP          =
      RETURN                  = ls_return
              .
  CALL FUNCTION 'ENQUEUE_EIEQUI'
      EXPORTING
*       MODE_EQUI            = 'E'
*       MANDT                = SY-MANDT
        EQUNR                = lc_equnr
*       X_EQUNR              = ' '
*       _SCOPE               = '2'
*       _WAIT                = ' '
*       _COLLECT             = ' '
     EXCEPTIONS
       FOREIGN_LOCK         = 1
       SYSTEM_FAILURE       = 2
       OTHERS               = 3
              .
  IF sy-subrc  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
            RAISING error.
  ENDIF.
  ls_generx-descript = 'X'.
  ls_generx-maintloc = 'X'.
  ls_generx-maintplant = 'X'.
  ls_generx-start_from = 'X'.
  ls_specx-techid = 'X'.
  CALL FUNCTION 'BAPI_EQUI_CHANGE'
    EXPORTING
      equipment      = lc_equnr
      data_general   = ls_general
      data_generalx  = ls_generx
      data_specific  = ls_specific
      data_specificx = ls_specx
    IMPORTING
      return         = ls_return.

It's no difference in support package level.

Have anybody an idea what can to be the difference and what can i do to repair it?

Best regards,

Boguslaw

Hello everybody,

I have a programm with locked an equi for edition and finally saved it. In my developing system it works fine but in q system the bapi BAPI_EQUI_CHANGE return error "Equipment ... is already locked by user ....".

I have simplified my program to reproduce en errror:


data: lc_equnr type equnr,
      ls_return TYPE bapiret2,
      ls_generx TYPE bapi_itobx,
      ls_specx TYPE bapi_itob_eq_onlyx,
      LS_GENERAL  Type  BAPI_ITOB,
      lS_SPECIFIC Type  BAPI_ITOB_EQ_ONLY.
 
START-OF-SELECTION.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = '10000235'
    IMPORTING
      OUTPUT = lc_equnr.
 
  CALL FUNCTION 'BAPI_EQUI_GETDETAIL'
    EXPORTING
      equipment               = lc_equnr
    IMPORTING
      data_general_exp        = ls_general
      data_specific_exp       = ls_specific
*     DATA_FLEET_EXP          =
      RETURN                  = ls_return
              .
  CALL FUNCTION 'ENQUEUE_EIEQUI'
      EXPORTING
*       MODE_EQUI            = 'E'
*       MANDT                = SY-MANDT
        EQUNR                = lc_equnr
*       X_EQUNR              = ' '
*       _SCOPE               = '2'
*       _WAIT                = ' '
*       _COLLECT             = ' '
     EXCEPTIONS
       FOREIGN_LOCK         = 1
       SYSTEM_FAILURE       = 2
       OTHERS               = 3
              .
  IF sy-subrc  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
            RAISING error.
  ENDIF.
  ls_generx-descript = 'X'.
  ls_generx-maintloc = 'X'.
  ls_generx-maintplant = 'X'.
  ls_generx-start_from = 'X'.
  ls_specx-techid = 'X'.
  CALL FUNCTION 'BAPI_EQUI_CHANGE'
    EXPORTING
      equipment      = lc_equnr
      data_general   = ls_general
      data_generalx  = ls_generx
      data_specific  = ls_specific
      data_specificx = ls_specx
    IMPORTING
      return         = ls_return.

It's no difference in support package level.

Have anybody an idea what can to be the difference and what can i do to repair it?

Best regards,

Boguslaw

4 REPLIES 4
Read only

Former Member
0 Likes
1,084

You're trying to program around the fact that another user has the equipment open on their screen? Why do that? Are you saying that the user was not actually editing the equipment when you tried to run your program?

Read only

0 Likes
1,083

Hello,

thx. for your response. It is no onather user lock equi - i have locked exclusive equi for my user (FB enqueue_equi) and after that call the bapi. A massage said that my user lock equi.

it happens only in one system, in another it works.

Best regards

Boguslaw

Read only

Former Member
0 Likes
1,083

The BAPI tries to lock the equipment. But you do before calling the BAPI.

You do not need to use the ENQUEUE.

Read only

0 Likes
1,083

Hello Edwin,

it is a simplified version of my program. In realy program I lock an equi for edition and after edition (equi is steel locked for me) i try to save changes.

Best regards,

Boguslaw