cancel
Showing results for 
Search instead for 
Did you mean: 

Call BAPI from IDM

plaban_sahoo6
Contributor
0 Kudos
561

Hi All,

I want to call the program RSUSR003, which is also a transaction in itself, from SAP. So, i believe i have to use a custom BAPI, as no single BAPI exists for that program or is unclear to me. The ABAPer advised to have a custom BAPI.

So, i wan to know, how to call a BAPI. I will browse through many more threads in this community, to find the correct answer. But no luck so far. The below link is invalid.

http://scn.sap.com/community/netweaver-idm/blog/2012/06/12/accessing-a-abap-database-table-from-idm

BR,

Plaban

View Entire Topic

Hi Plaban,

I use the following script to call a custom BAPI. In our case Z_GENERATE_BP_FROM_SAPUSER.


Kind regards,

Zoltan

function CallBAPI(Par) {
    var mskeyvalue = Par.get("MSKEYVALUE");
    importClass(Packages.com.sap.idm.ic.sap.jco.JCo3Proxy);
    importClass(Packages.java.util.Properties);
    importClass(java.util.HashMap);


    var repName = uGetRepositoryID();
    var mConnection;
    var jcoProperties = new Properties();


    jcoProperties.put("jco.client.ashost", uGetConstant("rep.JCO_CLIENT_ASHOST"));
    jcoProperties.put("jco.client.sysnr", uGetConstant("rep.JCO_CLIENT_SYSNR"));
    jcoProperties.put("jco.client.user", uGetConstant("rep.JCO_CLIENT_USER"));
    jcoProperties.put("jco.client.client", uGetConstant("rep.JCO_CLIENT_CLIENT"));
    jcoProperties.put("jco.client.passwd", uGetConstant("rep.JCO_CLIENT_PASSWD"));
    jcoProperties.put("jco.client.lang", uGetConstant("rep.JCO_CLIENT_LANG"));
    jcoProperties.put("jco.client.group", uGetConstant("rep.JCO_CLIENT_GROUP"));
    jcoProperties.put("jco.client.gwhost", uGetConstant("rep.JCO_CLIENT_GWHOST"));
    jcoProperties.put("jco.client.gwserv", uGetConstant("rep.JCO_CLIENT_GWSERV"));
    jcoProperties.put("jco.client.mshost", uGetConstant("rep.JCO_CLIENT_MSHOST"));
    jcoProperties.put("jco.client.r3name", uGetConstant("rep.JCO_CLIENT_R3NAME"));
    jcoProperties.put("jco.client.snc_lib", uGetConstant("rep.JCO_CLIENT_SNC_LIB"));
    jcoProperties.put("jco.client.snc_mode", uGetConstant("rep.JCO_CLIENT_SNC_MODE"));
    jcoProperties.put("jco.client.snc_myname", uGetConstant("rep.JCO_CLIENT_SNC_MYNAME"));
    jcoProperties.put("jco.client.snc_partnername", uGetConstant("rep.JCO_CLIENT_SNC_PARTNERNAME"));
    jcoProperties.put("jco.client.snc_qop", uGetConstant("rep.JCO_CLIENT_SNC_QOP"));


    try {
        mConnection = JCo3Proxy.createInstance();
        var Output = mConnection.logonSapi(jcoProperties, repName);


        var inputParams = new HashMap();
        inputParams.put("Z_USER_ID", mskeyvalue.toUpperCase());


        var bapiRet = mConnection.runFunction("Z_GENERATE_BP_FROM_SAPUSER", inputParams);
     } catch (e) {
        uErrMsg(2, "Error: " + e);
    }
}