cancel
Showing results for 
Search instead for 
Did you mean: 

How to define xstring in java?

Former Member
0 Kudos

Hello,

I have a question for the JCo library:

I would like to use the Jco to execute a rfc-programm in SAP BW to write data directly into an DSO.

Therefore I got a small programm where I try to trigger "RSDRI_ODSO_INSERT_RFC" from SAP BW.

To submit data it uses an xstring as parameter.

Now I'm not sure how to define the xstring parameter in Java. If I read it right, the xstring is an byte sequence. Is this right?

So can I use a simple byte array in java for the parameter? Does anyone have a simple example how I can give some data as paramter to an xstring parameter in java, so that the ABAP application server will work with it?

Thanks in advance.

Best Regards

Stefan

Accepted Solutions (1)

Accepted Solutions (1)

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Stefan,

yes, an XSTRING is a raw byte array and you can use a Java byte[] type to fill in the values.

Please see the JCo API JavaDoc at class com.sap.conn.jco.JCoRecord for further info.

The first row in the shown table [method "Object getValue()"] tells which is the default Java type representation for the various ABAP RFC types.

So simply use JCoRecord.getByteArray([index|name]) and JCoRecord.setValue([index|name], byte[] value) for the appropriate XSTRING field.

Best regards,

Stefan

Former Member
0 Kudos

Hi Stefan,

thank you, that helps a lot

Best Regards

Stefan

Answers (0)