Thursday, 10 October 2013

How to Update an infotype

Data : p0015 like p0015.

Data: ls_return TYPE bapireturn1,
           ls_pskey like pskey.

Pass the values into ls_pskey & p0015.

This FM helps to clear buffer. Use of this FM will be know only during mass updation.

CALL FUNCTION HR_INITIALIZE_BUFFER.

CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.

Lock the employee!
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
  EXPORTING
    number = ls_pskey-pernr.
Perform the operation!
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    infty                  = ls_pskey-infty
    number                 = ls_pskey-pernr
    subtype                = ls_pskey-subty
    validityend            = ls_pskey-endda
    validitybegin          = ls_pskey-begda
    record                 = p0015
    operation              = 'INS'
    dialog_mode            = '0'
  IMPORTING
    return                 = ls_return.

IF NOT ls_return IS INITIAL AND
   ls_return-type EQ 'E'.
  MESSAGE e000(38) WITH ls_return-message.
ENDIF.

Check the parameter operation in the  above function module. its data element is ACTIO.
 In ACTIO we can find some value ranges... like INS, MOD, DEL, INSS, LIS9, COP...

Next you can check the Dialog Mode too..

"unlock the EE
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
  EXPORTING
    number = ls_pskey-pernr.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.