on 12-22-2013 12:13 PM
Hello,
We use a IdM 7.2 and CUA scenario. New I have the challenge to modify the HCM infotyp 105 subtyp 001, when I will add a new member in my Idm 7.2. My ECC 6.0 EHP 6 is member of the CUA, so I have only defined the CUA in my IdM.
My developer made me a Bapi to change the infotyp. So my question:
How could I call my own Z-BAPI in my Idm? I think, I have to use a custom pass with "pass typ" ToSAP, haven't I?
Best regards,
Hans
I found the note 1883326 - SAP NW ID Mgmt RDS - Connection check issue (SP7 or higher). The scripts describe a connection example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hans-Hermann,
I needed to port an old script that used JCo2 to JCo3, the troublesome bit in creating the connection from JavaScript were the abstract Java-classes and interfaces in JCo3. As a friend helped me with my solution I didn't want to post those lines of code in here out of professional courtesy (after all he was paid for writing his scripts so who am I to publish them for free) to him.
Looks like the hard part is now wrapped by SAP to the JCoProxy-class and the two lines below, making rest of the calls around as easy as they were in JCo2.
mConnection = JCoProxy.createInstance();
var Output = mConnection.logonSapi(jcoProperties, repName);
The remaining bit you need to figure out is handling the actual call and that depends on the interface of your BAPI, what tables or parameters are passed to the BAPI and what is returned. You must dynamically create the needed structures for the BAPI parameters in your code and fill them and after the call handle what was returned, data or an error.
If you copy the two scripts from Service Market Place for handling the connection and got them running then feel free to use the snippets from my script below that I ported from JCo2 to JCo3 if they help.
The BAPI I am using is custom one that takes the username as a string parameter and returns n-number of user attributes as string parameters plus the user's SU01-parameters in table.
//--
// Get the function template
//--
var func = mRepository.getFunctionTemplate("_BAPI_NAME_HERE_").getFunction();
var importParams = func.getImportParameterList();
var tableParams = func.getTableParameterList();
//--
// Set the input parameters and run the BAPI
//--
importParams.setValue(userMskeyValue, "USERNAME");
mConnection.execute(func);
//---
// Get the user attributes returned from ECC and store for both new and template user.
//---
var xp = func.getExportParameterList();
//---
// Language
//---
var mxLanguage = xp.getString("LANGU");
...
...
//---
// Get the user's ABAP-parameters from the return structure and concanate to
// single string to be written into multivalue-attribute.
//---
var paramTable = tableParams.getValue("PARAMETER");
var params = new java.lang.StringBuffer();
if (paramTable.getNumRows() > 0) {
do {
params.append(paramTable.getString("PARID"));
params.append("=");
params.append(paramTable.getString("PARVA"));
params.append("|");
} while (paramTable.nextRow());
}
Dear Tero,
Thank you very match for your input. I can establish a connection mConnection, but I get the error:
"Error occured in JCo3Proxy.logonSapi(String):
com.sap.conn.jco.JCoException: (101) JCO_ERROR_CONFIGURATION: Initialization of destination IDM_DEST_1389342936688 failed"
I think, the message came from the line
var mRepository = new JCO.Repository("IDMgmt", mConnection);
Why I have to unterstand the parameter "IDMgmt"? Should it be my repository?
Best regards,
Hans
Ok, I find my error - I used the wrong Pass ("FTo Custom" and not "To Generic"). But I have the issue, that object JCO isn't defined.
The output from
Output = mConnection.logonSapi(jcoProperties, repName) is "true" but the command
var mRepository = new JCO.Repository("IDMgmt", mConnection); create the exception
Running pass failed with unhandled exception
undefined: "JCO" is not defined. (call_rfcBAPI; line 1)
So, what is wrong in my script?
Best regards,
Hans
Hi Hans-Hermann,
I had "a blonde moment" with the earlier reply The script in RDS is just a connection check utilizing a class library that's shipped with IdM itself. So it's not compatible with normal JCo object types as it's kind of on a higher level and built on top of JCo.
While ago I had to upgrade a script that I wrote with JCo2 to JCo3 and thought that the "to SAP" pass in IdM has to do the same thing as the underlying JCo changes for them too, so reverse engineered the "dse.jar" file to see how the product development of IdM has done it and came up with the script below.
function dse(Par){
importClass(Packages.com.sap.idm.ic.sap.jco.JCo3Proxy);
importClass(Packages.java.util.Properties);
importClass(java.util.HashMap);
var repName = "ECC";
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 {
var mConnection = JCo3Proxy.createInstance();
var Output = mConnection.logonSapi(jcoProperties, repName);
var inputParams = new HashMap();
inputParams.put("USERNAME", "tero");
var bapiRet = mConnection.runFunction("BAPI_USER_GET_DETAIL", inputParams);
uErrMsg(1, "bapiRet=" + bapiRet);
} catch(e) {
uErrMsg(2, "Error: " + e);
}
//if (mConnection != null) mConnection.close();
return;
}
All that the BAPI returns is in single hashtable, I didn't like that nor if anything in IdM changes with next patch/SP, I must adapt the script. Wrote newer version against the JCo3 and sapjco3.jar (not the dse.jar) with some help but cannot share that publicly in the internet.
I use sapjco3 with new RDS. So could you tell me the name of a example pass or a keyword for the "find" action?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can't remember the job reference but it was something like 'retrieve data...'. Here's a few code snippets that might help (am at home with my notes now!)
var USERNAME = uGetConstant("rep.JCO_CLIENT_USER");
var CLIENT = uGetConstant("rep.JCO_CLIENT_CLIENT");
var PASSWORD = uGetConstant("rep.JCO_CLIENT_PASSWD");
var LANGUAGE = uGetConstant("rep.JCO_CLIENT_LANG");
var SYSNR = uGetConstant("rep.JCO_CLIENT_SYSNR");
var R3NAME = uGetConstant("rep.JCO_CLIENT_R3NAME");
var ASHOST = uGetConstant("rep.JCO_CLIENT_ASHOST");
var MSHOST = uGetConstant("rep.JCO_CLIENT_MSHOST");
var GROUP = uGetConstant("rep.JCO_CLIENT_GROUP");
try
{
importClass(Packages.com.sap.mw.jco.JCO);
if (MSHOST == "" || MSHOST.length == 0)
{
// direct connection to application server
mConnection = JCO.createClient(CLIENT, USERNAME, PASSWORD, LANGUAGE, ASHOST, SYSNR);
}
else
{
// load balanced connection through Message Server
mConnection = JCO.createClient(CLIENT, USERNAME, PASSWORD, LANGUAGE, MSHOST, R3NAME, GROUP) ;
}
mConnection.connect();
mRepository = new JCO.Repository("IDMgmt", mConnection);
}
catch (e)
{
uError(e);
}
// Retrieved User details
// get details for this user
var func = mRepository.getFunctionTemplate("BAPI_USER_GET_DETAIL").getFunction();
var importParams = func.getImportParameterList();
var tableParams = func.getTableParameterList();
importParams.setValue(userMskeyValue,"USERNAME");
mConnection.execute(func);
var parameterList = func.getExportParameterList();
mConnection.disconnect();
That script looks like JCo2.x which in my opinion won't work with sapjco3.jar.
Here's SAP documentation about porting the JCo2 stuff to JCo3, don't know if that's all or best of it but what I found via googe and my keywords in my BSE (badly spoken English).
SAP JCo Migration 2.x-3.0 (Standalone) - Components of SAP Communication Technology - SAP Library
Example program in Java:
SAP JCo Migration 2.x-3.0 (Standalone) - Components of SAP Communication Technology - SAP Library
Found also this blog by Lars Vogel via googling on the topic:
The Java-classes etc referred in Lars' example can be found by using the search in his site. Lars' code is the most complete example I managed to find.
You can do it using javascript. You can set up a call via RFC and pass the data through. The task is set up the same way as any other script-based task
If you have the RDS, there are a few examples in there you can use as a basis.
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.