cancel
Showing results for 
Search instead for 
Did you mean: 

Hou to bind a char value of bapi to check box of a UItableelement

konchada_saikrishna
Active Participant
0 Kudos

Hi all,

I have a bapi which returns a table where one of the field is char(1), I should bind this field with a check box in the UItableelement. When i try to change the celleditor to check box it raises an error as select an attribute of type boolean. how to solve it.

Also if we can change the char data type to boolean in the bapi table my problem is solved.

Thanks in advance.

problem solving reply is awarded.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Add a (calculated, readOnly=false, boolean) attribute "Checked" to the context node.

Assuming the char(1) attribute is named "X", implement the get and set methods like


boolean getChecked(I<Node>Element element)
{
  return "x".equalsIgnoreCase( element.getX() );
}

void setChecked(I<Node>Element element, boolean value)
{
  element.setX(value ? "x" : " ");
}

Armin

konchada_saikrishna
Active Participant
0 Kudos

Hi Armin,

I didn't get what you are saying, See my requirement is,

1) I would get a table with 2 columns from bapi.

2) 1st field is fname which is binded to textview.

3) 2nd field is check(char 1) which should be a check box.

4) I should display the table contents for editing, i.e., user should allowed to select the required "fname" with the corresponding "check" field checked.

5) finally these updated values are to be stored back again.

Former Member
0 Kudos

Sai,

you should select boolean only for checkbox. so you can pass only boolean value for check box. Change the field to boolean on the backend.

/Raj.

konchada_saikrishna
Active Participant
0 Kudos

Hai Raj,

I heard that there is no boolean datatype in sap, my coleagues say they take char value and represent "X" for true and vice versa.

They can define boolean data element for field name but cannot export boolean value. If there is a way to define & send boolean values please let me how to do that. Then my entire problem is solved in one shot.

Thanks a Lot.

Regards SaiKrishna

Former Member
0 Kudos

Hi Sai,

One thing I do is, (I dont map it to the backend), I will take the check box value as boolean, when it is true, I will send 'X' to the backend (Hardcoding when u set input for ur BAPI) otherwise 'whateveruwant'. This way u dont need to worry about char and boolean mapping.

Armin suggestion looks better, why isnt working.

Please Try this.

Thanks,

Raj.

Message was edited by: Raj

konchada_saikrishna
Active Participant
0 Kudos

Hi Raj,

Armin suggested the same by some caliculated attributes, it works but doesnt displays the data. They are shown only when that row is selected. I am trying for that. By the way do u know how to make a UITable invisible dynamically.

Thanks

BY Sai .

Former Member
0 Kudos

To make the Table invisible: Bind Table.<i>visible </i>property to a context attribute of simple type "Visibility" and change context attribute value in event handler to WDVisibility.NONE.

Armin

konchada_saikrishna
Active Participant
0 Kudos

Hi,

Here in this issue I had the code in modify method of the view

if(num == 1)

{

// amessage to display that there are no records in the table

msgele.setText(msg);

wdContext.currentContextElement().getVisible().VISIBLE.NONE;

//here it is displaying an error indiation

// table.setVisible(wdContext.createContextElement().getVisible());

}

is this ok, & do we need the simpletype "visible" as calculated and need something to in get/set methods

Former Member
0 Kudos

Don't do this in method wdDoModifyView() but in a controller method, e.g. an event handler.

Create a context attribute "TableVisibility" of type com.sap.ide.webdynpro.uielementdefinitions.Visibility (designtime simple type, not Java native type).

Bind property Table.visible to this attribute.

In the event handler, write something like

void on<Event)(...)
{
  if (<table-should-be-invisible>)
  {
    wdContext.currentContextElement().setTableVisibility(WDVisibility.NONE);
  }
  else
  {
    wdContext.currentContextElement().setTableVisibility(WDVisibility.VISIBLE);
  }
}

Armin

Former Member
0 Kudos

Sai,

I didnt understand what do u mean by data not displaying. I created a dummy checkbox in the table, I can see it in each row. u can check only when row is selected...thats how table works in web dynpro.

If its not true, explain the problem clearly.

Thanks,

Raj.

konchada_saikrishna
Active Participant
0 Kudos

Hi Raj,

As I said I have 19 rows in the backend(Ztable) where 4 rows values vill be "X", in the view(2 columns checkbox, text view) I could get all the 19 rows the textview is displayed well but the check box are all unchecked.

when I select a particular row then the value is displayed as checked if it is "X" at backend and viceversa. i.e., the 4 rows values are displayed checked only when we select them.

Regards ,

Sai