‎2007 Mar 07 7:39 AM
Hi All,
I am trying to solve the following problem in displaying ALV Grid using REUSE_ALV_GRID_DISPLAY:
<b>Requirement:</b>
I am having the currency column field with value 241160.00 in the output table. I also have a currency column field which is used for currency key in the output table. What is required is to display the value with or without decimals depending on the currency column field. The value of the currency key may change. I have used CFIELDNAME for the currency value column with column name of the currency key in the field catalog.
<b>Problem:</b>
When Taiwanese Dollar (TWD) comes in the currency key column then the value is displayed is 24,116,000 and if US Dollar (USD) comes in the currency key, value displayed is 241,160.00. If Bahrain Deenar (BHD) comes in here, value displayed is 24,116.000.
Please let me know if there is a solution for this.
Thanks in advance,
Prakash
‎2007 Mar 07 7:46 AM
Hi prakash,
1. just copy paste
2. it will display correct currency format in alv,
based upon different currencies in the internal table.
3.
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.
itab-f1 = '500000'.
itab-waers = 'USD'.
APPEND itab.
itab-f1 = '500000'.
itab-waers = 'INR'.
APPEND itab.
itab-f1 = '500000'.
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.