01-09-2006 12:09 PM
Hi Friends,
Is it possible to show the decimal places for one currency(say GBP) and without decimal places for other currency(say KRW) in ALV Report.I am getting the answer correctly if i execute for either GBP or KRW but when i try to combine both(GBP and KRW) i am not getting the expected result(ie,KRW without decimals and GBP with decimals).
How to achieve this?
Kindly advice..
Abdul
01-09-2006 12:11 PM
It is quite possible. Shouldn't be a problem. Just check if you are passing the correct currency code .
Ankur Bhandari
01-09-2006 12:13 PM
Hi abdul,
1. It works fantastic (as u require)
2. use this code (just copy paste)
This is the output (as u require)
KRW 415-
GBP 4.68
*----
REPORT abc.
TYPE-POOLS : slis.
*----
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : BEGIN OF itab OCCURS 0,
f1 LIKE P0008-BET01,
waers LIKE tcurc-waers,
END OF itab.
*----
START-OF-SELECTION.
itab-f1 = '-4.15'.
itab-waers = 'KRW'.
APPEND itab.
itab-f1 = '4.68'.
itab-waers = 'GBP'.
APPEND itab.
*----
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
OTHERS = 2.
regards,
amit m.
Message was edited by: Amit Mittal
01-09-2006 12:25 PM
Hi Amit.
I am having like this For KRW 4.56 and for GBP 4.56.
For KRW it should apperar as 4 and for GBP it should appear as 4.56.
I am not facing any problem if i display either GBP or KRW.
If i combine both then the problem is coming.
Abdul
01-09-2006 12:32 PM
Hi,
I think this proble was raised earlier........
In your field catlog you have to refer the currency field.
fieldcat-cfieldname = 'WAERS'.
fieldcat-datatype = 'CURR'.
This you need to give in AMOUNT field.
****************
After giving this also still the problem exits?
*****************
One more thing while MOVING your AMOUNT field dont use MOVE command.
Use WRITE command.
Example: WRITE: ITAB WRBTR TO OUT_IT-WRBTR.
I hope this will solve your problem.
**************************
Thanks.
If this helps u reward with points.
Message was edited by: KDeepak
Message was edited by: KDeepak
01-09-2006 12:41 PM
Yeah we have discussed before but the problem was not solved...
Abdul
01-09-2006 12:45 PM
Hi abdul,
1. First of all, nothing has to be done.
*----
2. Please check my code also. (copy paste in new program)
It works fantastic ( WITH 2 CURRENCIES - KRW, GBP)
*----
3. How have u defined your internal table.
DATA : BEGIN OF itab OCCURS 0,
f1 LIKE P0008-BET01,
waers LIKE tcurc-waers,
END OF itab.
please note the following :
a) make sure the name of the currency field
is WAERS and is defined exactly like :
waers LIKE tcurc-waers,
b) also make sure the AMOUNT field
refers to some amount field in database.
for eg.
f1 LIKE P0008-BET01,
4. Make sure, values are populated.
5. Rest , nothing has to be done.
It works fantastic,
even with 2 currencies or more.
regards,
amit m.
Message was edited by: Amit Mittal
01-09-2006 1:18 PM
Still i am not getting since the value of the table field by default contains 2 decimal places i dont want to show this in my output for KRW..
Abdul
01-09-2006 12:18 PM
Hi Abdul
I remember we were discussed this some time back.
i think amit's solution will solve your requirement.
Regards
vijay