09-10-2008 3:44 PM
How do you update infotype 168 using HR_INFOTYPE_OPERATION?
I am trying to update a IT168 record with Begda 01/01/2008 and ENDDA 02/06/2008.
Should I use the HR_INFOTYPE_OPERATION twice to make an update to a record?
I tried the following code, but got an error saying "EPG 009No data stored for 0168 in the selected period" in the Return value. Please let me know whether my parameters are correct?
DATA: V_PA0168 LIKE BAPIRETURN1 .
DATA : S_P0168 TYPE P0168.
S_P0168-BEGDA = '20080101'.
S_P0168-ENDDA = '20080206'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0168'
NUMBER = '9000'
SUBTYPE = 'SLIF'
OBJECTID = S_P0168-OBJPS
LOCKINDICATOR = S_P0168-SPRPS
VALIDITYEND = S_P0168-ENDDA
VALIDITYBEGIN = S_P0168-BEGDA
RECORDNUMBER = S_P0168-SEQNR
RECORD = S_P0168
OPERATION = 'MOD'
TCLAS = 'B'
DIALOG_MODE = '0'
NOCOMMIT =
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
RETURN = V_PA0168
KEY =
.
Thanks.
09-10-2008 6:26 PM
I did try MOD with TCLAS 'A' first and then TCLAS "B", but get "EPG 009No data stored for 0168 in the selected period" message...
Thanks.
09-10-2008 3:50 PM
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0168'
NUMBER = '9000'
SUBTYPE = 'SLIF'
OBJECTID = S_P0168-OBJPS
LOCKINDICATOR = S_P0168-SPRPS
VALIDITYEND = S_P0168-ENDDA
VALIDITYBEGIN = S_P0168-BEGDA
RECORDNUMBER = S_P0168-SEQNR
RECORD = S_P0168
OPERATION = 'MOD' " USE INS instead of MOD - as there is no data FM won't modify any data
TCLAS = 'B'
Do populate the S_P0168 with appropriate values as well.
09-10-2008 3:54 PM
Hi,
Pls Fallow this FM
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = lc_0219
number = lv_pernr
SUBTYPE = p_pa0219-SUBTY
OBJECTID = p_pa0219-OBJPS
validityend = p_pa0219-endda
validitybegin = p_pa0219-begda
record = p_pa0219
operation = lv_oper
tclas = 'A'
dialog_mode = '0'
nocommit = ''
IMPORTING
return = lstr_bapireturn
key = lstr_bapikey.
MOVE lstr_bapireturn TO return.
IF sy-subrc = 0.
ENDIf.
Thanks&Regards,
Naresh
09-10-2008 4:20 PM
Well, the idea is to UPDATE not INSERT. Anyway I tried using INS as well, and I get "APN 018Cannot determine database table of infotype 0168" message.
Thanks.
09-10-2008 4:27 PM
here is an example from, my system to create IT0001 record.
DATA: i0001 LIKE p0001 OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapireturn1,
key LIKE bapipakey.
i0001-bukrs = '11XX'.
i0001-werks = '1107'.
i0001-kostl = 'DUMMY_CSKS'.
i0001-plans = '99999999'.
i0001-persg = '1'.
i0001-persk = '02'.
i0001-btrtl = 'OFXX'.
i0001-abkrs = 'XX'.
i0001-ansvh = 'Z8'.
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = '90000001'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0001'
number = '90000001'
validityend = '99991231'
validitybegin = '20080101'
record = i0001
operation = 'INS'
IMPORTING
return = return
key = key.
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = '90000001'.
09-10-2008 4:31 PM
Any examples of an UPDATE from anybody? preferably Infotype 168.
Thanks.
09-10-2008 4:39 PM
09-10-2008 6:26 PM
I did try MOD with TCLAS 'A' first and then TCLAS "B", but get "EPG 009No data stored for 0168 in the selected period" message...
Thanks.
09-10-2008 7:00 PM
You normally get this error if you are not sending the right data that matches the database record to be modified.
Lookup the entry you are trying to modify and see if all the fields you are pasing to the BAPI except the RECORD matches exactly.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0168'
NUMBER = '9000' "should match database record
SUBTYPE = 'SLIF' "should match database record
OBJECTID = S_P0168-OBJPS "should match database record
LOCKINDICATOR = S_P0168-SPRPS "should match database record
VALIDITYEND = S_P0168-ENDDA "should match database record
VALIDITYBEGIN = S_P0168-BEGDA "should match database record
RECORDNUMBER = S_P0168-SEQNR "should match database record
RECORD = S_P0168 "this is the only place you provide the changed data
OPERATION = 'MOD'
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT =
IMPORTING
RETURN = V_PA0168
KEY =
09-11-2008 3:33 PM