Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to Add data in HR infotype 2011 through ABAP

Hi All,

Can any one please give me an idea about how to insert time record in Infotype 2011 through ABAP. I cannot use the front end recording (SHDB) as it locks the person's master data. I need to Add the record through ABAP Query. I have inserted record in Table TEven and it works fine but then there is a conflict of sequence number field and system does not allow to change the data in infotype 2011 and gives error message.

Thanks

Tags:
Former Member
Former Member replied

Hi sohaib,

1. this is the full coding.

2. just copy paste in new program.

3. U can change the infotype,pernr and other fields as per the requirement.

4.

Report abc.



*----------------- Data
DATA : P0015 LIKE P0015.
DATA : RETURN LIKE BAPIRETURN1.
DATA : KEY LIKE BAPIPAKEY.
DATA : RETURNE LIKE BAPIRETURN1 .

*------------- Values (Change as per Requirement)

P0015-PERNR = '1'.
P0015-BEGDA = '2061101'.
P0015-ENDDA = '2061101'.
P0015-LGART = '3075'.
P0015-PREAS = '01'.
P0015-WAERS = 'INR'.
P0015-BETRG = '2500'.


*----- First Enqu

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = p0015-pernr
IMPORTING
RETURN = RETURNE.


*------------- Update

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0015'
NUMBER = P0015-PERNR
SUBTYPE = P0015-SUBTY
OBJECTID = P0015-OBJPS
LOCKINDICATOR = P0015-SPRPS
VALIDITYEND = P0015-ENDDA
VALIDITYBEGIN = P0015-BEGDA
RECORDNUMBER = P0015-SEQNR
RECORD = P0015
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
IMPORTING
RETURN = RETURN
KEY = KEY.

IF RETURN IS NOT INITIAL.
WRITE :/ 'Error Occurred'.
ENDIF.

*--------- Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = P0015-PERNR
.

regards,

amit m.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question