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

BDC using HR_INFOTYPE_OPERATION getting error: The requested object is locked by your own transaction

sivab4u
Active Participant
0 Likes
1,914

Hi friends,

I am trying to do BDC for 0008 infotype using hr_infotype_operations. i am getting error return parameter of hr_infotype_operations as : The requested object is locked by your own transaction.

Please check my code as below:

REPORT ZHR_0008_UPLOAD.
types: BEGIN OF ty_0008,
         pernr TYPE PERSNO,
         ENDDA TYPE char10,
         BEGDA TYPE char10,
         TRFAR TYPE TRFAR,
         TRFGB TYPE TRFGB,
         TRFGR TYPE TRFGR,
         LGA01 TYPE LGART,
         BET01 TYPE char13,
         ANZ01 TYPE char7,
         LGA02 TYPE LGART,
         BET02 TYPE char13,
         LGA03 TYPE LGART,
         BET03 TYPE char13,
         LGA04 TYPE LGART,
         BET04 TYPE char13,
         LGA05 TYPE LGART,
         BET05 TYPE char13,
         LGA06 TYPE LGART,
         BET06 TYPE char13,
         LGA07 TYPE LGART,
         BET07 TYPE char13,
         ANZ07 TYPE ANZHL,
   END OF ty_0008.

data: it_0008 TYPE STANDARD TABLE OF ty_0008,
       wa_0008 TYPE ty_0008,
       wa1_0008 TYPE p0008.
data:   it_raw        type truxs_t_text_data.
data:   p_path        type rlgrap-filename.
data:   l_return      TYPE BAPIRETURN1.
data:   l_return1      TYPE BAPIRETURN1.
PARAMETERS: p_file TYPE IBIPPARMS-PATH.

at SELECTION-SCREEN on VALUE-REQUEST FOR p_file.
   call function 'F4_FILENAME'
*   EXPORTING
*     PROGRAM_NAME        = SYST-CPROG
*     DYNPRO_NUMBER       = SYST-DYNNR
*     FIELD_NAME          = ' '
    IMPORTING
      FILE_NAME           = p_file
             .
   p_path = p_file.
   call function 'TEXT_CONVERT_XLS_TO_SAP'
     exporting
      I_FIELD_SEPERATOR          = 'X'
      I_LINE_HEADER              = 'X'
       i_tab_raw_data             = it_raw
       i_filename                 = p_path
     tables
       i_tab_converted_data       = it_0008
*   EXCEPTIONS
*     CONVERSION_FAILED          = 1
*     OTHERS                     = 2
             .

   LOOP at it_0008 INTO wa_0008.
     call function 'CONVERSION_EXIT_DATEX_INPUT'
       exporting
         input         = wa_0008-begda
      IMPORTING
        OUTPUT        = wa1_0008-begda
               .
     call function 'CONVERSION_EXIT_DATEX_INPUT'
       exporting
         input         = wa_0008-ENDDA
      IMPORTING
        OUTPUT        = wa1_0008-ENDDA
               .
     call function 'BAPI_EMPLOYEE_ENQUEUE'
       exporting
         number        = wa_0008-pernr
      IMPORTING
        RETURN        = l_return1
               .
*    BREAK-POINT.
*if l_return-type = 'E'.
*  BREAK-POINT.
*  ENDIF.
     wa1_0008-pernr = wa_0008-pernr.
     wa1_0008-infty = '0008'.
     wa1_0008-trfar = wa_0008-TRFAR.
     wa1_0008-TRFGB = wa_0008-trfgb.
     wa1_0008-trfgr = wa_0008-trfgr.
     wa1_0008-LGA01 = wa_0008-lga01.
     wa1_0008-BET01 = wa_0008-bet01.
     wa1_0008-ANZ01 = wa_0008-anz01.
     wa1_0008-LGA02 = wa_0008-lga02.
     wa1_0008-BET02 = wa_0008-bet02.
     wa1_0008-LGA03 = wa_0008-lga03.
     wa1_0008-BET03 = wa_0008-bet03.
     wa1_0008-LGA04 = wa_0008-LGA04.
     wa1_0008-BET04 = wa_0008-BET04.
     wa1_0008-LGA05 = wa_0008-LGA05.
     wa1_0008-BET05 = wa_0008-BET05.
     wa1_0008-LGA06 = wa_0008-LGA06.
     wa1_0008-BET06 = wa_0008-BET06.
     wa1_0008-LGA07 = wa_0008-LGA07.
     wa1_0008-BET07 = wa_0008-BET07.
     wa1_0008-ANZ07 = wa_0008-ANZ07.
     BREAK-POINT.
     call function 'HR_INFOTYPE_OPERATION'
       exporting
         infty                  = wa1_0008-infty
         number                 = wa1_0008-pernr
*       SUBTYPE                =
*       OBJECTID               =
*       LOCKINDICATOR          =
        VALIDITYEND            = wa1_0008-endda
        VALIDITYBEGIN          = wa1_0008-begda
*       RECORDNUMBER           =
         record                 = wa1_0008
         operation              = 'INS'
        TCLAS                  = 'A'
        DIALOG_MODE            = '02'
*       NOCOMMIT               =
*       VIEW_IDENTIFIER        =
*       SECONDARY_RECORD       =
      IMPORTING
        RETURN                 = l_return
*       KEY                    =
               .
     call function 'BAPI_EMPLOYEE_DEQUEUE'
       exporting
         number        = wa_0008-pernr
*     IMPORTING
*       RETURN        =
               .


     BREAK-POINT.
     ENDLOOP.

1 ACCEPTED SOLUTION
Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,638

Hi,

Try,

Sort your internal table by pernr.

use control break statements.

AT NEW  PERNR.

     call function 'BAPI_EMPLOYEE_ENQUEUE'
       exporting
         number        = wa_0008-pernr
      IMPORTING
        RETURN        = l_return1


ENDAT.


AT END OF PERNR.

     call function 'BAPI_EMPLOYEE_DEQUEUE'
       exporting
         number        = wa_0008-pernr
*     IMPORTING
*       RETURN        =

ENDAT.



Hope it helpful,


Regards,

Venkat


12 REPLIES 12
Read only

former_member212005
Active Contributor
0 Likes
1,638

Can u try to call the below FM before calling HR_INFOTYPE_OPERATION?

CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.

Read only

0 Likes
1,638

Also...I hope that this is a test program....:)

Error handling is clearly missing in this program.

Read only

0 Likes
1,638

Hi Vineesh,

I wanted to carry on error handling once my code is working properly.

and coming to your reply i have used the the above FM but still same error.

Read only

Former Member
0 Likes
1,638

Hi,

Please try not locking the pernr and pass the locking indicator in the BAPI HR_INFOTYPE_OPERATION.

Hope this helps,

Read only

0 Likes
1,638

Hi Gaurav,

I have remove enque and deque fm's and passed an 'X' for  locking indicator in hr_infotype_operation.

then i am getting pernr is not yet locked message.

Regards,

Siva

Read only

0 Likes
1,638

Keep the lock indicator as blank and then check.

When you go inside the FM you can see one more FM HR_MAINTAIN_MASTERDATA which handles the lock indicator etc.

you need to find the combination where you lock the pernr in your program and pass lockindicator as 'X'.

I will have to build a program to check this. try without passing anything in the lockindicator and also don't lock the pernr inside your program, if it does not work try locking the pernr and pass lockindicator as X.

Hope this helps.

Read only

nishantbansal91
Active Contributor
0 Likes
1,638

Hi Siva,


Put breakpoint before and After enque function and check the SM12 simultaneously.

Thanks and Regards,

Nishant

Read only

sivab4u
Active Participant
0 Likes
1,638

Dear friends,

Thanks for your valuable replies, i hope the issue is with Dailog_Mode, if i am passing 0. then this error seems to have gone.

But now i am getting the below error: No entry in table T510 for the key 4001013E1 on 01.04.2015.


I have done some google and found out some problem with HR configurations, i have checked the same with Function people and they have told me that there is no issue from there end.

Any inputs on this guys....

Read only

0 Likes
1,638

Hi Siva,

            Please check this : http://scn.sap.com/thread/3313477

Read only

sivab4u
Active Participant
0 Likes
1,638

I have already seen this post, and checked the same with my HR Functional person he says as per the post everything seems to be fine. any inputs..

Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,639

Hi,

Try,

Sort your internal table by pernr.

use control break statements.

AT NEW  PERNR.

     call function 'BAPI_EMPLOYEE_ENQUEUE'
       exporting
         number        = wa_0008-pernr
      IMPORTING
        RETURN        = l_return1


ENDAT.


AT END OF PERNR.

     call function 'BAPI_EMPLOYEE_DEQUEUE'
       exporting
         number        = wa_0008-pernr
*     IMPORTING
*       RETURN        =

ENDAT.



Hope it helpful,


Regards,

Venkat


Read only

0 Likes
1,638

Thanks friends for all your valuable replies.

The issue is solved, the problem was with data input we are supposed to provide '00' but we are passing '0' for Pay Scale Level from excel sheet.


so from this BDC i had two error:


1. The object is locked by your own transaction.

Solution: Dailog Mode '02' for hr_infotype_operations does not support for all the infotypes. so making it '0'. resolved the issue.


2. No entry in table T510 for the key 4001013E1 on 01.04.2015.

Solution: for this two problems might be

     a. some configurations to be done from hr people.

     b. or the input data is not correct, so in my case it was incorrect data input from excel. The problem was with data input we are supposed to pass '00' but we are passing '0' for Pay Scale Level from excel sheet. so it was throwing the error.


Anyhow thank you guys for your valuable replies....