cancel
Showing results for 
Search instead for 
Did you mean: 

How to manipulate the particular bapi column value

Former Member
0 Kudos

Hi All,

I have created a dynamic table and bounded the bapinode to the editor.

editor.bindText(nodename.fieldname);

I need to manipulate the particular column values. I need to round down the decimal values. How to change the particular column values?

I have written the following code:

if(fieldName.equalsIgnoreCase("Gross")){

IPrivateView.IbapiNode bapiNode = wdContext.nodename();

for(int i=0;i<wdContext.bapinode().size();i++){

IPrivateView.IbapiElement bapiElem=bapiNode.getbapiElementAt(i);

bapiElem.setGross(bapiElem.getGross.divide(2,"" );//divide is for setting the scale for decimal values

editor = (IWDTextView)view.createElement(IWDTextView.class, null);

editor.bindText(tablenode.gross);

column.destroyTableCellEditor();

column.setTableCellEditor(editor);

}

}

Where am I doing wrong?

Pls suggest . Its very urgent.

Hope I am clear with my problem.

Regards,

Subashini

Accepted Solutions (1)

Accepted Solutions (1)

nikhil_bose
Active Contributor
0 Kudos

please go through [blog: Formatting RFC values|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6045] [original link is broken] [original link is broken] [original link is broken];. Hope this will help

nikhil

Former Member
0 Kudos

Hi Nikhil,

I do not want to create a value node separately. I need to change the bapi node values and bind it to my table editor. I tried with link to action for the particular column and it is reflecting perfectly. The problem is with this decimal format column which I am unable to bind it to my table editor. Please suggest.

Regards,

Subashini.

nikhil_bose
Active Contributor
0 Kudos

why don't you try the code I posted above? you can by the way reduce the code inside wdDoModifyView() too!!

I think it is not possible to add attribute to a model node. if we want to add attributes, we will create value node inside model node.

again plz try the above code and let me status

nikhil

Former Member
0 Kudos

Hi,

I tried with the code u have posted. But when i execute the application im getiing the following Exception:

"must not modify the datatype of a mapped attribute"

Please suggest how to proceed.

Regards,

Subashini.J

nikhil_bose
Active Contributor
0 Kudos

hi padmalatha,

can you try the same code in component/custom controller which you connected to model?

and let me know the status

nikhil

Answers (1)

Answers (1)

nikhil_bose
Active Contributor
0 Kudos

try commenting the code posted here and paste this code in the

init()


IWDAttributeInfo grossinfo = wdContext.bapinode().getNodeInof().getAttribute("Gross");
grossinfo..getModifiableSimpleType().setFieldLabel("#####.##");

let me know the status

nikhil

Former Member
0 Kudos

Hi Nikhil,

I can able to format the bapi values. The problem is I could not set those formatted values in the table say gross column.

Because my editor is bounded with bapinode. Hence I am using destroytablecelleditor which destroys the particular column and build the new column. But the formatted values are not getting displayed. This is my issue.

Regards,

Subashini

nikhil_bose
Active Contributor
0 Kudos

sorry for the wrong code


IWDAttributeInfo grossinfo = wdContext.bapinode().getNodeInof().getAttribute("Gross");

grossinfo.getModifiableSimpleType().setFormat("#####.##");

you can't edit a binded table. try the above code is one option and let me now how it works.

Another way is you can create a value node inside Bapi node and you can have a calculated attribute which is on your spec.

nikhil

Edited by: Nikhil ßos on Jun 27, 2008 4:34 PM