cancel
Showing results for 
Search instead for 
Did you mean: 

Using BAPI_EMPLCOMM_CREATE with Java

former_member402721
Discoverer
0 Kudos

Hi all,

I'm new here.

Appreciate you help with the following question.

I want to use BAPI_EMPLCOMM_CREATE to link SAP UM account to SAP HR record.

I've found the the pattern for BAPI_EMPLCOMM_CREATE is:

Pattern for FM BAPI_EMPLCOMM_CREATE - BAPI EMPLCOMM CREATEAssociated Function Group: 0PBAPI0105 
Released Date: 14.04.1999
CALL FUNCTION 'BAPI_EMPLCOMM_CREATE' "Create communication
  EXPORTING
    employeenumber =            " bapip0105n-employeeno  Personnel number
    subtype =                   " bapip0105n-subtype  Subtype
    validitybegin =             " bapip0105n-validbegin  Valid from date
    validityend =               " bapip0105n-validend  Valid To Date
*   communicationid =           " bapip0105n-id  Communucations ID
*   nocommit =                  " bapi_stand-no_commit  COMMIT control at BAPI interface
  IMPORTING
    return =                    " bapireturn1   Structure for Return Code
    employeenumber =            " bapip0105n-employeeno  Personnel number
    subtype =                   " bapip0105n-subtype  Subtype
    objectid =                  " bapip0105n-objectid  Object identification
    lockindicator =             " bapip0105n-lockindic  Lock indicator for HR master data record
    validitybegin =             " bapip0105n-validbegin  Valid from date
    validityend =               " bapip0105n-validend  Valid To Date
    recordnumber =              " bapip0105n-recordnr  Number of infotype record with same key
    .  "  BAPI_EMPLCOMM_CREATE

My question is how to use that function from a java code?

I have a working example for BAPI_USER_CREATE

JCoFunction bapiUserCreate = destination.getRepository().getFunctionTemplate("BAPI_USER_CREATE").getFunction();
             
              if(bapiUserCreate != null){
               
                JCoStructure myAddress = bapiUserCreate.getImportParameterList().getStructure("ADDRESS");
                  myAddress.setValue("FIRSTNAME",firstname);
                  myAddress.setValue("LASTNAME",lastname);
                  myAddress.setValue("FULLNAME",firstname+" "+lastname);
                  myAddress.setValue("E_MAIL",email);
                  myAddress.setValue("DEPARTMENT",department);                       
                
                   bapiUserCreate.getImportParameterList().setValue("USERNAME", username);


                JCoStructure myPassword = bapiUserCreate.getImportParameterList().getStructure("PASSWORD");
                  myPassword.setValue("BAPIPWD",password);


                     bapiUserCreate.execute(destination);

Any advice how to construct a request similar to BAPI_USER_CREATE?

Thanks

Boris

Accepted Solutions (0)

Answers (0)