2007 Dec 28 5:40 AM
Hi all .
I am using the function module 'HR_INFOTYPE_OPERATION
to update an infotype. Its working fine but suppose if some other user has already opend the employee for which the record is being updated - or the employee is locked, the FM do not returns any error message in return table. Please let me know how to trap the errors in this FM.
Also when I check the value of Sy-subrc after this fm runs, every time the value is 0. Please suggest.
Thanks
Ribhu
Hi all .
I am using the function module 'HR_INFOTYPE_OPERATION
to update an infotype. Its working fine but suppose if some other user has already opend the employee for which the record is being updated - or the employee is locked, the FM do not returns any error message in return table. Please let me know how to trap the errors in this FM.
Also when I check the value of Sy-subrc after this fm runs, every time the value is 0. Please suggest.
Thanks
Ribhu
2007 Dec 28 5:50 AM
hi
i dont know much about this function module but what i can see is that whenever you are updating it it must be updating some database table.
one thing you can do is to lock the table first then update the entries.
2007 Dec 28 5:53 AM
Looks like there are no additioanl exceptions handled in the FM apart from the ones in the transaction.
This function module enables you to maintain master data for employees and applicants. You can transfer one data record.
All validation checks take place that would take place in the individual maintenance screens in the dialog. If necessary, the module returns an error message. The error messages are the same as the error messages in the dialog, that is, the individual maintenance screen error messages are transferred rather than interpreted by this module.
May be you shud try to transfer the data into the system using the dialog transaction.
Vinodh Balakrishnan
2007 Dec 28 6:03 AM
Hi,
I came across with this last few days.
Correct solution is that using Function modules.
Steps:
1.Call FM 'BAPI_APPRAISAL_ENQUE' before doing the Infotype operation .
2. Call FM 'HR_INFOTYPE_OPERTAION'.
3.Call FM 'BAPI_APPRAISAL_ENQUE' after doing the operation.
using bapi return value we will handle the errors like
the pernr is alreay locked by xyz user
no of succesful records
no of failed records
If you need program which I have done , make a reply.
Hope this will help you.
Thanks,
Anil
2007 Dec 28 7:11 AM
Hi,
I came across with this last few days.
Correct solution is that using Function modules.
Steps:
1.Call FM 'BAPI_APPRAISAL_ENQUE' before doing the Infotype operation .
2. Call FM 'HR_INFOTYPE_OPERTAION'.
3.Call FM 'BAPI_APPRAISAL_DEQUE' after doing the operation.
using bapi return value we will handle the errors like
the pernr is alreay locked by xyz user
no of succesful records
no of failed records
If you need program which I have done , make a reply.
Hope this will help you.
Thanks,
Anil
2011 Jan 28 9:31 AM
Hi Anil,
I am using the same function modules to update the hr infortypes, but i can manager to capture the error to display to users.
Appreciate if you can show us your sample code for reference?
2007 Dec 28 6:11 AM
Try this logic
data: RETURN LIKE BAPIRETURN1 occurs 0 with header line.
call function 'HR_EMPLOYEE_ENQUEUE'
exporting
number = wa_zpmc-zpernr
importing
return = return.
if return-type = 'E'.
exit.
else.
call function 'HR_INFOTYPE_OPERATION'.
call function 'HR_EMPLOYEE_DEQUEUE'
exporting
number = wa_zpmc-zpernr.
endif.
if usefull reward points helpful.....
2007 Dec 28 9:14 AM
Hi,
I am using employee enque before hr_infotype_operation
below is the code.
However my problem is still unresolved. when the employee is locked in one session and in other i am using hr_infotype operation, after HR_EMPLOYEE_ENQUEUE, subrc is still 0 only. Please suggest
REPORT ZBDC_0008.
data: begin of p0008 occurs 0.
include structure p0008.
Data: end of p0008.
data begin of return occurs 0.
include structure BAPIRETURN1.
data end of return.
data key like BAPIPAKEY.
P0008-PERNR = '00009600'.
P0008-INFTY = '0008'.
*P0008-SUBTY = '0'.
P0008-ENDDA = '99991231'.
P0008-BEGDA = '20070301'.
*P0008-TRFAR = 'SL'.
*P0008-TRFGB = '01'.
*P0008-TRFGR = 'DIRIT01'.
*P0008-TRFST = '01'.
*P0008-BSGRD = '100'.
*P0008-DIVGV = '86.67'.
*P0008-LGA01 = '1005'.
P0008-ANCUR = 'USD'.
p0008-BET01 = '1022'.
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = p0008-pernr.
wait UP TO 10 seconds.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0008'
NUMBER = P0008-PERNR
SUBTYPE =
OBJECTID =
LOCKINDICATOR = ''
VALIDITYEND = P0008-ENDDA
VALIDITYBEGIN = P0008-BEGDA
RECORDNUMBER =
RECORD = P0008
OPERATION = 'COP'
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT =
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
RETURN = return.
KEY = key.
.
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = p0008-pernr.
if sy-subrc = 0.
write 'success'.
endif.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |