How to convert char to curr ?

Hi gurus.
Forgive me for the silly question.
I have a problem with data conversion from char to curr with 2 decimal places.
This is the scenario, I have a Z transaction which receives an excel file containing data from invoices and when the field contains a value such as 35,0 the program records the value 3.50 in the destination variable. But when the value is 35,45, it works.
Here is the piece of code:
WHEN '0007 '.
        TRANSLATE USING ITAB-VALUE. " '.
        ITAB-VALUE USING TRANSLATE',.'.
        CONDENSE ITAB-VALUE NO-GAPS.
        WA_OPER_MENORES-VL_BRUTO = ITAB-VALUE.
If I format the column in the excel file for numeric value with 2 decimal places also works, because when the value is formatted 35,0 change to 35,00. But I can not tell all the users hey formatt your files before upload to SAP.
To test I generate a simple report that reads the excel file and makes the conversion of the columns, like the code above, so I had no problems. I think there should be some configuration that has been changed in the transaction, but I'm new in ABAP, I come from "Java World" and I have no idea that could be.
I could just use a quick and dirty solution, adding a zero at the end of the column, when there is the 2 decimal places, but I prefer a clean solution.
Guys, is there any function module or class that does that kind of data conversion? If not, you could tell me what is the best practice to solve this problem?
thank you very much,
Ronaldo S. Vieira

Follow this example to convert Char to Curr and Vice-Versa
DATA iamnt(17) TYPE c VALUE '243567.00'.
DATA eamnt TYPE p DECIMALS 2.
DATA oamnt(17) TYPE c.
MOVE iamnt TO eamnt.
WRITE eamnt TO oamnt.
WRITE oamnt.

