on 05-22-2020 4:34 PM
Hi Community,
I have a problem with the dynamic receipt of the list of parameters and their values when calling the ABAP function in SAP (with DESTINATION parameter as SAP JCO SERVER) and then processing it using Java in SAP JCO Server.
The point is that i need a dynamic way to get information in JCO Server (using Java) about what SAP function and with what parameters (Importing, Exporting, Changing and Tables) was called in SAP (because my JCO Server server listens for SAP RFC calls has to store information about this calls from SAP).
I know that (for example for Importing Parameters) using command (JCoParameterList ParameterList = function.getImportParameterList()) in Java I can receive this data, but how can I get Iformations from this Variable "ParameterList" on the name of the parameters, their types and the values with which they were called?
I will be grateful for any suggestions on how in Java we can retrieve this data from object of type "JCoParameterList"!
Kind regards,
Andrew
Hi andrew.michalski
Haven't done it myself, but I see that the JCoFunction documentation has all relevant information. Did you check it?
https://www.int13h.nl:8443/_content/SAPDocuments/JCo_API_3_0/com/sap/conn/jco/JCoFunction.html
For example, getImportParameterList method returns JCoParameterList object.
There you can get the field iterator, with the getParameterFieldIterator method, which returns the JCoParameterFieldIterator object.
You can get the JCoParameterField object with the nextParameterField method of the iterator.
And the field object has all the properties you need, most of them from the parent class JCoField.
Regards,
MateuszYou must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mateusz,
Thanks for your reply.
I did it using JCoParameterList. JCoParameterList
contains a list of JCoParameterField
instances. JCoParameterField
in turn inherits from JCoField
, which gives methods to set or get the parameter value. JCoParameterList
allows to iterate through the list of parameters, check what kind of parameter they are, get their value etc. Example of how I did it:
JCoParameterList parameters = function.getImportParameterList();
JCoParameterFieldIterator it = parameters.getParameterFieldIterator();
while (it.hasNextField()) {
JCoParameterField field = it.nextParameterField();
field.getName(); //parameter name
field.getString(); //parameter value
}
Regards,
Andrew
Hi Andrew,
you can also ask the JCoParameterList directly for its metadata instead of iterating over JCoFields. Accressing values directly is more efficient.
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.