Function module BAPI_EMPLCOMM_CREATE to maintain the SAP HR communication infotype 0105
The BAPI_EMPLCOMM_CREATE function module is used for the Maintenance of the HR communication infotype 0105. So if you add a new
entry it will automatically delimit the previous entry.
Function Module parameters
employeenumber - Emplyee number you want to update
subtype - Subtype you want to update in table pa0105
validitybegin - Start date of new record. Fm will use previous day (validitybegin - 1) to delimit existing record
validityend - End date of new record
communicationid - Value of new record to be added to table pa0105
return - Return values
Other details
In-order to execute this function module you also need to have locked the user using BAPI_EMPLOYEE_ENQUEUE, also
remember to unlock them after processing using BAPI_EMPLOYEE_DEQUEUE.
Example coding for adding a new entry to info type 0105 with subtype value of '0001'
* return data
DATA: BEGIN OF 0105_return OCCURS 0.
INCLUDE STRUCTURE bapiret1.
DATA: END OF 0105_return.
data: ld_value type ad_smtpadr,
ld_pernr type pernr-pernr,
ld_date type datum.
ld_value = 'NEW VALUE'.
ld_pernr = '111111'. "enter pernr value here
ld_date = sy-datum. "start date
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = ld_pernr.
CALL FUNCTION 'BAPI_EMPLCOMM_CREATE'
EXPORTING
employeenumber = ld_pernr
subtype = '0001'
validitybegin = ld_date
validityend = '99991231'
communicationid = ld_value
IMPORTING
return = 0105_return.
read table 0105_return with key type = 'E'.
if sy-subrc ne 0.
write:/ 'Infotype 0105 updated to new Username'.
endif.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = ld_pernr.
Also see Copy SAP user ABAP program for another example of how to use this function module