on 07-28-2010 8:01 AM
Hi experts,
We are now calling RFC from web dynpro. In the BAPI, there is a fileld is XFELD type. When the bapi is imported to model from web dynpro, it is imported as an model data type with boolean type.
In abap the XFELD type has two values:
X means checked
means not checked
while in java boolean it is true or false.
When we set the field with false in web dynpro, it is all good; but if we set the field with true, there is an exception IllegalArgumentException.
How to do this, thank you!
best regards,
Yang
Hi,
Instead of passing the value like control.setItem(true);
Just try to pass by having a checbox UI element binded with boolean data type or set that context with boolean value based on your logic(wdContext.currentContext().setData(true); ) and map that context value to bapi parameter.
control.setitem(wdContext.currentContext().getData());
Regards,
Manjunath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manjunath Subra,
Thank you for your reply.
But I tried your method, don't use control.setItem(true), but bind the context 'item' to an checkbox UI. The context item is mapped to bapi model.
When you unselect the checkbox, no exception, but when we select the checkbox, the same error raised.
java.lang.IllegalArgumentException
at com.sap.dictionary.runtime.DdTypeBinary.format(DdTypeBinary.java:69)
at com.sap.dictionary.runtime.DdSimpleType.format(DdSimpleType.java:281)
at com.sap.dictionary.runtime.DdSimpleTypeShell.format(DdSimpleTypeShell.java:148)
at com.sap.tc.webdynpro.progmodel.context.AttributePointer.format(AttributePointer.java:516)
at com.sap.tc.webdynpro.clientserver.data.DataContainer.getAndFormat(DataContainer.java:1009)
Thanks!
Yang
Hi,
If I understand.. Somehow, your XFELD is being treated as Binary in WDP. As I don't know the cause (probably a malformed type in the back-end), there are a couple things you can try:
1st:
- As you can see in the trace, the SympleType is trying to apply a format.. This methods will format an Object (true is not Object, is the primitive, you should use the wrapper Boolean) - Instead of setItem(true) use setItem(new Boolean(true)) - you can do the same with false, and I think it's not applying the format when 'false' cuz it thinks the field would be a null.
2nd:
- You can also try modifying the SimpleType format property. In order to do this, you can use:
wdContext.node[XYZ]().getNodeInfo().getAttribute([XYZ]).getModifiableSimpleType().setFormat(null); This should probably remove the format validation from the SympleType during the roundtrip. I'm not sure if the syntax above is 100% right. Anyways, your Node, the NodeInfo, the AttributePointer, the ModifiableSympleType. - Remember, if you have declared the Context Attribute in the Component, you need to Modify it in the Component. If it's a view Attribute, in the View, and so on.
Hope it helps,
Daniel
Hi Daniel,
Thank you very much for your suggestions:
1.
using:
wdContext.currentIs_Dlv_Data_ControlElement().setItem(new Boolean(true));
this is all the same, throws java.lang.IllegalArgumentException
2. using:
wdContext.nodeIs_Dlv_Data_Control().getNodeInfo().getAttribute("Item").getModifiableSimpleType().setFormat(null);
throws the following exception:
java.lang.UnsupportedOperationException
at com.sap.dictionary.runtime.DdSimpleType.setFormat(DdSimpleType.java:875)
at com.sap.tc.webdynpro.progmodel.context.ModifiableSimpleType.setFormat(ModifiableSimpleType.java:175)
at com.cabbeen.wd_demo.comp_inner.Comp_Inner.wdDoInit(Comp_Inner.java:120)
at com.cabbeen.wd_demo.comp_inner.wdp.InternalComp_Inner.wdDoInit(InternalComp_Inner.java:597)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:160)
... 64 more
Any more hints?? Thank you!
Regards,
Yang
Hi,
What are you trying to pass vaue if it is checked ?
i think you are trying to pass a value other than "true", in such case it will through an IllegalArgumentException in java
Thanks,
Sreeni.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yang,
Use selected() method to check if the check box is cheked or not.
wdContext.currentContextXXElement.getSelected() ->if its true,set some value in java code -XTRUE
If its false ,set the value to XFALSE
While executing the BAPI pass this parameter to the RFC.
Write sample code in BAPI based on the value.
If(string == XTRUE)
{
}
else
{
}
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.