‎2011 Sep 08 5:44 PM
Hi
My Scenario is when an employee get hired through PA40. At the end of hiring action info type 41 get update automatically.
I am using enhancement HRPAD00_ENTRY_LEAVE to update info type 41, using the condition that when its last screen of the hiring action then update the info type 41 using below FMs
BAPI_EMPLOYEE_ENQUEUE , HR_INFOTYPE_OPERATION , BAPI_EMPLOYEE_DEQUEUE
but data doesn't get commit in data base for the both last screen of hiring action as well as for the info type 41
kindly advice
Regards
Ammad
‎2011 Sep 08 8:29 PM
Hi
Have you checked what does HR_INFOTYPE_OPERATION return? I mean, sometimes there can be issues related with the data you're actually passing to this FM and this can lead to errors. Be sure RETURN parameter is initial before trying to do anything else. Besides, check first if the employee number is already locked (you're still in the middle of the hiring process) so maybe BAPI_EMPLOYEE_ENQUEUE may return an error as well. In this case you'd need to unlock the employee, update the Infotype and lock it again.
Regards
‎2011 Sep 08 8:43 PM
i have done this it doesn't return error, can i use INSERT statement to directly insert data into info type 41 . what do u recommend ?
Regards
Ammad
‎2011 Sep 08 8:47 PM
You could, however is not recommended as you're bypasing all the security restrictions, and I'd only do it as a last resource.
What I'd try to do is instead of using HR_INFOTYPE_OPERATION is a Batch Input (BDC) against PA30 and insert the record using mode 'N' (The user won't see anything of this)
‎2011 Sep 08 8:49 PM
‎2011 Sep 08 8:51 PM
You'll have to unlock it first using either DEQUE_EPPRELE or DEQUE_ALL
‎2011 Sep 08 9:23 PM
code is as follows by not working
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = w_0041-pernr
IMPORTING
RETURN = return
.
if return is initial .
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0041'
NUMBER = w_0041-pernr
SUBTYPE =
OBJECTID =
LOCKINDICATOR =
VALIDITYEND = w_0041-BEGDA
VALIDITYBEGIN = w_0041-ENDDA
RECORDNUMBER =
RECORD = w_0041
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT =
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
RETURN = return
KEY = key
.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = w_0041-pernr
IMPORTING
RETURN = return
.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = w_0041-pernr
IMPORTING
RETURN = return
.
‎2011 Sep 08 10:04 PM
Hi.
Another option would be to place your code in the IN_UPDATE method of the BADI HRPAD00INFTY
When the last infotype (screen) of the hiring process is saved, this event will be fired and you can place your logic there.
Anyway I'd keep in mind the PA30 approach as well in case HR_INFOTYPE_OPERATION won't work.
Best of luck.