on 01-08-2007 9:33 PM
Hello Everyone,
I have created a web dynpro application which to display a report depending on the data given by the BAPI. But there is some issue with the numeric data returned by the BAPI.
For ex - if the BAPI returns 5.00 the value is displayed in the report as 5.
I want uniform decimal values till 2 decimal places. For example 5 shd come as 5.00, 2.1 shd come as 2.10 etc.
I searched SDN abt this, and found many threads relating to this.
I tried using decimal format, creating a simple dictinary type, but using all this what happens is the value basically changes to a string format, this implies that the value is displayed in the table as "left-aligned".
Where- as we need the decimal numeric values to be right-aligned.
Any thoughts how to achieve this.
Please correct me if I have missed out on anything.
Thanks,
Samta
Hi Samta,
This one worked for me. Pls try the following
1. Create a dictionary simple type of type double.
2. In Representation tab, give #.00 for Format.
3. Create context variable and assign its type to the above simple type.
4. Bind this variable to the UI element u want
5. Get the value as double from backend (let it be 123.4). Assign that value to the
context variable created.
The value displayed will be 123.40 which is the one u want.
The context variable now created accepts only double values(not string), so the value dispalyed will be right aligned
Hope this will be helpful
Regards
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a simpletype with decimal as the built-in type. Assign it to the attribute. At runtime, you can get the value of this Attribute as a BigDecimal.
BigDecimal bg = ele.get<attribute>;
Then you can set the scale as:
bg.setScale(2);
Hope that helps.
Rajit
Ofcourse set it back into the element.
Message was edited by:
Rajit Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
From wat i understood.. u have a attribute coming from BAPI.. which you want to display with two decimal places,,
In this case.. assuming it is coming with 2 decimal places from the backend.. create a value node.. inside the node which contains the output data. set its carinality to 1..1 .. create a value attribute of type big decimal in it.. or probably string.. if there is an issue in displaying BigDecimal directly..
map this new attribute to the necessary column in the table..
BigDecimal value = new BigDecimal("the actual value in string or long").setScale(2);
assign this to the value attribute created..
(If alignment is the problem.. set the column 's textview property halign to right.. and layout as block or paragraph.. )
Regards
Bharathwaj
Message was edited by:
Bharathwaj R
Hi,
the field what u getting the decimal value varaiable needs to chage as Char then that might helps you.
We had face same prob in R/3 side we simply chage the data type as Char.
Thanks,
Lohi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
create a simple type of type decimal. Go to the representation tab . In that under the external representation give <b>#0.00##</b> in the format input field.
This will solve your problem.
Regards,
Gopi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Samta,
The simplest thing is just to set align on Column object of your report's Table.
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.