on 05-27-2005 11:34 AM
Hi,
The following code shows how I set the content of a wdp model:
Z_Zmm_Tax_Calc2_Input TaxCode2 = new Z_Zmm_Tax_Calc2_Input();
wdContext.nodeZ_ZMM_TAX_CALC2().bind(TaxCode2);
TaxCode2.addItems(new Zzz_Tax_Calc());
It's the last line of the code that causes the exception
When executing the model I get the following.
Error stacktrace:
java.lang.ClassCastException: com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCException: The Relation must reference ModelClass instances of Type , not of !
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.checkRelatedModelObject(DynamicRFCModelClass.java:727)
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.addRelatedModelObject(DynamicRFCModelClass.java:802)
at com.alum.miromodel.Z_Zmm_Tax_Calc2_Input.addItems(Z_Zmm_Tax_Calc2_Input.java:170)
at com.alum.miro.Cust.initTaxCalc2(Cust.java:911)
Can anyone tell me what it means?
BR
Olof Tronnberg
Hi Olof,
Z_Zmm_Tax_Calc2_Input TaxCode2 = new Z_Zmm_Tax_Calc2_Input();
wdContext.nodeZ_ZMM_TAX_CALC2().bind(TaxCode2);
These two lines of code will first create a object of the model node and bind it to the present view s context node.
I thnk this node Z_Zmm_Tax_Calc2_Input() has structures in it. When ur rfc needs inputs we hav to set them as
say
TaxCode2.set<some attribute in the model node>(its value);
If there is a structure
TaxCode2.set<structure name>(new <structure name>);
This is the correct way.
When u say TaxCode2.addItem(); the argument needed is of type Item . IS zzz_tax_calc of that type..
If its not of the type it will throw the classcast exception
AddItem is usually used when we have to add more than instance.
Bind creates one instance of the node and binds it.
I think its a gud practice to stick with bind and set rather than add when it comes to RFC s
Regards
Bharathwaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Seems you are trying to pass a Structure or Table into the RFC.
If the value that you are passing is a Structure, for e.g. passing a single element of a node then you can give it as
TaxCode2.setItem2(new Z<Structure name>());
You can verify in the RFC if the import parameter Item is of type Z<Structure name>.
If the value you are passing is of type table the you can give
TaxCode2.addItem2(new Z<Table name>());
You can verify in the tables tab whether you are passing a table Item of type Z<Table name>.
revert for further clarification.
regards
Noufal
I am no expert in this area, but perhaps your code should be something like
TaxCode2.set<RelationName>( new Zzz_Tax_Calc() );
instead of
TaxCode2.addItems(new Zzz_Tax_Calc());
<RelationName> is the name of the parent/child-relation between the input node and the structured parameter (double-arrow symbol).
See "Inside Web Dynpro", chapter 10.7.1
Only a guess...
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for(all elements to be added to the import table)
{
<ModelClass of Rfc Import Table> objectName = new <ModelClass>;
objectName.set<Attribute>;
.
.
TaxCode2.add<Rfc Import TableName>(objectName);
}
In your case, I feel that 'Zzz_Tax_Calc' is the Rfc Import Table
Hope I'm right.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are adding wrong class to relation.
However, compiler allows you to do this. Then you are either need to re-generate model (because of changes in back-end) or resolve problems with class loaders (very rare case with typical Adaptive RFC model)
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Looks like problem with the parameter that you are passing to the addItems method.
Try this
TaxCode2.addItems(new Z_Zmm_Tax_Calc2());
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.