cancel
Showing results for 
Search instead for 
Did you mean: 

HR / BAPI

Former Member
0 Kudos
86

hi guru's ,

i m using BAPI 'bapi_absence_create' for updating daily leave detail , but its giving error ' Employee/applicant is not locked yet' in program as well as in BAPI when executing in se37. can anybody tell me about this error and how can i remove it and also what is the function of lock indicator in this BAPI ?

suitable ans will be rewarded .

regards nitin.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

dear nitin

the above ans shoul solve your problem.

lock indicator : this you can use to check employee is locked or not

by default it is space. the value passed to lock indicator is the value in return field when employee is locked.

reward points if helpful

former_member31961
Contributor
0 Kudos

Before calling the BAPI 'bapi_absence_create' you have lock the employee/ applicant using following BAPI's.

BAPI_EMPLOYEE_ENQUEUE for Employees, unlock after process using BAPI 'BAPI_EMPLOYEE_DEQUEUE'.

If you want to lock applicant pernr tehn use BAPI_APPLICANT_ENQUEUE.

Regards,

Shrinivas

Former Member
0 Kudos

Hi sir ,

can u plz. check my codes its not updating absense data ,

i m new in bapi.

*REPORT ZHR_BAPI

.

TYPES : BEGIN OF ITAB1 ,

PERNR(8) ,

BEGDA(10) ,

ENDDA(10),

BEGUZ(6) ,

ENDUZ(6) ,

AWART(4) ,

END OF ITAB1 .

************************************************************************

****

TYPES: BEGIN OF T_TEMP,

PERNR LIKE BAPIP2001-PERNR,

BEGDA LIKE BAPIP2001-BEGDA,

ENDDA LIKE BAPIP2001-ENDDA,

BEGUZ LIKE BAPIP2001-BEGUZ,

ENDUZ LIKE BAPIP2001-ENDUZ,

AWART LIKE BAPIP2001-AWART,

END OF T_TEMP.

DATA: IT_TEMP TYPE TABLE OF T_TEMP,

WA_TEMP TYPE T_TEMP.

DATA : ITAB TYPE STANDARD TABLE OF ITAB1 WITH HEADER LINE ,

WA_ITAB LIKE ITAB.

DATA : W_PERNR LIKE BAPIP2001-PERNR.

************************************************************************

******************

*DATA : BDCDATA TYPE STANDARD TABLE OF BDCDATA WITH HEADER LINE .

*DATA : MESSTAB TYPE STANDARD TABLE OF BDCMSGCOLL WITH HEADER LINE .

************************************************************************

*****************

DATA: BEGIN OF L_INTERN OCCURS 0.

INCLUDE STRUCTURE ALSMEX_TABLINE.

DATA: END OF L_INTERN.

DATA : L_INDEX TYPE I,

CTR TYPE I VALUE 0,

L_MSTRING(480),

S_LOCNR1(6) TYPE C.

DATA : IT_RETURN TYPE TABLE OF BAPIRETURN1 ,

WA_RETURN TYPE BAPIRETURN1.

************************************************************************

*****************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS: P_FILE LIKE RLGRAP-FILENAME

DEFAULT '' OBLIGATORY. " File Name

SELECTION-SCREEN END OF BLOCK B1.

*SELECTION-SCREEN : BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-014.

*PARAMETER : L1 RADIOBUTTON GROUP RADI DEFAULT 'X',

  • L2 RADIOBUTTON GROUP RADI .

*SELECTION-SCREEN : END OF BLOCK B4 .

************************************************************************

****************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

  • EXPORTING

  • PROGRAM_NAME = SYST-REPID

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

  • STATIC = ' '

  • MASK = ' '

CHANGING

FILE_NAME = P_FILE

  • EXCEPTIONS

  • MASK_TOO_LONG = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

----


START-OF-SELECTION.

PERFORM UPLOAD_FILE TABLES ITAB

USING P_FILE.

LOOP AT ITAB INTO WA_ITAB..

WA_TEMP-PERNR = WA_ITAB-PERNR.

WA_TEMP-BEGDA = WA_ITAB-BEGDA.

WA_TEMP-ENDDA = WA_ITAB-ENDDA.

WA_TEMP-BEGUZ = WA_ITAB-BEGUZ.

WA_TEMP-ENDUZ = WA_ITAB-ENDUZ.

WA_TEMP-AWART = WA_ITAB-AWART.

APPEND WA_TEMP TO IT_TEMP.

ENDLOOP.

LOOP AT IT_TEMP INTO WA_TEMP.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = WA_TEMP-PERNR

IMPORTING

RETURN = WA_RETURN

.

CALL FUNCTION 'BAPI_ABSENCE_CREATE' DESTINATION 'NONE'

EXPORTING

EMPLOYEENUMBER = WA_TEMP-PERNR

VALIDITYBEGIN = WA_TEMP-BEGDA

VALIDITYEND = WA_TEMP-ENDDA

START = WA_TEMP-BEGUZ

END = WA_TEMP-ENDUZ

ABSENCETYPE = WA_TEMP-AWART

  • ABSENCEHOURS =

  • NOCOMMIT =

IMPORTING

RETURN = wa_RETURN

  • EMPLOYEENUMBER = W_PERNR

  • SUBTYPE =

  • OBJECTID =

  • LOCKINDICATOR =

  • VALIDITYBEGIN =

  • VALIDITYEND =

  • RECORDNUMBER =

.

*ENDLOOP.

*IF NOT W_PERNR IS INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' DESTINATION 'NONE'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = wa_RETURN.

IF SY-SUBRC = 0.

WRITE: / 'PERSONAL NO.' , WA_TEMP-PERNR , 'SAVED' .

ENDIF.

  • ELSE.

  • WRITE : / 'PERSONEL NO. HAS ERROR ..' .

  • endif .

LOOP AT IT_RETURN INTO WA_RETURN.

WRITE: / WA_RETURN-MESSAGE.

ENDLOOP.

*ENDIF .

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

NUMBER = WA_TEMP-PERNR

IMPORTING

RETURN = WA_RETURN

.

ENDLOOP .

plz. send me updated code .

thanks in advance.

former_member31961
Contributor
0 Kudos

Hi

Your code seems to be fine, what is the error you are getting in wa_return?

May be infotype doesnt get updated due to functional/configuration issue such as 'Absence quotas not maintained' etc. In that case you need to contact your functional consultant to provide the test data/to do necessary configuration .

Regards,

Shrinivas