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

Conversion exit: numbers in database, two decimals on screen

Jarmo_Tuominen
Participant
0 Likes
3,654

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,761

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,762

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

Read only

Former Member
0 Likes
1,761

Hi Jarmo,

AS Amit said use the conversion exit which is there in Domain,

that will solve your Problem...

regards

vijay

Read only

former_member186741
Active Contributor
0 Likes
1,761

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?

Read only

former_member186741
Active Contributor
0 Likes
1,761

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

Read only

0 Likes
1,761

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

Read only

0 Likes
1,761

Hi Jarmo,

no problem... I'm still not convinced that in this case you need a conversion exit.

Regards

Neil