on 07-24-2008 1:13 PM
Hi Experts,
When i am testing a BAPI , the data from infotype is displayed as 1265.00 .
But when i am displaying the same data on portal through webdynpro code , the zeros are getting trauncated and it's getting displayed
as 1265 only .
Can anbody please tell me regarding this difference .
Secondly if i want to display my data as 1265.00 only (exactly same as in infotype) , then what modification i need to do in my webdynpro code ?
Thanks a lot in advance .
HI,
what is the type of attribute in back end and in web dynpro?
PradeeP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this code in component controller wdDoInit()
wdContext
.node<BAPI_Node>() // node contains decimal attribute
.getNodeInfo()
.getAttribute("<dec_attr>") // decimal attribute name
.getModifiableSimpleType()
.setFormat("#,###.00"); // format specification
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi jain,
You can display as many zero's as you want after the decimal point, try this
DecimalFormat twoPlaces = new DecimalFormat("0.00");
twoPlaces.format(yourValue);
just for display purpose...
DecimalFormat twoPlaces = new DecimalFormat("0.00");
wdComponentAPI.getMessageManager().reportSuccess(twoPlaces.format(1));
// it will give the out put of 1.00
PradeeP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pradip,
I changed the code as per your suggestion . Since then it's not working .
I have pasted the code below . Please help .
*****************************************************************************************************
IWDMessageManager manager = wdComponentAPI.getMessageManager();
float totalAmount;
float total=0;
int n = wdContext.nodexxx().size();
for (int i = 0; i < n; ++i) {
BigDecimal OrderAmount = wdContext.nodexxx().getxxxAt(i).getxxx();
try {
totalAmount =(OrderAmount.floatValue());
total = total + totalAmount;
} catch (NumberFormatException nfe) {
logger.errorT(nfe.getMessage());
totalAmount = 0;
}
}
DecimalFormat twoPlaces = new DecimalFormat("0.00");
* twoPlaces.format(total);*
wdContext.currentContextElement().setTotalOrderAmount(total);
Hi Jain,
you can use both Decimal and BigDecimal as the Data types for Displaying Decimals in the Portal.
Regards,
Sharma.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.