cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in printing amount in different currencies in adobe form

Former Member
0 Kudos

Hi All,

I have a requirement to print the amount as space for thousand seperator and comma for decimals.

I have set the pattern format such that the amount is printing in below format as required.

Locale---Italian.

Space as thousand seperator and comma as decimal seperator.

for example 1 234,45

As some of the Currencies will not have decimals, now users would like to print amount without decimals. For example in my case amount  printing in KRW ( Korean currency ) is also similar to the above format which is wrong.

for example Now amount is printing as 55 000,00. But actually it should be 550 000. Similarly for JPY currency also, as it doesnot haves decimals ( checked in TCURX table ).

I have written some logic in the interface. below is the logic.

WRITE:

    wa_mhnd1-wrshb to wa_item-wrshb CURRENCY WA_ITEM-WAERS.

*READ TABLE lt_tcurx INTO lwa_tcurx WITH KEY currkey = wa_item-waers BINARY SEARCH.

  IF sy-subrc  = 0.

  IF lwa_tcurx-currdec = '0'.

  REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.

  REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
  else.
   REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
    REPLACE ALL OCCURRENCES OF '.' in  wa_item-wrshb WITH ','.
endif.

ENDIF.


a. when the write statement gets executed amount will be in ,. ( 1,234.45 )format. Then my logic gets executed correctly. In this company code is CH10 ( EUR ) and KR10.

b. But sometimes after the write statement gets executed amount will be in ., format ( 1.234.45 ). In this case my logic works, but gives the wrong value. In this case company code is VN10 ( EUR )

In both the cases currency is EUR.

Will the decimal format change accordingly based on the company code code currency.Can anyone please tell me why write statement behaved differently.

Do I need to change any locale in the adobe form, or any other logic to be written in interface. ?  I am trying it out from long time, but not able to fix it. I will have to fix it ASAP.

Can anyone kindly please help me how to achieve this ?

Thanks and Regards,

Karthik Ganti.

Accepted Solutions (0)

Answers (1)

Answers (1)

ayan_chakraborty
Explorer
0 Kudos

Hi Karthik,

In such scenarios I would suggest to do all kinds of modifications on the currency field at the print program / interface and then pass the variable as a character field to the adobe form. So I think there is no need to change any local setting in the form itself.

Try using CASE / ENDCASE with the operand as the currency key as it will make it more specific.

The default format of a currency field will be in the format 1234.56

Thus you can put a logic accordingly based on your requirement.

Former Member
0 Kudos

Hi Ayan,

Thanks for your reply.

I have already made the locale to default in adobe form and tried. In the interface I have written the logic to print the amount in particluar currency.

WRITE:

    wa_mhnd1-wrshb to wa_item-wrshb CURRENCY WA_ITEM-WAERS.

*READ TABLE lt_tcurx INTO lwa_tcurx WITH KEY currkey = wa_item-waers BINARY SEARCH.

  IF sy-subrc  = 0.

  IF lwa_tcurx-currdec = '0'.

  REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.

  REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
  else.
   REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
    REPLACE ALL OCCURRENCES OF '.' in  wa_item-wrshb WITH ','.
endif.

ENDIF.

I dont know why the above write statement is behaving differently. In one case the value is shown as 1,234.00, but in another test case it shows 1.234,00.

In both the test cases the currency is 'EUR'. In case if the above write statement works correctly, my issue will be solved.

Can anyone tell me why the write statement is behaving differently. Will the currency be dependent on any other factor ( for example company code,customer )

I would like to fix this ASAP.

Thanks and Regards,

Karthik Ganti.

ayan_chakraborty
Explorer

Hi Karthik,

First of all in table TCURX I guess you will not find any entry for EUR. So move out from your current logic.

My suggestion to you would be like this :-

1. First you have to know the country where the form is going to be printed.

2. Use the command SET COUNTRY followed by that country initials which you would probably be having in a variable. Please use this somewhere before you execute point 4.

3. Declare a variable, suppose, VAR1 of type P and Decimals 2.

4. Move WA_ITEM-WRSHB into this variable VAR1.

5. WRITE VAR1 to VAR2 where VAR2 is of character type of any desired length, lets say 20.  You can do all sorts of decimal notation arrangements in this variable VAR2. Print this VAR2 in the form output.

Former Member
0 Kudos

Hi Ayan,

Thanks for your response.

I will be printing the Form for around 15 countries. SET COUNTRY logic would be tidious I guess.

I have also tried with Point 3,4,5 as you have mentioned above. Unfortunately it dint work. Also If I declare the variable type P, the value would be rounded off, will not get the exact value.

Finally I could do it after doing some trial and error on finding string length and then using repalce statements. As the development delivery date is approaching nearer, I have used this logic.But generally as I mentioned it should work with Write statement using currency. I am still wondering why it is not working with it.

Thanks and Regards,

Karthik Ganti.