Hi,
Am using the following code to insert records into InfoType P0001 , but its not creating a new record Any suggestion or Examples on this Please ...
***********************************************************************************************************************
check the program Z_DYNAMIC_ACTIONS_01.
Use 'BAPI_EMPLOYEE_ENQUEUE' to lock the employee before updating
DATA: l_bapireturn LIKE bapireturn1.
DATA: bapipakey_tab LIKE bapipakey OCCURS 0 WITH HEADER LINE.
data: l_p0001 like p0001.
parameters: p_pernr like p0001-pernr default '090000002'.
start-of-selection.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = p_pernr
IMPORTING
return = l_bapireturn.
IF l_bapireturn-id NE space.
WRITE: / l_p0001-pernr, 'Enqueue failed'.
exit.
ENDIF.
.
l_p0001-barea = '7A'.
l_p0001-subty = 'RRSP'.
l_p0001-objps = 'RRSP'.
l_p0001-endda = '20000101'.
l_p0001-enrty = 'M'.
l_p0001-perio = '4'.
data : z0001 like p0001.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0001'
subty = 'RRSP'
number = p_pernr
record = l_p0001
validitybegin = '20090420'
validityend = '99991212'
operation = 'COP'
record = z0001
dialog_mode = '0' "Use default
nocommit = '1' "Use default
IMPORTING
return = l_bapireturn
key = bapipakey_tab.
IF l_bapireturn-id NE space.
WRITE: / p_pernr,
20 'Create was unsuccessful',
l_bapireturn-id,
l_bapireturn-message+0(40).
ELSE.
WRITE: / p_pernr,
20 'Create was successful',
l_bapireturn-id,
l_bapireturn-message+0(40).
ENDIF.
Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = l_p0001-pernr
IMPORTING
return = l_bapireturn.
Thanks,
Kumar.
Edited by: Julius Bussche on Apr 21, 2009 3:10 PM
Please use meaningfull subject titles