on 09-16-2008 8:07 AM
Hi All ,
i have one method whose return type is String [] and i want to pass this value to the context's model attribute whose type is String.
Please tell me the way to do it.
Thanks
Sonal
HI Sonal,
I assume that the model attribute type is String[] (You have mentioned String)
Let this model attribute name be "A" and it is an import parameter.
You can set the value to this attribute by the following code, before executing the rfc
<RFCName>_Input input=new <RFCName>_Input();
wdContext.node<RFCName>_Input().bind(input);
input.setA(<String array>);
input.execute();//EXECUTES THE RFC
wdContext.nodeOutput().invalidate();
If yo want to pass Array of String (Say arr[]) to a model attribute of type String, then that attribute must be table parameter in RFC, so that, it can accept more than one values (ie. values from String array). This table parameter appear as a model node with one attribute (Say A), where the value will be set.
The value can be added to this from String array by the following code
for(int i=0;i<arr.length;i++)
{
<TableParameteType> t=new <TableParameteType> ();
t.setA(arr<i>);
input.add<TableParameteType>(t);
}
input.execute();
Here u can see <TableParameteType> by checking Right CLick->Properties->Modelclass Property of the node
Hope this helps.
Regards,
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Sonal,
you can use a Vector or ArrayList for it.
Vector is a collection of objects.
you can put multiple String objects in one Vector object.
google on Vector class to know more about it.
or take up any Java book.... read the collections framework chapter.
regards,
-Amol Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.