2005 Dec 03 11:23 AM
Hi,
I need to save a numeric value in database containing only numbers. At the same time I need to display the value on a screen with two decimals. For example, the value of "12" should be saved in database as "1200", and it should be displayed on a screen like "12,00" (or "12.00", depending on user decimal settings). Furthermore, when user enters either a value of "12" or "12,00" on the screen and press enter, the program should display the value as "12,00" in both cases.
Therefore, I created a domain and added a conversion routine to it. This routine performs the conversion from display format to internal format and vice versa.
However, after trying with several options with MOVE and WRITE input TO output DECIMALS 2 statements and with different data types with different decimals places, I haven't been able to do this conversion.
I am a bit frustrated, since this task is rather simple. Is there a standard function module doing this conversion? What is the best and most efficient way to do this conversion?
I have also find the following standard function modules:
- CONVERSION_EXIT_QUANT_INPUT and CONVERSION_EXIT_QUANT_OUTPUT
- CONVERSION_EXIT_DEC_3_INPUT and CONVERSION_EXIT_DEC_3_OUTPUT
Regards,
Jarmo Tuominen
2005 Dec 03 11:27 AM
Hi Jarmo,
1. I don't whether i understood ur query properly!
2. U said u used a conversion routine in domain.
3. U can use the same routine(xxxxxx)
(Say xxxxx is the name of conversion routine
u specified in the domain)
Now u can use the Function Module
CONVERSION_EXIT_xxxxx_INPUT
CONVERSION_EXIT_xxxxx_OUTPUT
in your programs for WRITE Purpose.
I hope it helps.
Regards,
Amit M.
Message was edited by: Amit Mittal
Hi,
I need to save a numeric value in database containing only numbers. At the same time I need to display the value on a screen with two decimals. For example, the value of "12" should be saved in database as "1200", and it should be displayed on a screen like "12,00" (or "12.00", depending on user decimal settings). Furthermore, when user enters either a value of "12" or "12,00" on the screen and press enter, the program should display the value as "12,00" in both cases.
Therefore, I created a domain and added a conversion routine to it. This routine performs the conversion from display format to internal format and vice versa.
However, after trying with several options with MOVE and WRITE input TO output DECIMALS 2 statements and with different data types with different decimals places, I haven't been able to do this conversion.
I am a bit frustrated, since this task is rather simple. Is there a standard function module doing this conversion? What is the best and most efficient way to do this conversion?
I have also find the following standard function modules:
- CONVERSION_EXIT_QUANT_INPUT and CONVERSION_EXIT_QUANT_OUTPUT
- CONVERSION_EXIT_DEC_3_INPUT and CONVERSION_EXIT_DEC_3_OUTPUT
Regards,
Jarmo Tuominen
2005 Dec 03 11:27 AM
Hi Jarmo,
1. I don't whether i understood ur query properly!
2. U said u used a conversion routine in domain.
3. U can use the same routine(xxxxxx)
(Say xxxxx is the name of conversion routine
u specified in the domain)
Now u can use the Function Module
CONVERSION_EXIT_xxxxx_INPUT
CONVERSION_EXIT_xxxxx_OUTPUT
in your programs for WRITE Purpose.
I hope it helps.
Regards,
Amit M.
Message was edited by: Amit Mittal
2005 Dec 03 11:31 AM
Hi Jarmo,
AS Amit said use the conversion exit which is there in Domain,
that will solve your Problem...
regards
vijay
2005 Dec 03 11:40 AM
Hi Jarmo,
when you say the conversion doesn't work, can you give some examples of the failures? I can't check on a system at the moment but from memory, on all the screens I've ever dealt with having decimals the variables have either been have quantity or currency related and as such had attached currencies or Uom's and SAP seems to take care of the decimal place on these automatically. Maybe you could use a pseudo currency to try and trick SAP?
2005 Dec 05 1:50 AM
Hi Jarmo,
I have had a play with this and I don't think you need to do any conversion. The way SAP standard works is as you require. I added a packed variable to a screen and it displayed with decimals but accepted integers as input, i.e I could enter 12 or 12.00 and it was fine.
Regards
Neil
2005 Dec 05 10:42 AM
Hi Neil,
Thanks for your answer. I found from SAP Help http://help.sap.com/saphelp_470/helpdata/en/cf/21ee19446011d189700000e8322d00/frameset.htm example domain S_DURA where conversion routine is defined. I just followed the same idea in my conversion routine, and now it works.
Regards,
Jarmo
2005 Dec 05 10:20 PM
Hi Jarmo,
no problem... I'm still not convinced that in this case you need a conversion exit.
Regards
Neil
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |