Application Development 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: 

The requested object is locked by your own transaction, Infotype

Former Member
0 Kudos

Hi, all expert
M using HR_EMPLOYEE_ENQUEUE to insert data to my custom infotype and it always give me error

"The requested object is locked by your own transaction"

Here is my code:


ALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
         EXPORTING
          number = P9006-pernr.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
   EXPORTING
     infty                  = '9006'
     number                 = P9006-pernr
    SUBTYPE                P9006-subty
    OBJECTID               P9006-OBJPS
    LOCKINDICATOR          P9006-SPRPS
    VALIDITYEND            P9006-ENDDA
    VALIDITYBEGIN          P9006-BEGDA
    RECORDNUMBER           P9006-seqnr
     record                p9006
     operation             'INS'
    TCLAS                  'A'
    DIALOG_MODE            '02'
    NOCOMMIT               ''
*   VIEW_IDENTIFIER        = '07'
*   SECONDARY_RECORD       =
  IMPORTING
    RETURN                 = w_return
    KEY                    = lo_key
           .

  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
                     EXPORTING
                       number = lo_P9006-pernr
                     IMPORTING
                       return = w_return2.

13 REPLIES 13

Former Member
0 Kudos

Hi

Go to SM12 check whether there have lock on this object, then delete it first.

regards,

Archer

0 Kudos

Actually there are no lock object.

former_member200338
Active Contributor
0 Kudos

Try commenting DIALOG_MODE.

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Vong,

Please let me know at where the above program is called, from outside program or inside some exit?

Regards

Rajkumar Narasimman

0 Kudos

i call it in a module.
My purpose is that i want to insert multiple data from the table control.

0 Kudos

Hi yong,

Kindly change the below variable in DEQUEUE as shown below.


  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

                     EXPORTING

"                       number = lo_P9006-pernr               "Comment this line

                       number = P9006-pernr

                     IMPORTING

                       return = w_return2.

Also use BAPI commit as shown below.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

   WAIT          =  'X'.


If still the problem exist, use below command, after DEQUEUE.

WAIT UPTO 1 SECONDS.

If still the problem exist, kindly try with BDC with Mode 'A' that help you to find out where the problem exist.

Regards

Rajkumar Narasimman

0 Kudos

it's still doesn't insert the data.

0 Kudos

anything found in FM HR_EMPLOYEE_ENQUEUE when you debugging?

0 Kudos

it's the same error : "The requested object is locked by your own transaction".

Former Member
0 Kudos

Hi Sophanith,

Check this link http://scn.sap.com/thread/1838454

SM12 may not list the locked object, however please check with basis team or you can try checking the table entries of CSL_EOMP as given in above link.

Pls reward points if it is helpful

former_member201275
Active Contributor
0 Kudos

Don't use HR_EMPLOYEE_ENQUEUE, try BAPI_EMPLOYEE_ENQUEUE and then check your return code before HR_INFOTYPE_OPERATION, i.e.:

.
      call function 'BAPI_EMPLOYEE_ENQUEUE'
      exporting
        number = <ls_alv>-pernr
      importing
        return = ls_return.

    if ls_return-type eq 'E'.
      move lv_icon_err to <ls_alv>-icon.
    else.
      perform HR_INFOTYPE_OPERATION

....etc......

raymond_giuseppi
Active Contributor
0 Kudos
  • Are you trying to execute this code from inside a running PAxxx transaction that has already locked the employee records ?
  • Are you managing error message at every step (lock, execute, release) ?
  • Do you alway execute a DEQUEUE, COMMIT or ROLLBACK after every call of the ENQUEUE FM.

Regards,

Raymond

Former Member
0 Kudos

Hi all,
in my case somehow "HR_INFOTYPE_OPERATION" doesn't work. Therefore, i decided to create structure just like PA008 to store my multiple data from table control.

Thanks for all the help.