Converting char into dec

Dear all,
I have data as char for example: 3,52 as char, when i try to transform data directly into key figure as number dec, it gives error message saying: it can not be interpreted as number..
Is there any easy way to convert data into number?
thanks

Hello John,
First, I would try to replace comma sign in your char into dot, in abap routine, using REPLACE statement. According to what you wrote - 3.52 it returns 3,52 ok - it could work. After that, you can use formula to change it into number, if needed.
Regards,
Peter

Similar Messages

  • Convert char to dec

    Dear all ,
        I have to convert char to dec , my requirement is to covert  12344434 to 123444.34 .
    note i don't want 12344434 to 12344434.00 .
    Thanks in advance
    Debesh

    You can try like this.
    DATA : v_tot_len TYPE i,
            v_off_len TYPE i.
    DATA : v_off_text(50) TYPE c,
            v_dec_text(2)  TYPE c,
            v_fin_text(50) TYPE c.
    PARAMETERS : p_input TYPE text20 OBLIGATORY.
    START-OF-SELECTION.
    v_tot_len = STRLEN( p_input ).
    v_off_len = v_tot_len - 2.
    v_off_text = p_input+0(v_off_len).
    v_dec_text = p_input+v_off_len(2).
    CONCATENATE v_off_text v_dec_text INTO v_fin_text SEPARATED BY '.'.
    Here I am inputting the text to be converted.

  • Convert char to dec/amount

    Hi,
    I need to move the data(1,334.25) to a decimal field....(1334.25)
    If i move directly i am getting an exception.
    Can you let me know if there is any FM to convert the char to num without removing decina

    Hi,
       Please use the following code, it will solve your problem.
    data: i(8) type c,
         o type p decimals 2.
    i = '1,334.25'.
    replace ALL OCCURRENCES OF ',' in i with space.
    *CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input         = i
    IMPORTING
      OUTPUT        = i
    move i to o.
    write o.

  • Convert char into key figure

    hi friends,
    i have a requirement where i have to convert a character into keyfiigure. it means the flat file has a data 'NA' , but i have to convert into key figure.i can able to load the data intlo PSA but when i tried to load into a DSO its getting failed. Can you please tel me do i have to write a routine , if so what routine and share your code please.
    Thanks all.

    Dolly,
    Its a simple code, write a field level routine like this:
    IF SOURCE_FIELDS - KF1  = 'NA'
    RESULT = 0.
    ELSE
    RESULT = SOURCE_FIELDS-KF1
    ENDIF
    In Field level routine you would see some portion of code appears automatically there you can find ' RESULT = '. Put this code there.
    KF1- Refers to that field where you are bringing in NA from aflat file.
    If you are new to writing routine in BW refer this article, you would get some idea on how to start:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/609eea32-455e-2c10-c08a-c23adf8c934e?quicklink=index&overridelayout=true
    Hope it helps
    Regards
    Raj rai
    Edited by: Raj Rai on Aug 5, 2011 9:02 AM

  • Need to convert values into coma separated

    Need to convert values into coma separated
    I have a string value that stores data like 'NYK,IND,SGP,GER'
    FOR EXAMPLE
    V_CITY_CODE = 'NYK,IND,SGP,GER'
    When I query
    select * from city where city_code = V_CITY_CODE;I get no rows, this is because V_CITY_CODE has all city code as single code.
    I need a function to search , and replace with ','.
    I tried using instr and replace but was unable to convert it.
    could some one pls assist me.
    thanks in advance
    Saz

    Looking for this?
    SQL> select * from emp
      2  /
         EMPNO     DEPTNO ENAME                                 SAL DOJ       JOB
             1          1 Karthick                               80 03-DEC-11
             2          1 Karthick_1                             90 23-NOV-11
             3          2 Ram                                    80 03-DEC-11
             4          2 Ram_1                                  90 23-NOV-11
    SQL> var v_ename varchar2(1000)
    SQL> exec :v_ename := 'Karthick,Karthick_1'
    PL/SQL procedure successfully completed.
    SQL> select *
      2    from emp
      3   where ename in (
      4                     select regexp_substr(val, '[^,]+', 1, level)
      5                        from (select :v_ename val from dual)
      6                    connect by level <= length(val) - length(replace(val, ','))+1
      7                  ) 
      8  /
         EMPNO     DEPTNO ENAME                                 SAL DOJ       JOB
             1          1 Karthick                               80 03-DEC-11
             2          1 Karthick_1                             90 23-NOV-11

  • Convert char to currency

    Hi all,
    i searched alot but couldn't find solution.
    i have l_value char(45) field value has 4560
    I need to convert this into vbak-netwr field in sales order user exit MV45AFZZ
    when i assign vbak-netwr = l_value.
    I am getting 45.60 in vbak-netwr field.
    when i try same login in report progam it is working fine but not in user exit.
    any suggestions?
    Giri

    Sample program to convert Char to Curr.
    data: curr type kna1-umsa1,
          char(254) type c.
    data: temp type p length 15 decimals 2.
    char = '1,405.25'.
    REPLACE ALL OCCURRENCES OF '.' IN char WITH space.
    REPLACE ALL OCCURRENCES OF ',' IN char WITH space.
    CONDENSE char NO-GAPS.
    temp = char.
    curr = temp / 100.
    write: 'CHAR = '.
    write :/ char.
    write:/ 'CURR = '.
    write: curr.
    << Removed by moderator >>
    Regards,
    Uttam Agrawal
    << Removed by moderator >>
    Edited by: uttamagrawal on Feb 22, 2011 9:21 AM
    Edited by: Neil Gardiner on Feb 22, 2011 9:01 PM

  • Convert CHAR to INT4

    Hi,
    Is there any FM that allowes you to convert a variable type char into another one type int4?
    I am working on SAP version 4.6C and haven't been able to find any except for 'CHAR_NUMC_CONVERSION' and 'MOVE_CHAR_TO_NUM', but none of them work with int4 type variables.
    I also tried to pass the value directly like this "int4 = char", but i got a dump since the char variable contains ','. And in this sap version there no "replace all occurences of..." so i really cant replace all the comas.
    Any answers will be appreciated.
    Regards,
    Roberto

    I did it like this:
      data: num type p.
      condense char no-gaps.
      call function 'MOVE_CHAR_TO_NUM'
           exporting
                chr             = char
           importing
                num             = num
           exceptions
                convt_no_number = 1
                convt_overflow  = 2
                others          = 3.
      int4 = num.
    Regards,
    Roberto

  • Convert Char to Date format - Evaluate

    Hi,
    Could anyone provide us the Evaluate formula to convert Char to Date format
    2009-06-20 should be converted to 06/20/2009
    Regards,
    Vinay

    Hi,
    Refer the below threads...
    Re: How to convert string to date format?
    how to convert character string into date format????
    Regards,
    Chithra Saravanan

  • Convert char to quantity

    Hi there,
    Do you know if there's any standard function module which converts a char into a field of type quantity? or, if there isn't any, do you know if it is possible to show in a table control field the value 0,000 when no quantity is introduced by the user and the field is set as modificable and as field of type quan instead of char?

    FUNCTION Z_CONV_POINT_TO_COMMA.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(NUM1)
    *"  EXPORTING
    *"     VALUE(STR1)
    data:i type i,
         length type i,
         stest(16),
         sakt(1).
    stest = num1.
    length = strlen( stest ).
    while i < length.
    sakt = stest(1).
    if sakt = '.'.
    sakt = ','.
    endif.
    shift stest.
    concatenate str1 sakt into str1.
    i = i + 1.
    endwhile.
    ENDFUNCTION.

  • How to convert char(1) to int32 datatype in pl/sql

    Hello,
    I am trying to convert char(1) to an integer data type to be put into an int32 variable in C#. I tried several options such as TO_NUMBER ,CAST(.. AS INTEGER), and CAST(.. AS SMALLINT) but they all return int64.
    Is there a way to ensure the casting into a datatype that is compatible with int32 ?
    Thanks

    Oracle's SQL Datatypes are limited to NUMBER, BINARY_FLOAT and BINARY_DOUBLE.
    There's a few others through PL/SQL including BINARY_INTEGER.
    If you look in USER_ARGUMENTS you can see it is defined slightly differently.
    Don't know whether / how .Net infers datatypes, but it is worth a shot.
    create or replace function v (p number) return  binary_integer is
    begin
    return p;
    end;
    /

  • Converting char to decimal value format as defined in SU3(User profile)

    Hi Techies,
    Is there any FM to convert CHAR value into Decimal fomat as defined in SU3.
    If we use, WRITE statement for printing the value in decimal format , it shows the value in decimal format correctly
    in SU3 transaction , there are three different decimal format notations which can be user specific
    I would appreciate your valuable inputs ....
    Thanks
    Santhosh

    This is my code in a generic method to transform a table into a csvrow
    when 'P'.
            tmpstr = <p_field>.
            len = strlen( tmpstr ) - 1.
            tmpstr = tmpstr+0(len).
            if <p_field> < 0.
              sign = '-'.
            else.
              sign = ' '.
            endif.
            case decimalformat.
              when 'X' or 'E'.
                split tmpstr at '.' into int frac.
                ptmp = int.
                write ptmp to cp.
                shift cp left deleting leading space.
                replace all occurrences of '.' in cp with ','.
                concatenate
                  s
                  sign
                  cp
                  frac
                  delimiter
                into s in character mode.
              when 'Y' or 'D'.
                split tmpstr at '.' into int frac.
                ptmp = int.
                write ptmp to cp.
                shift cp left deleting leading space.
                replace all occurrences of ',' in cp with '.'.
                concatenate
                  s
                  sign
                  cp
                  frac
                  delimiter
                into s in character mode.
              when ' '.
                concatenate s sign tmpstr delimiter into s in character mode.
              when others.
                concatenate s '????????' delimiter into s in character mode.
            endcase.
    where pfield is a fieldsymbol type P. (honestly ist from type any, but determined by RTTI). I needed this cause i want to format the value from "outside" without taking the user settings in consideration as write...to.. is doing.
    What i'm doing is to use the write... to... clause modifying the result (change decimal point, thousand separator and sign) according to the demanded decimal notation.
    Edited by: Rainer Hübenthal on Oct 7, 2009 4:47 PM

  • Jax B converts 'r' into '\n'

    Greetings,
    My xml file contains special chars such as '\r'.
    JAXB converts \'r' chars into '\n' while reading xml file.
    I am reading the values into String variables.
    How can Prevent that.
    Do I need to change the variable type in my XSD.
    Your help is appreaciated.
    -Prasad

    Here's a link to the XML Recommendation. (That's the document that defines how XML works.)
    http://www.w3.org/TR/REC-xml/
    Look at section 2.11 and you will see that JAXB, like every other application that processes XML, is required to do that.

  • How to convert rows into columns

    Hi,
    How to convert rows into columns of two different tables.
    These two tables have two common columns namely (shipline,pos).
    Let me know if we have any built in functions to do this.
    thank you very much .
    Edited by: 808542 on Dec 7, 2010 8:35 PM
    Edited by: 808542 on Dec 7, 2010 8:37 PM

    Have you tried this first?
    http://forums.oracle.com/forums/search.jspa?threadID=&q=row+to+column&objID=f75&dateRange=last90days&userID=&numResults=15&rankBy=10001

  • Cannot be converted in type DEC,CURR - longtext

    Dear,
    When we are loading the data to the targets, we are getting the errors in the Transfer rules like mentioned bellow
    Info source 0EC_CS_1 (Transaction Data for Consolidation)
    Status (tab) :
    Technical : Collection in source system ended
    Processing Step : Processing End
    Details (tab):
    Processing end : Errors occurred
    Error records written to application log
    Error in an arithmetic operation in record 1
    Record 1 :Contents 00 0.0000000 from field PCNT1 cannot be converted in type DEC ->longtext
    Info source 0CO_OM_CCA_9 (Cost Centers: Actual Costs with Delta E)
    Record 39952:Contents 048624.95- 1 from field SWF cannot be converted in type CURR ->longtext
    Kindly help.
    Thanks & Regards,
    Kiran A
    Edited by: Kiran A on Mar 21, 2010 10:23 AM
    Edited by: Kiran A on Mar 21, 2010 11:36 AM

    Hi,
                   It is sure some where in transferrules the mapping wasdone wrongly , like char --char of info object but in ur case some where data element is not same for field and info object.
      check throughly transfer rules correctly field level and infoobject mapping  and activate.
    it is some where currency and unit fields the difference is there for data elements
    Thanks&Regards,
    Sathish
    Edited by: sathish kakumudi on Mar 21, 2010 4:01 PM

  • Convert char cloumn to binry

    how can i convert char to binary

    Can you provide a bit more context?
    Are you trying to change the definition of a column in a table? Or are you trying to cast a particular value from a table into a binary value in PL/SQL?
    How much data are we talking about?
    Have you looked at the UTL_RAW.CAST_FROM_<<data type>> functions? Is that what you're looking for?
    Justin

Maybe you are looking for