Hello Gurus,
I have created a new position for Infotype HRP1000 with function RH_OBJECT_CREATE, then I relate this new position with the employee using function RH_INSERT_INFTY.
So I have what can be see in the picture attached.
thanks a lot.
DATA: li_position TYPE HRP1000-OBJID.
CALL FUNCTION 'RH_OBJECT_CREATE'
EXPORTING
LANGU = SY-LANGU
PLVAR = '01'
OTYPE = 'S'
* EXT_NUMBER = '00000000'
SHORT = 'JEFE'
STEXT = 'JEFEDES'
BEGDA = SY-DATUM
ENDDA = '99991231'
OSTAT = '1'
"VTASK = 'D'
* GUID =
* KEEP_LUPD = ' '
IMPORTING
OBJID = li_position
* EXCEPTIONS
* TEXT_REQUIRED = 1
* INVALID_OTYPE = 2
* INVALID_DATE = 3
* ERROR_DURING_INSERT = 4
* ERROR_EXT_NUMBER = 5
* UNDEFINED = 6
* OTHERS = 7
.
ls_new_p1001-otype = 'P'.
ls_new_p1001-objid = '65000083'.
ls_new_p1001-plvar = '01'.
ls_new_p1001-rsign = 'B'.
ls_new_p1001-relat = '008'.
ls_new_p1001-istat = '1'.
"ls_new_p1001-begda = sy-datum.
ls_new_p1001-endda = sy-datum - 1.
ls_new_p1001-varyf = 'S 503819 74'.
ls_new_p1001-infty = '1001'.
ls_new_p1001-sclas = 'S'.
ls_new_p1001-sobid = "li_position.
ls_new_p1001-prozt = '100'.
APPEND ls_new_p1001 TO lt_new_p1001.
CALL FUNCTION 'RH_INSERT_INFTY'
EXPORTING
vtask = 'S'
commit_flg = 'X'
TABLES
innnn = lt_new_p1001
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: / sy-subrc .
ENDIF.
*ENDIF.