Skip to Content

SAP Java Connector (SAP JCO) Dynamic list of parameters and values from ABAP RFC FM

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on May 22 at 04:04 PM

    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,

    Mateusz
    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • Posted on May 26 at 03:51 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.