cancel
Showing results for 
Search instead for 
Did you mean: 

String representation for a JCO.Structure

Former Member
0 Kudos

Hello,

I need to convert a JCO.Structure into a "SAP-understandable" String

because the RFC-Function used for communication accepts only

Strings as values.

Is there a way to achieve this in a generic way?

Thx.

Torsten

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

I need to do something like that:

JCO.Structure myStruct = ...

myStruct.setValue(12345, "ORDER_NO");

myStruct.setValue(new BigDecimal(12.5d), "AMOUNT");

...

<b>String myStructString = "convert myStruct to String...";</b>

JCO.Function myFunction = ...

myFunction.getImportParameterList().setValue(myStructString, "STRUCT");

...

myJCOConnection.execute(myFunction);

Does anybody have an example on how to successfully do the struct to

string conversion mentioned above?

Torsten

Former Member
0 Kudos

Hi Torsten,

Converting the JCO.structure as far as I know this what can be done :


JCO.Structure str = new JCO.Structure("Struct");
	int i  = str.getNumFields();
	for(int k=0;k<i;k++){
		/// Assign it to some String 
		str.getString(i);
		// After this its up to you and the RFC Structure on how you want to pass it.	
	}

Regards

Amit