on 10-20-2006 1:24 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
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
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.