cancel
Showing results for 
Search instead for 
Did you mean: 

RFC conversation problem, can't use XFELD field

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Yang,

Just try this as an alternate and see if it works, Just change the Raw data type from SAP which is referencing to Boolean to webdynpro data type Boolean.

Regards,

Manjunath

Former Member
0 Kudos

HI Manjunath,

The problem is this is an standard bapi, we can't change anything from ABAP, is there anything we could do in the web dynpro java side.

Thanks!

Yang

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi,

Thank you for your reply.

control.setItem(false);//this is all fine

but if:

control.setItem(true);

throws IllegalArgumentException

Thanks!

Former Member
0 Kudos

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

{

}

Former Member
0 Kudos

Hi Lavanya Goriga ,

Thank you for your reply.

But I don't really understand your message, what is XTRUE?

how to do set XTRUE in java code?

because we are using standard bapi, so abap side can't do any changing.

Thanks!

Yang