‎2007 Jul 30 6:56 PM
Hi All,
I have been trying to use this FM to delete infotype records but I keep getting the exception "error during Delete".
I am just trying to see what I am doing wrong. If there are multiple infotype records, can I delete all by using the start date of the first record and end date of the last record or I have to delete each record separately?
Also, can anyone give me a sample on how it can be used? Currently I am trying to use it with HRP1008.
Thanks,
~Mark
‎2007 Jul 30 9:14 PM
Hi check this code for changing ENDDA to 99991231.
data: t1008 type table of p1008 initial size 0 with header line.
parameters: p_otype type otype,
p_objid type hrobjid.
CALL FUNCTION 'RH_READ_INFTY'
EXPORTING
* AUTHORITY = 'DISP'
* WITH_STRU_AUTH = 'X'
PLVAR = '01'
OTYPE = p_otype
OBJID = p_objid
INFTY = '1008'
ISTAT = '1'
* EXTEND = 'X'
* SUBTY = ' '
* BEGDA = '19000101'
* ENDDA = '99991231'
* CONDITION = '00000'
* INFTB = '1'
* SORT = 'X'
* VIA_T777D = ' '
TABLES
innnn = t1008
* OBJECTS =
EXCEPTIONS
ALL_INFTY_WITH_SUBTY = 1
NOTHING_FOUND = 2
NO_OBJECTS = 3
WRONG_CONDITION = 4
WRONG_PARAMETERS = 5
OTHERS = 6
.
check sy-subrc eq 0.
read table t1008 index 1.
t1008-endda = '99991231'.
clear: t1008[].
append t1008.
CALL FUNCTION 'RH_INSERT_INFTY'
EXPORTING
* FCODE = 'INSE'
VTASK = 'S'
* ORDER_FLG = 'X'
* COMMIT_FLG = 'X'
* AUTHY = 'X'
* PPPAR_IMP =
* OLD_TABNR = ' '
* REPID = ' '
* FORM = ' '
* KEEP_LUPD =
* WORKF_ACTV = 'X'
TABLES
INNNN = t1008
* ILFCODE =
EXCEPTIONS
NO_AUTHORIZATION = 1
ERROR_DURING_INSERT = 2
REPID_FORM_INITIAL = 3
CORR_EXIT = 4
BEGDA_GREATER_ENDDA = 5
OTHERS = 6
.
IF SY-SUBRC = 0.
write:/ 'Done'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I tried it and it's working..
Reward if useful
Regards
Prax
‎2007 Jul 30 7:33 PM
‎2007 Jul 30 7:37 PM
Hi.. check the below code : I had used this FM and deleted the record successfully
data: t1008 type table of p1008 initial size 0 with header line.
parameters: p_otype type otype,
p_objid type hrobjid.
CALL FUNCTION 'RH_READ_INFTY'
EXPORTING
* AUTHORITY = 'DISP'
* WITH_STRU_AUTH = 'X'
PLVAR = '01'
OTYPE = p_otype
OBJID = p_objid
INFTY = '1008'
ISTAT = '1'
* EXTEND = 'X'
* SUBTY = ' '
* BEGDA = '19000101'
* ENDDA = '99991231'
* CONDITION = '00000'
* INFTB = '1'
* SORT = 'X'
* VIA_T777D = ' '
TABLES
innnn = t1008
* OBJECTS =
EXCEPTIONS
ALL_INFTY_WITH_SUBTY = 1
NOTHING_FOUND = 2
NO_OBJECTS = 3
WRONG_CONDITION = 4
WRONG_PARAMETERS = 5
OTHERS = 6
.
check sy-subrc eq 0.
CALL FUNCTION 'RH_DELETE_INFTY'
EXPORTING
* LOAD = 'X'
VTASK = 'S'
* ORDER_FLG = 'X'
* COMMIT_FLG = 'X'
* AUTHY = 'X'
* PPPAR_IMP =
* KEEP_LUPD =
* WORKF_ACTV = 'X'
TABLES
INNNN = t1008
* ILFCODE =
EXCEPTIONS
ERROR_DURING_DELETE = 1
NO_AUTHORIZATION = 2
DELETE_FIRST_RECORD = 3
CORR_EXIT = 4
OTHERS = 5
.
IF SY-SUBRC = 0.
write:/ 'Done'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Reward points if useful
regards
Prax
‎2007 Jul 30 8:39 PM
Thanks Pradeep,
So basically we cannot just use an arbitrary start and end date to delete all the records between these dates, we need to first read all the records and then delete each record.
One last thing, is it possible to take the first record and change its end date to high date using FM RH_UPDATE_INFTY? That should delete all the records in between!
Thanks,
~Mark
‎2007 Jul 30 8:47 PM
Hello Mark
In order to read infotype records perhaps my Wiki posting may be useful:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/unified%2baccess%2bto%2ball%2bhr%2binfotypes">unified Access to All HR Infotypes</a>
Regards
Uwe
‎2007 Jul 30 9:05 PM
yes mark.. in the table u should have BEGDA and ENNDA along wid OBJID and OTYPE ..
I think... PLVAR, INFTY and SEQNR are also necessary..
Regards
Prax
‎2007 Jul 30 9:08 PM
I think u should use RH_INSERT_INFTY in this case..
Read first record... change its ENDDA to 99991231 and INSERT it..
other records will get deleted automatically..
Regards
Prax
‎2007 Jul 30 9:14 PM
Hi check this code for changing ENDDA to 99991231.
data: t1008 type table of p1008 initial size 0 with header line.
parameters: p_otype type otype,
p_objid type hrobjid.
CALL FUNCTION 'RH_READ_INFTY'
EXPORTING
* AUTHORITY = 'DISP'
* WITH_STRU_AUTH = 'X'
PLVAR = '01'
OTYPE = p_otype
OBJID = p_objid
INFTY = '1008'
ISTAT = '1'
* EXTEND = 'X'
* SUBTY = ' '
* BEGDA = '19000101'
* ENDDA = '99991231'
* CONDITION = '00000'
* INFTB = '1'
* SORT = 'X'
* VIA_T777D = ' '
TABLES
innnn = t1008
* OBJECTS =
EXCEPTIONS
ALL_INFTY_WITH_SUBTY = 1
NOTHING_FOUND = 2
NO_OBJECTS = 3
WRONG_CONDITION = 4
WRONG_PARAMETERS = 5
OTHERS = 6
.
check sy-subrc eq 0.
read table t1008 index 1.
t1008-endda = '99991231'.
clear: t1008[].
append t1008.
CALL FUNCTION 'RH_INSERT_INFTY'
EXPORTING
* FCODE = 'INSE'
VTASK = 'S'
* ORDER_FLG = 'X'
* COMMIT_FLG = 'X'
* AUTHY = 'X'
* PPPAR_IMP =
* OLD_TABNR = ' '
* REPID = ' '
* FORM = ' '
* KEEP_LUPD =
* WORKF_ACTV = 'X'
TABLES
INNNN = t1008
* ILFCODE =
EXCEPTIONS
NO_AUTHORIZATION = 1
ERROR_DURING_INSERT = 2
REPID_FORM_INITIAL = 3
CORR_EXIT = 4
BEGDA_GREATER_ENDDA = 5
OTHERS = 6
.
IF SY-SUBRC = 0.
write:/ 'Done'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I tried it and it's working..
Reward if useful
Regards
Prax