cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Char1 in ABAP Side & Boolean in Java Side

Former Member
0 Likes
1,079

Hello,

When importing a BAPI at Java side, I have a problem to deal with a field of type char1 (referenced to a domain with two fixed values : 'X' et ' ') which is becoming a boolean at Java Side.

I found posts talking about the same problems but I didn't find answers.

Have anyone encountred this problem before?

Thanks in advance for your help,

ImaneA

View Entire Topic
Former Member
0 Likes

Hi Imane,

Char1 field which you are seeing at SAP end is of type FLAG it accepts only 'X' and ' ' . So boolean cannot accept this so declare the field as char instead of boolean in java or else declare Char1 in both SAP and Java so compatabilty doesnt miss .

Former Member
0 Likes

Thank you John & Srikanth for your replies.

My issue is that the Java side doesn't recognize the 'X' or ' '. It means that for Java side, the field is always empty.

We tried a domain with no values instead of 'X' and ' ' but it still doesn't recognize the content of field even if it is a String now and no longer a boolean in java side.

Do you have any idea how to solve this problem?

Thanks in advance for your help.

Regards,

Imane

former_member182372
Active Contributor
0 Likes

Well, calculated attribute should solve this. Something like


public boolean getCalculatedAttribute()
{
return "X".equals(<CODE_TO_GET_ATTRIBUTE_VALUE_FROM_RFC_MODEL_CLASS>);
}

public boolean setCalculatedAttribute(boolean value)
{
if(value)
{
<CODE_TO_SET_VALUE_FROM_RFC_MODEL_CLASS_TO_'X'>
}
else
{
<CODE_TO_SET_VALUE_FROM_RFC_MODEL_CLASS_TO_''>
}
}