Delete Infotype Operation

At most times we need to add or delete records from the infotypes or from any other standard tables. Requirements to perform the MOD(Modify), COP(Copy), INS(Insert) , DEL (Delete) operations can be used to manipulate the records in infotypes.

The delete operation for infotype 2003 is performed using three different function modules which is explained in detail below.

Three different function modules are used.

1. ‘HR_EMPLOYEE_ENQUEUE’

Here , we need to pass the pernr and lock the user before performing the operation.

2.  ‘HR_INFOTYPE_OPERATION’

Here, we need to pass the pernr , subtype , begin date , end date , the record in 2003 and DEL operation

3. ‘HR_EMPLOYEE_DEQUEUE’

After performing the operation we need to again unlock the user.

The detailed code snippet for deletion operation of 2003 infotype :

 Loop at it_pa2003 into wa_pa2003." where pernr = wa_pa2001-pernr.
move-corresponding wa_pa2003 to wa_p2003.
wa_final-begda = wa_p2003-begda.
wa_final-pernr = wa_p2003-pernr.
*      WA_FINAL-ST = WA_PA2001-BEGDA.
*      WA_FINAL-EN = WA_PA2001-ENDDA.
wa_p2003-infty = '2003'.

call function 'HR_EMPLOYEE_ENQUEUE'
exporting
number = wa_p2003-pernr
importing
return = bapireturn.

call function 'HR_INFOTYPE_OPERATION'
exporting
infty         = '2003'
number        = wa_p2003-pernr
subtype       = wa_p2003-subty
validityend   = wa_p2003-endda
validitybegin = wa_p2003-begda
record        = wa_p2003
operation     = 'DEL'
importing
return        = bapireturn.
call function 'HR_EMPLOYEE_DEQUEUE'
exporting
number = wa_p2003-pernr
importing
return = bapireturn.
append wa_final to it_final.
clear : wa_pa2001 , wa_final, wa_pa2003, wa_p2003.
endloop.

If there are any errors  the same will be fetched in the bapireturn. Bapireturn will hold the error messages.

Thus after this operation the particular records are modified or deleted based upon the operation performed in the infotypes and standard tables. Since these are master records , they cannot be deleted as and then . With utmost necessity only the infotype operations are to be performed.

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.