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 routine external->internal for MENG13 fields

Former Member
0 Likes
2,470

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,653

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,653

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

Read only

0 Likes
1,653

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

Read only

Former Member
0 Likes
1,654

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

Read only

0 Likes
1,653

Hi Ravi,

that works great! Thanks a lot, points awarded!

Regards

Jan Hempel