‎2009 Sep 22 6:44 AM
Hi,
i would like to convert a packed decimal to character variable, but i dont want to use the users profil defaults, i would like to choose whether i'm getting
1.234,56
or
1,234.56
so WRITE TO is not an option (or i missed a parameter somewhere) and i'm unable to find a function module/method where the decimal notation is X or Y.
‎2009 Sep 22 7:01 AM
‎2009 Sep 22 7:12 AM
You misunderstood me, i dont wanna know the users defaults, i want to convert indepent from those values.
‎2009 Sep 22 7:12 AM
Hi ,
Try the following FM;
CALL FUNCTION '/OSP/GET_DECIMAL_NOTATION'
EXPORTING
i_uname = 'SAPUSER'
IMPORTING
ET_RETURN =
EV_DECIMAL_NOTATION = lv_dec_not
EV_TEXT = lv_text .
When i executed;
lv_dec_not returned 'X' and
lv_text returned 1,234,567.89
Regards,
Vijay
‎2009 Sep 22 7:12 AM
I had a bit like requirement, and I dealt with ABAP code. Even I wasnu2019t able to find a right FM for that, thus Iu2019ve done with a bit mixture of ABAP code and FM
Below is the code snippet,Please Have a look.
SELECT SINGLE * FROM usr01 WHERE bname = sy-uname.
IF sy-subrc = 0.
CASE usr01-dcpfm.
WHEN ' '.
FIND ',' IN in_par-value.
IF sy-subrc = 0.
REPLACE ',' WITH '.' INTO in_par-value.
ENDIF.
MOVE in_par-value TO i_kurrf.
WHEN 'X'.
FIND ',' IN in_par-value.
IF sy-subrc = 0.
REPLACE ',' WITH '.' INTO in_par-value.
ENDIF.
CALL FUNCTION 'MOVE_CHAR_TO_NUM'
EXPORTING
chr = in_par-value
IMPORTING
num = i_kurrf
EXCEPTIONS
convt_no_number = 1
convt_overflow = 2
OTHERS = 3.
WHEN OTHERS.
FIND ',' IN in_par-value.
IF sy-subrc = 0.
REPLACE ',' WITH '.' INTO in_par-value.
ENDIF.
MOVE in_par-value TO i_kurrf.You may alter this code according to you.
Cheers
‎2009 Sep 22 7:14 AM
‎2009 Sep 22 7:19 AM
Where in the edit mask can i put the notation i would like to be used? Besides that, i was unable to find a edit mask which will work for every p typed varaible.
‎2009 Sep 22 7:16 AM
data num type p decimals 2.
data str type string.
num = '3141.59'.
call some_function_module exporting notation = 'X' num = num importing str.
Depending on the notation X or Y or blank i would like to get
3.141,59 or 3,141.59. I'm searching for such a function module.
‎2009 Sep 22 7:53 AM
> Depending on the notation X or Y or blank i would like to get
> 3.141,59 or 3,141.59. I'm searching for such a function module.
That's the same thing I have done in my code above.
Why not you go with ABAP code instead of FM(Since yet we donu2019t able to find the exact FM)? Or is there any chance to create your own Z Function module which consist the above code inside the FM?
Cheers
‎2009 Sep 22 7:59 AM
Sorry our postings did overlap so i wasnt aware of yours...
i guess in_par-value is c based variable? Where did you find that snippet? SAP Standard?
‎2009 Sep 22 8:50 AM
Yep, In_par-value is C based.
And itu2019s not an SAP standard Snippet. I wrote this code from my left hand in one of the Subroutines of SAP Script.
Cheers
‎2009 Sep 22 9:17 AM