Skip to Content
0
Former Member
Apr 29, 2005 at 01:58 PM

Provide Table as Function Parameter in Outbound-Server

562 Views

Hello,

we successfully set up an JCO Outbound Server to communicate with R/3 4.7.

First we defined a custom Repository which knows a function with one parameter only. I can call that function from SAP and get the result as an import parameter in the outbound RFC call.

Now I'd like to provide a table as one of the parameters of that function located on the outbound J2EE component.

My first idea was:

CALL FUNCTION 'STFC_FOO' DESTINATION
  'MYSERVICE_OUTBOUND'
  IMPORTING
    message        = message
   TABLES
    xmlcontent_tab = xmlcontent_tab.

The table type of xmlcontent_tab is defined.

But how do I define that table and parameter on the opposite side repository with JCO?

I use the JCO.MetaData.addInfo() interface to define the function. That looks like:

fmeta.addInfo("MESSAGE", JCO.TYPE_CHAR, 1000, 0, 0, JCO.EXPORT_PARAMETER, null);
fmeta.addInfo("XMLCONTENT_TAB", JCO.TYPE_TABLE,0 , 0, 0, JCO.EXPORT_PARAMETER, tmetaXml);

tmetaXml is defined as well:

JCO.MetaData tmetaXml = new JCO.MetaData("ES_XMLIMPORT");
tmetaXml.addInfo("ES_XMLLINE", JCO.TYPE_BYTE, ROWLENGTH);

I was wondering if there is a Flag called JCO.TABLE_PARAMETER but there is none.

How becomes the paramater a table parameter? Given the above, I get null when I ask the function for

func.getTableParameterList()

naturally...

But I can ask for

func.getExportParameterList().getTable("XMLCONTENT_TAB")

and get the table. But I believe that way the table is not stored correctly to be passed to SAP, right?

Like that the SAP program containing the statement

TABLES tab = tab1

like above crashes when casting the import parameter (export on J2EE side) to a table parameter.

When I put

...
IMPORTING
...
xmlcontent_tab = xmlcontent_tab

the program runs without exception but I get no data from the table, which was still there on the J2EE side.

So, how do I provide a table as parameter in the Outbound JCO server? Any idea? Please can you also point me to the correct Metadata definition for tables? I think that's one of my mistakes.

Thanks

Carsten

Message was edited by: Olaf Zschiedrich

Message was edited by: Olaf Zschiedrich