2010 Mar 28 10:36 AM
Hi experts,
I have a problem with decimal when recording BDC for TCode VK11 as following (Unit of measure EA):
1. I recorded the BDC with Unit = 'USD' (has 2 decimals)
2. It worked fine with Unit USD or like USD (means have 2 decimals)
3. But it had problem with Unit which does not allow decimal (like JPY - Japan...)
Do we have a function module with input is Unit and output is the format of the Amount field?
Thanks,
Khanh
2010 Mar 28 10:50 AM
Hi,
This is very common problem faced in BDC programming.
What you should do is:
1Create a variable l_curr type char15.
2. Select the currency type. I assume it'sa company code currency in your case, so select the currency type from t001 based on company code.
3 Write for eg l_tab-wrbtr ( your currency field in BDC ) to l_curr CURRENCY l_ too1-werks.
This will automatically place correct currency decimals in l_curr and then pass this field in BDC currency field
Hi experts,
I have a problem with decimal when recording BDC for TCode VK11 as following (Unit of measure EA):
1. I recorded the BDC with Unit = 'USD' (has 2 decimals)
2. It worked fine with Unit USD or like USD (means have 2 decimals)
3. But it had problem with Unit which does not allow decimal (like JPY - Japan...)
Do we have a function module with input is Unit and output is the format of the Amount field?
Thanks,
Khanh
2010 Mar 28 10:50 AM
Hi,
This is very common problem faced in BDC programming.
What you should do is:
1Create a variable l_curr type char15.
2. Select the currency type. I assume it'sa company code currency in your case, so select the currency type from t001 based on company code.
3 Write for eg l_tab-wrbtr ( your currency field in BDC ) to l_curr CURRENCY l_ too1-werks.
This will automatically place correct currency decimals in l_curr and then pass this field in BDC currency field
2010 Mar 28 10:57 AM
Hi Anurag_n,
Your solution sounds good.
Could you please give me more detail or some sample code?
Thanks,
Khanh
2010 Mar 28 11:04 AM
I think it's kind of pseudo code only :)... Try it and ask me if face any problem
2010 Mar 28 11:07 AM
Hi Anurag_n,
I tried with a z program as following.
But the output is still 152 in this case because as my undestanding, the output is 152.00
Please advise:
REPORT Z_TEST.
DATA: l_curr type char15.
DATA: l_betr(132) type c.
l_betr = '152'.
Write l_betr to l_curr CURRENCY 'USD'.
WRITE l_curr.Thanks,
Khanh
2010 Mar 28 11:46 AM
My guess here is l_betr you have defined as character field. Move currency field to l_curr.
2010 Mar 28 3:11 PM
Hi Khan,
what is the data source?
If you do have Japanese Yen in the input, they probably won't have decimals. You did not tell us what kind of problem you have.
As said, you will always get correct format with WRITE TO and option CURRENCY,
anurag probably intended to suggest
WRITE tab-wrbtr TO l_curr CURRENCY l_ too1-WAERS. "WAERS is currency unit, Not WERKS, thats plantRegards,
Clemens
2010 Mar 29 2:54 AM
Hi,
You two are correct.
DATA: l_curr type char15.
DATA: lv_rate TYPE waers VALUE 'JPY'.
DATA: lv_kbetr TYPE konp-kbetr VALUE '152.12'.
Write lv_kbetr to l_curr CURRENCY lv_rate.
WRITE l_curr.The output is now 15,212
But this is not my problem, I need to clarify it once again.
In VK11, I can create more than 2 price conditions at once time.
I recorded a BDC with 2 price conditions at a time
--> the first one used USD with 2 decimals
--> the second one used JPY with 0 decimals
BUT when I call the BDC to save price conditions which has 0 decimals, it always through error 'Decimal places are not permitted'.
Could you please help me how to resolve this problem?
Thanks,
Khanh
2010 Mar 29 5:18 AM
Hi all,
I resolved my issue.
The reason: When recording BDC, I moved the cursor to Amount field first, key in then I moved the cursor to Unit field --> The amount field automatically added decimals into the amount field.
Change the position of these two fields in BDC can resolve the problem.
Thank you all for your support.
Thanks,
Khanh
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |