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

Instead of 90.900 its coming as 90.900,00 after using currency_amount_sap_to_display function module

0 Likes
3,571

Hi,

Instead of 90.900 its coming as 90.900,00 after using currency_amount_sap_to_display function module.

Please let me know as its an urgent change to be fixed.

Regards,

Aniket Narayan.

15 REPLIES 15
Read only

Sandra_Rossi
Active Contributor
0 Likes
3,161

Post your code if it's urgent and you want to be helped. Explain the context too.

Read only

former_member1716
Active Contributor
0 Likes
3,161

aniket1989,

We can only understand how the FM behaves from your post but to provide the solution we want to know cause of the issue. Only with your clear issue explanation and code that is used we will be able to help you further.

Regards!

Read only

0 Likes
3,161

Hi Sandra/Satish,

Please see the below code for the reference and finally using ALV FM data is being displayed:

For Tax code D3 and D2 they need summation value to be displayed on the other line, its old code so they are using REUSE_ALV_GRID_DISPLAY FM.

Loop at t_ivat into ls_ivat where mwskz = 'D3'

or mwskz = 'D2'.

ls_ivatt = ls_ivat.

append ls_ivatt to lt_ivat.

clear ls_ivatt.

AT END OF belnr.

SUM.

ls_ivatt = ls_ivat.

clear ls_ivat.

p_intval = ls_ivatt-hwbas.

call function 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'

EXPORTING

currency = 'VND'

amount_internal = p_intval

IMPORTING

amount_display = g_disval

EXCEPTIONS

internal_error = 1

OTHERS = 2.

ls_ivat-hwbas = g_disval.

ls_ivat-bldat = abap_false.

ls_ivat-item = abap_false.

append ls_ivat to lt_ivat.

clear ls_ivat.

ENDAT.

ENDLOOP.

This is where i am doing the summations.

Regards,

Aniket Narayan.

Read only

S_Sriram
Active Contributor
0 Likes
3,161

Hi Aniket.

Could you check the user id decimal notification in the transaction code SU01, refer the below screen shot

Regards

SS

Read only

Sandra_Rossi
Active Contributor
3,161

I don't know what does CURRENCY_AMOUNT_SAP_TO_DISPLAY, but usually you don't need this kind of function module to display the right number of decimals (0 in your case).

How many decimals has P_INTVAL?

VND is a currency without decimals, so the standard ALV feature for currencies should work. Search the forum for more information how it works.

Read only

Sandra_Rossi
Active Contributor
3,161

I looked at CURRENCY_AMOUNT_SAP_TO_DISPLAY, and I confirm it's completely useless.

By the way, it's important that you explain what value you expect.

The best solution in your case is to use the ALV feature of currencies.

If you don't have time to search in the forum, use this:

DATA(p_intval) = CONV WMTO_S-AMOUNT( '90.9000' ). " 4 decimals
DATA(string) = |{ p_intval CURRENCY 'VND' }|. " 0 decimals
ASSERT string = |909000|. " but is it what you expect?
Read only

jyothiradityak
Participant
0 Likes
3,161

You may also use FM BAPI_CURRENCY_CONV_TO_EXTERNAL

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,161

BAPI_CURRENCY_CONV_TO_EXTERNAL is useful only for non-ABAP programs (it can be called by RFC). In ABAP programs, you usually don't need it because there are more efficient and shorter ABAP statements.

Read only

0 Likes
3,161

Hi Sandra,

My requirement is to display the sum of Tax-code(MWSKZ) field with values of 'D3' and 'D2' only. There are so many tax codes currently being displayed. My query is how to achieve this requirement as 'do_sum' in fieldcatalog will for columns instead of values in the field.

I hope i was able to explain you the requirement.

Please let me know incase you need for clarifications on this.

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,161

Is the question about "do_sum" or about "zeroes after decimal point"?

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,161

Can you tell us what value you have in debug for P_INTVAL and ls_ivatt-hwbas? 90.9000 and 90.900? (only number of decimals should vary)

What is the name of the variable which contains the corresponding currency code?

Thank you.

Read only

venkateswaran_k
Active Contributor
0 Likes
3,161

Hi

What is the currency you used? Is that have 3 decimals ?

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,161

Venkateswaran (Venkat) Krishnamurthy:

VND (Vietnamese dong)

0 decimal places (should be)

Read only

venkateswaran_k
Active Contributor
0 Likes
3,161

Dear Aniket

First of all you do not need to use this function - because you can handle it in ALV field catalog itself to display as Sandra mentioned. However, if you still want to use this function try to use the export parameter in sync with the data type as below.

data :     p_discur   like TCURC-WAERS,      
           p_intval   like WMTO_S-AMOUNT,
           gd_disval  like WMTO_S-AMOUNT. "Display Amount

p_discur = 'VND'.
p_intval = ls_ivatt-hwbas.

CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'
     EXPORTING
          currency        = p_discur
          amount_internal = p_intval
    IMPORTING
         AMOUNT_DISPLAY   = gd_disval
    EXCEPTIONS
         INTERNAL_ERROR   = 1
         OTHERS           = 2.


See if it works.

You can refer to this similar question - which I answered 6 years back..

https://answers.sap.com/questions/10510579/how-to-set-currency-display-format.html

Regards,

Venkat

Read only

0 Likes
3,161

Hi Venkat

I have tried this piece of code as well but still issue persists. Even i am planning to use ALV features as do_sum for summation but how can we do summation only for few taxcodes. Help me on this.

Hi Sandra,

In p_intval value i can see during debugging is 9090.9100 and in g_disval is 909091.0000. But when again assigning it back to

ls_ivat-hwbas = g_disval the value being append is 909091.00 .

So finally what i am getting as a value is 909.091,00 instead of 909.091, extra ',00' has been added after displaying. It happens for all the values. Is this happening because of using Control level statement or different amount fields?