Sie sind auf Seite 1von 7

9/21/2017 Currency format in Write statement - Beginner's SAP

ABAP Blog ABAP Course Career Tips About Contact Me Students Students
Work Login

Currency format in Write statement

Shares

One of my SAP clients has customers from all across the globe. While
most of their customers are primarily based out of North America and
Europe, some of them are from Japan, China and Korea.

The client issues purchase order to their customers on a monthly basis


and these have been developed using Smart Forms. (Yes I know.. old
technology but still works).

http://www.beginners-sap.com/currency-format-in-write-statement/ 1/7
9/21/2017 Currency format in Write statement - Beginner's SAP

Anyway, the idea is that for all these countries the same smartform is
used to generate the PO. Off course this the beauty of the SAP system
that you can generate invoices for all countries with just one form
template, if your business processes are standardized.

However on a particular day, this particular customer rejected to make a


payment citing reasons that the amount quoted on the document was
incorrect. On drilling back, all the numbers matched to the dot ..why then
did the customer refuse payment ?

We regenerated the customer PO and realized our mistake.

The customer was from Japan and unlike, USD, EUR and INR, the
Japanese Currency Yen does not have decimal places.

So USD uses 2 decimals to denote cents as in $25.10


EUR uses 2 decimals to denote €25.10
INR uses 2 decimals to denote paise as in ₹25.10

But JPY ( Japanese Yen ) does not have decimal places. Its just ¥2510

(The currency exchange rate is not being considered in this example only
the decimal notation is what is being talked about).

However in the smart form only a generic statement was used to move
the amount to the output field

WRITE <KOMVD>-KWERT TO GV_KWERT_IN_DOC_CUR.

This would simply move the amount in the field <KOMVD>-KWERT to the
output field GV_KWERT_IN_DOC_CUR which would be shown straight
out on the form. This however would not take care of Country Currency
code. So the yen amount would be printed out as 25.10 and not as 2510
for example, and thus confuse the customer.

http://www.beginners-sap.com/currency-format-in-write-statement/ 2/7
9/21/2017 Currency format in Write statement - Beginner's SAP

To take care of this issue I simply changed the code to the following

WRITE <KOMVD>-KWERT CURRENCY IS_EKKO-WAERS TO


GV_KWERT_IN_DOC_CUR.

Based on the country for which the PO is generated the field IS_EKKO-
WAERS will carry the appropriate Currency code ( USD, EUR, JPY ) etc
and the WRITE statement takes this Currency code into consideration
before writing it to gv_kwert_in_doc_cur.

Here is what we find from SAP Help

When you use the CURRENCY format extension in a write statement the
program looks for the given Currency type in the table TCURX column
CURRKEY. In case, it finds the entry there then the system uses the
number of decimal places as specified in column CURRDEC. For JPY
you will find an entry here with 0 decimal places. However no entry exists
here for USD, EUR, INR. Hence for these currency the system uses the
default 2 decimal places.

http://www.beginners-sap.com/currency-format-in-write-statement/ 3/7
9/21/2017 Currency format in Write statement - Beginner's SAP

So Question : What are the possible values for Currency Codes that we
can use in the CURRENCY format extension ?

Answer : The possible options can be found in the column WAERS of


database table TCURC in uppercase letters.

This simple tweak to the Write statement in the SmartForm resolved the
issue and the Invoice was cleared, Payed, closed and they lived happily
ever after.

Thats all for today’s short story!! Hope you liked it. Please share and like
and comment if you have encountered any such situations of your own.
Would love to hear your opinions and experiences.

For more info on this topic visit this link on sap help.

Shares

http://www.beginners-sap.com/currency-format-in-write-statement/ 4/7
9/21/2017 Currency format in Write statement - Beginner's SAP

One Comment

abrar April 4, 2017 at 1:13 pm

do you have any blogs to understand field symbols.


please let me know

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Post Comment

http://www.beginners-sap.com/currency-format-in-write-statement/ 5/7
9/21/2017 Currency format in Write statement - Beginner's SAP

Learn how to Implement


OData Service + SAPUI5 - in
this End to End Guide

Download your Free Copy - To


learn about Implementing
OData Service and SAPUI5
Application

Email Address*

Name

* = required field

Download

powered by MailChimp!

Hello, my name is Linkin


Pereira. I am an SAP

http://www.beginners-sap.com/currency-format-in-write-statement/ 6/7
9/21/2017 Currency format in Write statement - Beginner's SAP

Consultant and like many of my


colleagues I am passionate
about SAP. I share my passion
for the technical and functional
aspects of SAP through this
blog. Check out the Posts and
leave your comments on
whatever areas you liked. Your
suggestions are always
welcome!! Have Fun.

Copyright © 2017 Beginner's SAP.


Theme by Linkin Pereira.

http://www.beginners-sap.com/currency-format-in-write-statement/ 7/7

Das könnte Ihnen auch gefallen