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

Excel upload: value notation convertion

rt50896
Participant
0 Likes
601

Hi all,

When we use FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' to upload Excel file directly, the value may have more than one

format:

eg. 1,234,567.88 or 1 234 567,88

Is there any function can convert value to internal format(1234567.88) which by user profile setting?

if not, any way to recognize the decimal notation is comma(,) or dot(.)?

Tks!

1 REPLY 1
Read only

Former Member
0 Likes
545

Try this

DATA: lv_value TYPE string,
            lv_dcpfm TYPE usr01-dcpfm.

lv_value = |1,234,567.89|.

SELECT SINGLE dcpfm
        INTO lv_dcpfm
        FROM usr01
        WHERE bname = sy-uname.

IF lv_dcpfm EQ 'X'.
   REPLACE ALL OCCURRENCES OF ',' IN lv_value WITH ''.
ELSEIF lv_dcpfm EQ ''.
   REPLACE ALL OCCURRENCES OF '.' IN lv_value WITH ''.
   TRANSLATE lv_value USING ',.'.
ELSEIF lv_dcpfm EQ 'Y'.
   TRANSLATE lv_value USING ',.'.
ENDIF.