cancel
Showing results for 
Search instead for 
Did you mean: 

ChechBox Implementation using Context Atrribute of Type String

Former Member
0 Kudos

Hi All,

I have got an RFC Function Module which gives data from R/3 to WebDynpro. One of the field which needs to be displayed is a "<b>CheckBox</b>". The "<b>Checked</b>" property of <b>CheckBox</b> needs context attribute of type "<b>Boolean</b>". But the context attribute given by the RFC structure is of type <b>String</b>.

I need to display these data in a Table UI element. How can I implement this feature? Which method is the best one and recommended for this kind of scenario.

Regards,

Aryan

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Add a calculated attribute (boolean, read-only=false) in the data source node of the table. (Maybe you have to put it into a 1:1 subnode)

Implement conversion boolean <-> string in the get/set methods of the calculated attribute.

Armin

Former Member
0 Kudos

HI Aryan,

Any way, the checkbox requires one label to display the information. This info is coming from RFC. Bind this to text property of check box

The information abt whether the check box is checked or not is getting from boolean variable (bound to checked).

So in table node, create 2 attributes, one for text and for boolean value. In table column, create checkbox and bind text and checked properties.

So it will display the check box with label in table column

Regards

Fahad Hamsa

Former Member
0 Kudos

Hi Aryan,

U r correct that he "Checked" property of CheckBox needs context attribute of type "Boolean".If the string is returning "true" or "false" values then u can convert the string to boolean explicitly.

e.g.

String s = "true";

Boolean b = Boolean.valueOf(s);

boolean a =b.booleanValue();

regards

Sumit

Former Member
0 Kudos

Hi Sumit,

Thanks for your reply. But any way I have to bind one context attribute of type boolean for the checkbox otherwise it will give u runtime error. I cannot bind the context attribute of type String to <b>Checked</b> property of checkbox at design time...

Just wondering what is the best approach in this scenario (this field is an editable column in the table element of type boolean)

Regards,

Aryan

Message was edited by:

Aryan M V

Former Member
0 Kudos

HI,

Dont bind the String directly. Create one more attribute of type boolean and bind to checked property. Then get value from RFC and convert and assign to this boolean variable as Sumit suggested

Regards

Fahad Hamsa

Former Member
0 Kudos

Hi Aryan,

U have to create 1 value attribute of type boolean.U have to get the value from model attribute and check for the value using the code i gave u already.Then u have to set the value to value attr .

regards

Sumit