Hi,
I am inserting a record in Communications Infotype when user creates a IT 0006 record. I have written code in the user exit to do the job and I am using HR_INFOTYPE_OPERATION' Insert option (INS) for that. I am doing enqueue and dequeue properly.
Now, when I try to save the new record in IT 0006, it gives me an error saying that No entry in table T591A for 0105 4.
4 is subtype of IT0006 record which is not a subtype IT0105, thats why I am getting the error. But in my code before calling the FM I am assigning the correct subtype. here is the code from my user exit:
IF innnn-infty = '0006' AND innnn-subty = '4' AND
( ipsyst-ioper = 'INS' OR ipsyst-ioper = 'MOD' ).
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = lx_0006.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = lx_0006-pernr
IMPORTING
return = wa_return.
IF NOT wa_return IS INITIAL.
WRITE:/ wa_return-message.
EXIT.
ENDIF.
lx_0105-infty = '0105'.
lx_0105-pernr = lx_0006-pernr.
lx_0105-subty = 'CELL'.
lx_0105-begda = lx_0006-begda.
lx_0105-endda = lx_0006-endda.
lx_0105-usrty = 'CELL'.
lx_0105-usrid = lx_0006-num01.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0105'
number = lx_0006-pernr
subtype = 'CELL'
validityend = lx_0006-endda
validitybegin = lx_0006-begda
record = lx_0105
operation = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT =
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
return = wa_return
key = wa_record_key.
IF wa_return-type = 'E'.
WRITE:/ wa_return-message.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = lx_0006-pernr
IMPORTING
return = wa_return.
CLEAR: lx_0006, lx_0105.
ENDIF.
Any tips ?