Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV Currency problem

Former Member
0 Likes
832

Hi,

I have a report which displays currency with the document no's in different currency formats based on the company code.

If i give Korean company code...i should not get the decimals in currency,

and if i give US company code,i should get the decimals in currency value.

Can any one suggest how can i go ahead to achieve this.

Regards,

Prashanth

Hi,

I have a report which displays currency with the document no's in different currency formats based on the company code.

If i give Korean company code...i should not get the decimals in currency,

and if i give US company code,i should get the decimals in currency value.

Can any one suggest how can i go ahead to achieve this.

Regards,

Prashanth

4 REPLIES 4
Read only

Former Member
0 Likes
717

Hi,

Take two fields one for decimal and other one for non-decimal in the declaration of final internal table

if country_code eq korean.

make field catalog with non decimal field

if country_code eq us

make field catlog with decimal field

Regards

Krishna

Read only

Former Member
0 Likes
717

Hi Prashant ,

This is possible and can be achived as below :

Get all the resultant data in internal table .

When you make the field catalog for display , there is one field for currency and currency key in catalog.

You need to pass these field based on your comapny code , when you make catalog.

All the decimals will be adjusted automatically as per currency.

Hope you get it .

Read only

Former Member
0 Likes
717

Hi,

Try this...

Wrtite to ..Currency Stmt for all currency fileds and then populate into your final internal table.

data:         l_v_ansal TYPE ansal_15,         "  Annual salary
                 l_v_ansal1 TYPE char17,
                 l_v_ansal2 TYPE char17.

*Annual Salary-ANSAL
        l_v_ansal1        = l_wa_final-ansal.                             " Final Table currency filed
        WRITE l_v_ansal1 TO l_v_ansal2 LEFT-JUSTIFIED
        NO-GAP NO-GROUPING CURRENCY l_wa_final-ancur.     " Ancur is the Currency key for corresponding country
        MOVE l_v_ansal2 TO l_v_ansal.        " Annual salary
       l_wa_final-ansal = l_v_ansal.
       Append l_wa_final to i_final.
        CLEAR: l_v_ansal1, l_v_ansal2.

It will be helpfull to you. I will support all country currency key. I used this in some of my developments.

Thanks

Babu

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
717

Hello Prashant,

This can be taken care of when populating the ALV fieldcatalog.

But prior to this remember you need to have the currency field in your Final ALV display table.

While passing any amount field you need to pass the Currency fieldname to CFIELDNAME like this:

DATA: 
L_WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

* Amount in doc. Curr
  CLEAR L_WA_FIELDCAT.
  L_WA_FIELDCAT-COL_POS = 5.
  L_WA_FIELDCAT-SELTEXT_L = TEXT-006.    "Amount in doc. Curr
  L_WA_FIELDCAT-FIELDNAME = 'WRBTR'.    "Fieldname of the Amount in the table IT_FINAL
  L_WA_FIELDCAT-CFIELDNAME = 'WAERS'.  "Fieldname of the Curr. in the table IT_FINAL
  L_WA_FIELDCAT-TABNAME = 'IT_FINAL'. "Table you pass to the ALV FM

  APPEND L_WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR L_WA_FIELDCAT.

Hope i am clear.

BR,

Suhas