Hi,
Can this function module be used to insert a record to a customized infotype. If not, which is the best method to insert a record to a customized infotype.
Please find below the code .
This code is running for a long time and going for short dump.
DATA: l_bapireturn LIKE bapireturn1.
DATA: bapipakey_tab LIKE bapipakey OCCURS 0 WITH HEADER LINE.
DATA: l_p0169 LIKE p9007.
PARAMETERS: p_pernr LIKE p9007-pernr DEFAULT '00900014'.
START-OF-SELECTION.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = p_pernr
IMPORTING
return = l_bapireturn.
IF l_bapireturn-id NE space.
WRITE: / l_p0169-pernr, 'Enqueue failed'.
EXIT.
ENDIF.
*-- Suported operations:
*-- change (operation = 'MOD')
*-- Create (operation = 'INS')
*-- DELETE (operation = 'DEL')
*-- CREATESUCCESSOR (operation = 'COP')
.
l_p0169-mandt = sy-mandt.
l_p0169-pernr = p_pernr.
l_p0169-begda = '20021001'.
l_p0169-endda = '99991231'.
l_p0169-
l_p0169-
l_p0169-zz_sec_costcent = '0000100002'.
l_p0169-zz_strt_seccostc = '24.09.2008'.
l_p0169-zz_end_seccostc = '31.12.9999'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '9007'
subty = ''
number = p_pernr
recordnumber = '024'
record = l_p0169
validitybegin = '20021001'
validityend = '99991231'
operation = 'INS'
dialog_mode = '1' "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_p0169-pernr
IMPORTING
return = l_bapireturn.