Similar Messages

  • 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;
    /

  • CONVERT CHAR TO CURR

    Hello,
    I have to convert from a variable char (255) to other thar is curr (15). Is it possible?, how i cast it?, any ideas?.
    Thanks for your help!!.

    You have to do the following.
    shift v_char255 left deleting leading spaces.
    translate v_char255 using ', '.
    condense v_char255 no-gaps.
    v_curr = v_char255.
    You need to be careful about occupied length of your v_char255 and I am assuming that you only have numbers, ',' and '.' in this field.
    Srinivas

  • How to Converting Char to Date?

    Hi
    while i converting the char to date i am getting the below error, can some tell me how to resolve the issue.
    Datetime value 01/01/2011 from 01/01/2011 does not match the specified format. (HY000)
    SQL Issued: SELECT 0 s_0, CAST(CONCAT('01/01/',cast(year(current_date)as char)) as DATE) s_1 FROM ''example reports"

    Can you check whats your default date format. Just run the report with Current_date and look at whats the format. Ensure you dont override the default date format by going into column properties.
    Try applying the same format when you use the cast as date function.
    Also, you can refer to this link. http://gerardnico.com/wiki/dat/obiee/cast_as_date_
    Thanks

  • Data conversion - How to convert char to decimal variant?

    Hi expert,
    In the example below, I want to convert the variable l_var1 to l_result
    data l_var1(16) type c.
    data l_preis(11) TYPE p DECIMALS 2.
    data l_result(11) TYPE p DECIMALS 2.
    l_preis = 10981.
    write l_preis to l_var1.
    after the write statement, l_var1 = 10,981.00. currently i want to move l_var1 to l_result. Is there anyone who knows how to do it? Thank you very much.

    Hi Liu,
    I want to know the exact requirement. Instead of what you are trying to do , you can do the following way.
    DATA l_var1(16) TYPE c.
    *data l_preis(11) TYPE p DECIMALS 2.
    DATA l_result(11) TYPE p DECIMALS 2.
    l_var1 = 10981.
    MOVE l_var1 TO l_result.
    WRITE l_result.
    <li> MOVE statement gives desired result. It gives rounding values.
    Thanks
    Venkat.O

  • How to convert char array to string

    sirs,
    i have written a method in java which will return a randomly generated string of a fixed length. i am creating one one character and inserting it into char array.
    at last i am converting it to string
    like this
    String newpass= pass.toString();// pass is a char array
    but problem is that the string is having different value what i hav generated.
    if i am doing like this..
    String newpass= new String(pass);// pass is a char array
    here newpass is having correct value but having some error
    error in the sense when i print
    System.out.println(newpass+"some text");
    "some text" is not printing
    can you suggest the better way

    /*this is my method */
    private String generateString(int len){
              char pass[] = new char[10];
              int cnt=0;
              int temp=0;
              Random randomGenerator = new Random();
                   for (int idx = 0; idx < 1000; ++idx)
                        temp = randomGenerator.nextInt(1000)%128;
                   if((temp>=65 && temp<=90)||(temp>=97 && temp<=122)||(temp>=48 && temp<=57))
                             pass[cnt]=(char)temp;
                             cnt++;               
                        if(cnt>=len) break;
                   String newpass= pass.toString();
                   String newpass1= new String(pass);
                   System.out.println("passed pass"+newpass+"as"+newpass1+"sa");
              return newpass;
    here newpass and newpass1 are having separate values
    why ??
    Edited by: Shovan on Jun 4, 2008 2:21 AM

  • Source:Essbase, how to convert char in date format

    Hello
    Version OBI EE:10.1.3.4.1.090414.1900
    Source:Essbase
    We have date in format VARCHAR (01.01.2008). I want to have date in format DATE.
    I transform our date on Business Level in DATE (yyyy-mm-dd)
    CAST ( SUBSTRING(Copeck."Time"."Gen5,Time" FROM 7 FOR 4) || '-' || SUBSTRING(Copeck."Time"."Gen5,Time" FROM 4 FOR 2) || '-' || SUBSTRING(Copeck."Time"."Gen5,Time" FROM 1 FOR 2) AS DATE )
    And in Answers I can see our DATE in format DATE,
    but when I want to use filter on this field i get mistake
    HY000. Код: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] meaning date/time 2008-01-01 nonqualifying given format
    Состояние: HY000. Код: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] Возникла общая ошибка. [nQSError: 46046] Значение дата/время 2008-01-01 не соответствует заданному формату. (HY000)
    Сформированный SQL: SELECT Time."Дата начала4" saw_0 FROM Copeck WHERE Time."Дата начала4" = date '2008-01-01' ORDER BY saw_0
    When i use
    CAST ( SUBSTRING(Copeck."Time"."Gen5,Time" FROM 1 FOR 2) || SUBSTRING(Copeck."Time"."Gen5,Time" FROM 4 FOR 2) || SUBSTRING(Copeck."Time"."Gen5,Time" FROM 7 FOR 4) AS DATE ) - ddmmyyyy
    I can't see our DATE in format DATE in Answers, because I immediately get mistake
    When I use usual database, i don't have this mistake, may be it depends on Source date?

    I understand the converions for formatting dates. Thank you for this posting, it helped a lot. Now I need to take this one step further and that is modifying a date that comes the XML Datasource in the format I do not want.
    Start Date is the name of the field. It is in XML and my RTF as 2009/10/03 and I want 10/03/2009 or 03-Oct-2009.
    Any help on this is most appreciated.
    Thanks
    G

  • 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

  • Converting Char  type  structure to Hex type structure

    Hello ,
             In unicode system how to convert char type structure to hex type structure . I am having structures as follows :
    DATA: BEGIN OF HEXBYTE,
      X TYPE X,
      END OF HEXBYTE.
    DATA: BEGIN OF CHARBYTE,
      C TYPE C,
      END OF CHARBYTE.
    HEXBYTE-X = CHARFIELD.
    CHARBYTE = HEXBYTE.
    But error coming is Charbyte and HexByte are not compatible . Plz suggest!!
    Thanks ,
    Keith

    Hi,
    These function modules are:
    NLS_STRING_CONVERT_TO_SYS (hex to char)
    NLS_SRING_CONVERT_FROM_SYS (char to hex)
    Regards,
    Nikhil

  • How to convert DATE variable to CHAR variable

    dear all,
    How to convert DATE variable to CHAR variable
    thanq

    Depending on your final goal here are 2 options.
    DATA: datein        TYPE d.
    DATA: dateout(10)   TYPE c.
    DATA: dateout2(8)   TYPE c.
    datein = sy-datum.
    WRITE datein TO dateout MM/DD/YYYY.
    dateout2 = datein.
    WRITE:/ datein, dateout, dateout2.
    and the output
    05022008 05/02/2008 20080502    

  • C#: How to convert Keyboard.key (Unicode char as number) into correct char?

    Our application uses barcode scanner.
    when scanning a barcode and convert Keyboard.key (as ushort with value 16, it represents char ':') by using
    1)(char)(Keyboard.key)
    2) or Convert.ToChar(Keyboard.key),
    both way convert into symbol '+'.
    How to convert into ':'?
    What is a correct way to convert Keyboard.key as ushort into correct char? Thx!
    JaneC

    Hi Dan Nemec,
    It is normal '+'. It is special '+' symbol.
    We search a little bit and find out Unicode ':' is 3A and value is not 16.
    So during the process barcode scanner, the value has been changed in some way.
    We are trying to find out where the value has been changed.
    JaneC

  • Converting CHAR(21) to CURR(15) - CRM system

    Hello,
    (I have read many threads about this "conversion from CHAR to CURR" topic, but none of them were able to answer my question).
    I am basically trying to convert a CHAR(21) to CURR(15).
    What I have learned is: CURR(15) needs the format: 3423.23. In other words, there shouldn't be any commas and the decimal separator should be a dot. So, I have seen a lot of algorithms that convert various CHARs to this format and it works fine.
    However, the problem is the regional settings. My input CHAR will depend on the regional settings of the user.
    Example: Here is what the pricing returns to me in the CHAR format depending on the user settings:
    DE: 1,214.99 EUR
    EN: 1.214,99 EUR
    So, there is no actually fixed format that I receive.
    Is there a function module/method that takes into account this user settings and does the conversion (in the CRM system)?
    Thanks,
    Guven.

    Hi
    Get data from user master record(USR01 table) where BNAME = sy-uname.
    check the decimal format, based on it convert u r currency. the decimal format will
    available in field DCPFM.
    Regards,
    raghu.

  • How to convert special characters in ABAP to XML?

    Hi All.
    We have a scenario where from XI (exchange Infrastructure), a BAPI is called which returns an XML. From that XML, a PDF is generated.
    Now, if the XML contains any special characters, it will fail.
    So if any CHinese char or >, # etc signs are there, it fails.
    Can you please tell me how to convert my string in ABAP to a proper XML?
    I am new to it and I was trying the following code
    DATA: today TYPE string,
          result TYPE string.
    today = 'This is testing'.
    CALL TRANSFORMATION ID
         SOURCE today = today
         RESULT XML result.
    IF sy-subrc = 0.
      WRITE result.
    ENDIF.
    But it does not return me anything.
    Thanks in adv.

    hi
    good
    go through these links,hope these would help you to solve your problem
    http://www.sap-press.de/download/dateien/792/sappress_abapreference_2edition.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d
    thanks
    mrutyun^

  • Convert Char to Numc or Date

    I need to knw how to convert a char var to integer or numerical variable. If possible ,dats format.
    Reply imm

    hi
    if you take a numc data type then you can move the char value to the numc stright.
    if it is dats u can do a move char_variable to dats_variable.
    regards.
    Lakshmikanth.

  • 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

Maybe you are looking for

  • Help - cant get back to desktop

    I booted my powerbook using command+s. How do I return it to the normal desktop?? Every time it turn it on it just loads up a page that looks like terminal -black with white text. the message it displays is etc/master.passwd: No such file or director

  • Forms & Reports Runtime 6i with XP with 8.1.7 Middleware, Forms install hangs.

    Here it goes! I work at a large corporation and we have random installer problems with Forms Runtime and Reports Runtime. We have an image that includes Oracle 8.1.7 TCP/IP and ODBC middleware installed on XP under an Active Directory environment. Ou

  • Why java is called platform independent

    Hello Why java is called as platform independent?Any body please give a detailed explanation since im a beginner to java technology. ThankYou Jk

  • I have changed my internet connection to Huawei HG8245 modem wireless modem my Air Play not working any more

    I have apple TV 3rd generation it use to work fine through the previous modem(THOMSON TG585 v7) I have changed my internet connection now using Huawei HG8245 modem. At the moment There is internet connection in the apple TV  I can manage only through

  • MTD problems

    I have a powerpivot report that shows the 12 months of each year.  A sales column is compared to a sales column from the previous year.  Everything works great except for the current month.  It is showing a month end total for January 2013 and I need