2007 Apr 13 12:45 PM
Hi,
I'm looking for a possibility to convert a number of type MENG13 from external (text) to internal format.
It is important, that the decimal notation of the input differs from country to country or even from user to user, and I need to consider this!
Example:
for input in english decimal notation:
123,456,789.12 should be converted to 123456789.120
456,789 should be converted to 456789.000
for input in german decimal notation:
123.456.789,12 should be converted to 123456789.120
456.789 should be converted to 456789.000
What I need is exactly what happens, if you input a number into a dynpro field with reference to a dataelement with underlying domain MENG13.
But I was not able to find a safe method to implement this behaviour. I could also not find a conversion_exit or some function module...
Any ideas?
Thanks in advance
Regards
Jan Hempel
2007 Apr 13 12:55 PM
Here lv_meng must be a character type variable
SElect single DCPFM from USR01 into v_DCPFM where BNAME = sy-uname.
if sy-subrc = 0.
if v_dcpfm = space.
lv_meng = v_meng13.
Replace all occurances of '.' with '' in lv_meng.
Replace all occurances of ',' with '.' in lv_meng.
endif.
if v_dcpfm = 'X'.
lv_meng = v_meng13.
Replace all occurances of ',' with '' in lv_meng.
endif.
if v_dcpfm = 'Y'.
lv_meng = v_meng13.
Replace all occurances of ' ' with '' in lv_meng.
Replace all occurances of ',' with '.' in lv_meng.
endif.
endif.
Regards,
Ravi
Hi,
I'm looking for a possibility to convert a number of type MENG13 from external (text) to internal format.
It is important, that the decimal notation of the input differs from country to country or even from user to user, and I need to consider this!
Example:
for input in english decimal notation:
123,456,789.12 should be converted to 123456789.120
456,789 should be converted to 456789.000
for input in german decimal notation:
123.456.789,12 should be converted to 123456789.120
456.789 should be converted to 456789.000
What I need is exactly what happens, if you input a number into a dynpro field with reference to a dataelement with underlying domain MENG13.
But I was not able to find a safe method to implement this behaviour. I could also not find a conversion_exit or some function module...
Any ideas?
Thanks in advance
Regards
Jan Hempel
2007 Apr 13 12:50 PM
Hi,
Search for a domain with that format and use it.
Other wise create a domain with that format and move the data into that field
regards,
Anji
2007 Apr 13 1:23 PM
Hi Anji,
just moving the data into a field of the desiredt type does not work, because no conversion occurs in taht case. It will instead raise a number-conversion shortdump.
regrads
Jan Hempel
2007 Apr 13 12:55 PM
Here lv_meng must be a character type variable
SElect single DCPFM from USR01 into v_DCPFM where BNAME = sy-uname.
if sy-subrc = 0.
if v_dcpfm = space.
lv_meng = v_meng13.
Replace all occurances of '.' with '' in lv_meng.
Replace all occurances of ',' with '.' in lv_meng.
endif.
if v_dcpfm = 'X'.
lv_meng = v_meng13.
Replace all occurances of ',' with '' in lv_meng.
endif.
if v_dcpfm = 'Y'.
lv_meng = v_meng13.
Replace all occurances of ' ' with '' in lv_meng.
Replace all occurances of ',' with '.' in lv_meng.
endif.
endif.
Regards,
Ravi
2007 Apr 13 1:47 PM
Hi Ravi,
that works great! Thanks a lot, points awarded!
Regards
Jan Hempel
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |