09-10-2013 11:14 AM
Hello everyone,
here is my sample code ...
" types: begin of ty_x,
(some fields)
.
.
.
.
menge type P decimals 3,
currkey type waers,
end of ty_x. (let us say this is my final output structure )
data: i_x type table of ty_x,
w_x type ty_x.
loop at it into wa.
.
.
.
if currkey is not maintained in TCURX table
then menge should be diaplayed with 3 decimal values
else.
menge should be diaplayed without decimal values
endif.
append w_x to i_x.
endloop.
reuse alv grid ( to display the output).
"
here what should be the type of menge so that i can get the output as i have mentioned in the if clause?
output example:
field1 field2 field3 field4 QUANTITY(MENGE) CURRENCYKEY
A A A A 123.456 USD
B B B B 11100.253 USD
C C C C 11100 KRW
D D D D 1255 JPY
i have tried to restrict the type to p with decimals 0. but that would reflect to all the values in the field quantity.
kindly help me with this..
Thanks in advance,
jyothi reddy.
09-10-2013 12:25 PM
Hi,
instead of doing a MOVE ... TO i_x-menge, try to do a WRITE ... TO i_x-menge CURRENCY i_x-waers.
regards
Fred
09-10-2013 12:35 PM
Hi,
Thanks
Gangadhar
09-10-2013 1:40 PM
09-10-2013 1:49 PM
HI,
If you displaying your output in ALV for these ideally you must pass the currency field parameter in the fieldcatalog.
For your currency field use cfieldname in the fiedcatalog if you want to display for quantity fields pass
qfieldname. The ALV by default takes care of the decimals to be displayed.
You can find lots of example for this in BC ALV.
If your requirement is different kindly ignore.
Regards,
Vasanth
09-10-2013 2:02 PM
Hi,
Use a string in ALV field catalog to display menge. Based on your currency key condition, assign the value with decimals / without decimals to this field in ALV.
-Ashwin