cancel
Showing results for 
Search instead for 
Did you mean: 

JCO server - get parameters from SAP to JAVA

Former Member
0 Kudos

Hi,

my SAPSystem connects to an java-service .. thats works.

But I don't know, how I can get parameters from SAP to Java.

file is a genereted filename

filedata is a internal table with commands.

java should do this:

write a file with name from file and write in this the content from filedata.

But I get no results

Can somebody help me?

Thank you

Steph


SAP:
CALL FUNCTION 'GENERATE_FILE' DESTINATION dest
   EXPORTING
     file           = file 
   TABLES
     filedata       = filedata
  EXCEPTIONS
     system_failure = 1         MESSAGE mess
     communication_failure = 2  MESSAGE mess
     OTHERS = 3.
  IF sy-subrc <> 0.
    PERFORM log  USING 'E' 'X'
                          'Transfer not possible' (011) mess
                          'Job canceled'(003) ''.
  ENDIF.

JAVA:
JCO.MetaData fmeta2 = new JCO.MetaData("GENERATE_FILE");  
fmeta2.addInfo("REQUTEXT", JCO.TYPE_CHAR, 255,   0,  0, JCO.IMPORT_PARAMETER, null);
fmeta2.addInfo("ECHOTEXT", JCO.TYPE_CHAR, 255,   0,  0, JCO.EXPORT_PARAMETER, null);
fmeta2.addInfo("RESPTEXT", JCO.TYPE_CHAR, 255,   0,  0, JCO.EXPORT_PARAMETER, null);
repository.addFunctionInterfaceToCache(fmeta2);

<b>--></b> I think, that I forgot something here!!!

protected void handleRequest(JCO.Function function) throws Exception
{
  JCO.ParameterList input  = function.getImportParameterList();
  JCO.ParameterList output = function.getExportParameterList();
  JCO.ParameterList tables = function.getTableParameterList();
     
  if (function.getName().equals("RFC_REMOTE_FILE")) {	
	write the file
  }
...
}

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
Active Contributor
0 Kudos

Hello Stephanie,

it's correct, that you've forgot something. But to help you we need the data types of file and filedata. In the meantime you can have a look at my Weblog <a href="/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection">Setup and test SAP Java Connector outbound connection</a>. If you look at the example in detail, I think you will find out how to declare the MetaData for the input parameter and the table. Try to test the Example5 via SE37 running STFC_STRUCTURE to your JCo Server destination.

Regards

Gregor