cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HR updating a infotype from a badi

Former Member
0 Kudos

Hi,

My requirement here is to create a badi that will calculate the guideline value and also update the infotype 0666 with the guideline value. I have created the badi and have used HR_infotype_operations fm to update the infotype 0666. But the problem is this badi gets triggered when calculating the guideline value while creating a new infotype 0759 record for the given effective date.

What happens is for the same personnel number when determining the guideline value the guideline value should be stored in infotype 0666 as well as infotype 0759 record should be created.Both the 0759 as well as 0666 record does not get created..My code is given below.I already tried removing the bapi_employee_enque and deque thus not locking the employee while creating the record.But still its not working. Infotype 0666 updation part:

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = w_p0666-pernr.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = w_p0666-infty

NUMBER = w_p0666-pernr

SUBTYPE = w_p0666-subty

OBJECTID = w_p0666-objps

LOCKINDICATOR = w_p0666-sprps

VALIDITYEND = w_p0666-endda

VALIDITYBEGIN = w_p0666-begda

RECORDNUMBER = w_p0666-seqnr

RECORD = w_p0666

OPERATION = v_operation

IMPORTING

RETURN = w_return_struc.

if sy-subrc ne 0.

v_errcd = '11'.

else.

bp_wat = 'X'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = bp_wat

IMPORTING

RETURN = v_ret.

CALL FUNCTION 'HR_INITIALIZE_BUFFER'.

  • EXPORTING

  • TCLAS = 'A'

  • PERNR = 00000000 .

CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.

endif.

call function 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = w_p0666-pernr.

endif. "v_errcd

What happens is the 0666 record gets created and its stored in the temporary buffer. But its not getting saved in the table pa0666.

How to do this.

Accepted Solutions (0)

Answers (1)

Answers (1)

suresh_datti
Active Contributor
0 Kudos

separate the two updates.. ie put the 666 stuff in a Report program & SUBMIT that report from the BAdI.. this will initiate a separate workprocess & hopefully update the database..

~Suresh

Former Member
0 Kudos

Thanks man. It works.