11-20-2007 8:35 AM
Hi Guru,
I am using a BDC to park the Vendor invoice there I am internally calculating some tax amount in that decimal amounts are shown by period based upon my user profile settings.
So I need a FM to change the amount decimal point seperator to 'Comma(22,99)' to 'Period(22.99)' vice versa based on user profile settings.
Please help me on this
Regards
Paul
11-20-2007 8:37 AM
Instead FM Use Replace Key word..
Replace '.' with ',' into v_var.
Message was edited by:
Vishnu Reddy
11-20-2007 8:42 AM
I need FM only so that it will change in accordance with User profile setting.
11-20-2007 8:40 AM
Use following code
REPLACE ALL OCCURRENCES OF ',' IN: w_num1 WITH '.'.
11-20-2007 8:42 AM
Hi,
Better to use replace statement
Ex.
DATA: c4(4) TYPE C.
c4 = '12,345'.
REPLACE ALL OCCURRENCES OF ',' IN c4 WITH '.'
Reward Points
Regards,
Prashant
11-20-2007 8:44 AM
Sugest me any FM so that it will change in accordance with User profile setting.
11-20-2007 8:46 AM
there is no such FM for it...
you can use REPLACE and develope your own FM to handle the decimal notation change as per user profile
take following code for reference...
FORM f_convert_num CHANGING ch_num.
DATA : w_dcpfm LIKE usr01-dcpfm,
w_num1(30) TYPE c,
w_off TYPE i.
*FIELD_NUM = 1,233.50 OR FIELD_NUM = 1.233,50 OR FIELD_NUM = 1 233,50
****************************************
MOVE ch_num TO w_num1.
SELECT SINGLE dcpfm
FROM usr01
INTO w_dcpfm
WHERE bname EQ sy-uname.
IF sy-subrc EQ c_zero.
ENDIF.
IF w_dcpfm EQ c_checked.
REPLACE ALL OCCURRENCES OF c_comma IN: w_num1 WITH c_blank.
ELSEIF w_dcpfm EQ c_blank.
REPLACE ALL OCCURENCES OF c_dot IN: w_num1 WITH c_hash.
REPLACE ALL OCCURENCES OF c_comma IN: w_num1 WITH c_dot.
REPLACE ALL OCCURENCES OF c_hash IN: w_num1 WITH c_comma.
REPLACE ALL OCCURRENCES OF c_comma IN: w_num1 WITH c_blank.
ELSEIF w_dcpfm EQ c_yes.
TRANSLATE w_num1 USING c_commadot.
CONDENSE w_num1.
TRANSLATE w_num1 USING c_spacecomma.
FIND c_dcomma IN w_num1 MATCH OFFSET w_off.
w_off = 30 - w_off.
SHIFT w_num1 BY w_off PLACES RIGHT.
REPLACE ALL OCCURRENCES OF c_comma IN: w_num1 WITH c_blank.
ENDIF. "End of w_dcpfm check
CONDENSE w_num1.
MOVE w_num1 TO ch_num.
ENDFORM. " f_convert_num
12-27-2007 4:49 AM
Hi Sharayu,
I saw this your function, it's useful for me, now I met with difficulties this problem. But it also have some error at c_zero,c_check ... What is it !? Pls help me ... Thanks for all help.
12-27-2007 5:36 AM
all the c_ fields are constants...
e.g.
c_space = ' '
c_check = 'X'
c_yes = 'Y'
just replace all the constants with the symbol literals that name signifies