Parsing a packed decimal value

I am doing an extraction of BKPF and my ETL process is failing because the data which is being returned via RFC_READ_TABLE for KURS2 is '0.1234-'
When I go in to SE16 and look at that record, the displayed field value (based on localisation to F) is: '/0,1234'.
KURS2 has a datatype of P. Its values also should be always unsigned (since a negative currency conversion rate doesn't make any sense). Are signed values in P fields which come out of RFC_READ_TABLE have the - sign at the end (like a BCD?) or is it returning that because the RFC is misparsing the '/' in the actual field? And why would the UI allow someone to enter such a value? (I understand that it looks like whoever entered it wanted something to divide WRBT* by KURS2 to get DMBT2 or whatever, but that seems strange to me).

How do you store the "PACKED DECIMAL" in Oracle?
Do you use one of the following data types:
NUMBER(n,n)
DECIMAL(n,n)?
or
is it mainframe data that is represented in PACKED DECIMAL format that you've loaded into Oracle via SQL Loader.
P;

Similar Messages

  • How to convert Pack-decimal values?

    I have one itab1 with field
    Rate DEC 20,5
    Another Itab2 with field
    Rate DEC 18,9
    i am doing...
    itab2-rate = itab1-rate
    but it is not let me doing  my value to second table . how?
    How it can be done?
    RH

    Hi Ronny,
    <removed_by_moderator>
    Edited by: Julius Bussche on Sep 9, 2008 5:37 PM

  • How to move the value from a character field to numeric or packed decimal

    Hi,
    can anyone explain me on how to move the value from a character field to numeric or packed decimal.
    Please help me on this. Thanks...
    Regards,
    Rose.

    Hi ,
    if you use keyword MOVE u may loose the decimal and thoussan separator and if u don't want to loose them just call the FM ..HRCM_STRING_AMOUNT_CONVERT.
    i doubt wherther it is HRCM or HCRM just try using *
    this will suit ur requirement.
    Regards,
    KK

  • Long / double value convertion to Packed Decimal

    Hi,
    Could anybody tell me how to convert a long / double value to Packed Decimal (AS400) ?
    Thanks,
    Probir

    Now I'm writing this value in a flat file by
    FileOutputStream and sending to mainframe through FTP.
    But the mainframe people said it's not converted into
    packed decimal. Is it the right way to convert ??When you say "mainframe" I assume you are referring to a machine that uses EBCDIC. Java, even on the iSeries, uses Unicode and not EBCDIC, so when you FTP anything to the mainframe it will go through an ASCII-to-EBCDIC conversion. You want this to happen for text but you don't want it to happen for packed decimals; your carefully-constructed x'12' x'3f' bytes will be dutifully converted into EBCDIC garbage.
    FTP of an iSeries file (in the QSYS.LIB file system) to a mainframe is trivial because both client and server use EBCDIC, so there are no conversion issues. So if you could do it that way, you definitely should. Otherwise you are going to have to take your packed decimal data and replace it by the bytes that would be translated into it if it were in EBCDIC. The translation table QEBCDIC in library QSYS shows you how it does that, so use that table. You can look it with the command WRKTBL QSYS/QEBCDIC. You'll notice for example that x'09' in ASCII gets converted to x'05' in EBCDIC. So if you want to get x'05' into part of a packed decimal field on the mainframe, you have to send it x'09'. And so on. Like I said, I would recommend doing something other than this. Ask the mainframe people to not make you used packed decimal, for example.
    PC&#178;

  • Decimal values check

    Hi,
    Given a string of character values, I get the values comprising of character values and also floating point values. eg 25.75 . The problem is the decimal value is not deciphered as a decimal but instead a character value. Could you please give me the name of the function module that would recognise the floating point value..
    Thanks in advance....

    Hi Sanjay,
    You will have to parse the character variable character by character to determine if it contains any character field.
    This can easily be achieved by the following code.
    REPORT ZTMP.
    DATA: WA_TMP TYPE P DECIMALS 2,
          WA_TXT(10) VALUE '35.56',
          WA_LTH TYPE I,
          WA_INDEX TYPE I VALUE 0,
          WA_INDC(1) VALUE ' '.
    CONDENSE WA_TXT.
    WA_LTH = STRLEN( WA_TXT ).
    DO WA_LTH TIMES.
      IF WA_TXT+WA_INDEX(1) CO '0123456789.'.
        WA_INDC = 'X'.
      ELSE.
        WA_INDC = ' '.
        EXIT.
      ENDIF.
      WA_INDEX = WA_INDEX + 1.
    ENDDO.
    IF WA_INDC EQ ' '.
      WRITE: 'VARIABLE CONTAINS A STRING.'.
    ELSE.
      WRITE: 'VARIABLE CONTAINS A PACKED DECIMAL.'.
    ENDIF.
    Using CO directly will not work.
    Regards,
    Madhur
    CORRECTION ***************
    Sorry Sanjay,
    I made a mistake here. Using CO directly will work if we include a SPACE " " character in our CO criteria. This would be as follows:
    REPORT ZTMP .
    DATA: WA_TMP TYPE P DECIMALS 2,
          WA_TXT(10) VALUE '35.57',
          WA_LTH TYPE I,
          WA_INDEX TYPE I VALUE 0,
          WA_INDC(1) VALUE ' '.
    CONDENSE WA_TXT.
    IF WA_TXT CO '0123456789. '. "This contains a space char.
      WRITE: 'VARIABLE CONTAINS A PACKED DECIMAL.'.
    ELSE.
      WRITE: 'VARIABLE CONTAINS A STRING.'.
    ENDIF.
    Message was edited by: Madhur Chopra
    Message was edited by: Madhur Chopra

  • Loading the data from a packed decimal format file using a sql*loader.

    Hi ,
    In one of the project i'm working here i have to load the data into oracle table from a file using a Sql*loader but the problem is the data file is in the packed decimal format so please let me know if there is any way to do this....I search a lot regarding this ..If anybody faced such type of problem ,then let me the steps to solve this.
    Thanks in advance ,
    Narasingarao.

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • How to delete decimal values zeros

    Hi experts,
    i am using mseg-menge field ( lenth13 and decimals 3) in my alv grid report.
    eg: 2.3456.000
    user wants only  2.3456 no decimals.
    how we can aviod decimals 0 s in report.
    thanks in advance.
    mahahe

    I search this ways in the forums:
    Shift
    SHIFT varb1 RIGHT DELETING TRAILING '0'.
    write: gv_variable decimals 0.
    SHIFT VALUE LEFT DELETING LEADING '0'.
    Shift2
    DATA: T(14) VALUE ' abcdefghij',
    STRING LIKE T,
    STR(6) VALUE 'ghijkl'.
    STRING = T.
    WRITE STRING.
    SHIFT STRING LEFT DELETING LEADING SPACE (or use 0 to detete 0).
    WRITE / STRING.
    STRING = T.
    SHIFT STRING RIGHT DELETING TRAILING STR or 0.
    WRITE / STRING.
    Shift3
    data amt(6) type p decimals 3 value '123.450'.
    data amt1(6) type p decimals 2.
    data amt_c(6) type c.
    unpack amt to amt_c.
    shift amt_c right deleting trailing '0'.
    pack amt_c to amt1.
    write amt1.
    use FM
    FTR_CORR_SWIFT_DELETE_ENDZERO
    this FM will remove all the zeros from decimal values like
    value - 234.8000000
    output - 234.8
    IF
    data: var1 type p decimals 3,
          var2 type p decimals 2,
          var3 type p decimals 1.
    move '12345.100' to var1.
    move var1 to var2.
    move var1 to var3.
    if var2 = var1.
      if var3 = var1.
        write var3.
      else.
        write var2.
      endif.
    else.
      write var1.
    endif.
    I hope that this solve your problem.
    Cordial greetings.

  • Convert Mainframe Packed Decimal to Oralce Number Format

    Dear all,
    I am having a file in which amount fields are given in a Packed Decimal format. Can anyone suggest me how I can read this data element from the file and convert it into Oracle Number datatype.
    File is a fixed length. All the amount fields are given in Packed Decimal Format and rest of the fields are given in text format.
    Thanks and regards
    Nagasayan Puppala

    Hi,
    Firstly thanks for your reply.
    Actually I am not using SQL Loader to load data from
    a flat file to Oracle table. I am writing a custom
    program that reads the file and populates the oracle
    table. I'll put aside the question of 'why' you'd want to do that. SQL*Loader's singular purpose in life is to load flat files of data into Oracle DB. Sometimes there is a reason for reinventing the wheel.
    How does your program communicate with the Oracle DB? If utilizing ESQL and Pro*Cobol (or Pro*<whatever> ) you will have read the data into a variable of some type in you host language. The variable of the host variable to hold the value (if you did a 'select from' that table) would be the correct target type for an insert statement. Whatever host language type conversion is available bewteen those two types ( if they are different at all ) is all that is needed. The precompilers have converters between certain native host and internal Oracle types built-in. It is how you get any data between the two systems. This is only a problem if the host language has no converter between the numeric types (if differnet.). When you read from the flat file are you reading it into a native packed decimal in the host language?
    ODBC/JDBC similar strategy..... cast conversion between the native type that Oracle wants and the one into which your custom program reads it into.
    So I want to know whether there are any Oracle
    utility programs that will convert the packed decimal
    to a oracle number format or not.There are Oracle routines that convert into the native Oracle DB formats. There are implicitly available through the normally utilized interfaces to OCI ( ESQL and ODBC/JDBC ) . There are none decoupled from those interfaces though (that I know of).
    There are no standalone programs that mutate a flat file into another flat file that then could be loaded. That's is typically slower and utilzes more space than most customers want than just directly inputing the data into Oracle DB.
    Message was edited by:
    lytaylor

  • Can we move char type data to packed decimal

    Hi
    can we move char type data to packed decimal??
    Thanks
    Devi

    Hi..
    that depends on the data in the character variable..
    if that character variable contains onli numbers then it is possible.
    <b>data c type c value '1'.
    data p type p.
    p = c.
    write p.</b>
    here the output is  1.
    If it contains even a single Alphabet , then it goes for a dump.
    <b>data c type c value 'A'.
    data p type p.
    p = c.
    write p.</b>
    here u will get a short dump.
    hope u understood.
    regards,
    sai ramesh

  • Webi Report ignores decimal values

    Hi,
    I have a report which takes data from a BI Infocube. I have BOE XI 3.1 installed on two systems. When I run this report on one system, the report works fine and numeric values are displayed along with decimal values ( ex 100.25). However the same report when executed in the other system ignores the decimal values (ex 100).
    I check the preferred viewing locale in the preferences and it is set to default values in both the systems.
    I have no clue what could have gone wrong.
    Any inputs on this issue will be highly appreciated.
    Regards,
    Rahul Mainkar

    You are right. No Fix Pack is installed.
    Probably the system, which is NOT truncating the decimal part has been installed on a Windows server where the local system account has EN-US regional settings. This should not be the case for the system which is truncating your numbers.
    A work-around is to create a domain account which is member of the local administrators group on the BOBJ servers. You should log on once on each of your two servers using this account and adjust the Regional Setting (Start->Control Panel) to English-United States. Invoke the CCM utility and open the Properties window of your SIA and Tomcat. Enter the credentials of your new user in  the "Run as"  area and restart your services. This will solve your problem.
    Regards,
    Stratos

  • How to get the leading zeros for decimal values?

    Hi,
      How i wil get the leading zeros for decimal values.For CONVERSION_EXIT_ALPHA_INPUT it is not working.Now iam using overlay condition for getting leading zeros.But iam getting the value like 00013.500.But as per my requirement i want to display this value 0000013.5.
    my code is
                    overlay w_MetLife_detail-rdempsalary with '000000000'
                    data :rdempsalary     type char9
    Please help me on this.
    Regards,
    Sujan

    Hi
    For more info,
    The function of the statement UNPACK is based on the fact, that the BCD display of a decimal place corresponds to the second half-byte of code of a digit in the most character representations. This conversion is commonly called "unpacking".
    The statement PACK to pack is obsolete and can be replaced by MOVE.
    If destination is specified as untyped field symbol or as untyped formal parameter and is not flat and not character-type during execution of the statement, then an untreatable exception occurs in Unicode programs. In non-Unicode programs, an exception occurs only with deep types, whereas flat types are treated as character-type types.
    Example
    After the assignments,char1 and char2 contain the values "123.456" and "0000123456".
    DATA: pack  TYPE p LENGTH 8 DECIMALS 3 VALUE '123.456',
          char1 TYPE c LENGTH 10,
          char2 TYPE c LENGTH 10.
    MOVE   pack TO char1.
    UNPACK pack TO char2.
    Regards

  • If I have a 4 decimal values in a field, then I want 2 only on the output.

    Hi,
    If I have a 4 decimal values in a field, then I want 2 only on the output of the smartform. what I have to do.  Also I have to condense the value of that.
    Thanks,
    BSV

    Hi,
    Define one packed number with 2 decimals and move the four decimals number to decimal 2 variable.
    Ex:
    Data:P(13) type P decimals 2,
          t(13) type P decimals 4.
    P = T.
    write P.
    Thanks ,CSR.
    ****Please reward if helpful.

  • Check nbo decimal values of double

    Hi there!
    I need some advice on a topic:
    What is the best practice to check the number of decimal places, double values have (e.g. two decimal places are allowed, when there are more an exception has to be thrown)?
    I did some research, but could not find a truely satisfying solution.
    Hope you can help!
    greetz

    YoungWinston wrote:
    JoachimSauer wrote:
    You could try to get the String representation using String.valueOf() and check how many characters it contains after the decimal point. If the double value is really the result of the parsing of that String value, then the result should not have more digits than the original input...Are you sure that every possible value created by a string with up to 2 decimal places will convert back to the same string Joachim? It's possible, but I've never seen any confirmation of it.I'm not 100% sure, but I seem to remember some documentation to that effect. I was just too lazy to look it up ... I'm looking into it now.
    I think I found it:
    [Double.toString(double)|http://java.sun.com/javase/6/docs/api/java/lang/Double.html#toString(double)] says:
    How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type double.(emphasis mine)
    If my understanding is correct, then this rule ensures that the shortest possible String literal that parses into the same double value must be produced. So if the String literal "0.2" parses to the double value that you have, then Double.toString() must not produce 0.20, because that's more digits than would be necessary.
    Of course this approach breaks down if you exceed the possible precision of the double (i.e. if you have 15 digits before the decimal point, then anything after the decimal point will be lost/effectively random).

  • How do I convert an alpha character from a text string to its decimal value

    I am trying to find out the actual decimal value of a character in a string. So far the code below is as far as I got. I am able to get what I guess is a byte value.
    This is for a school assignment:
    The idea behind what I am trying to do is to design a hash function to store dictionary words into a bucket array hash table, without using the existing Hashtable.class
    so far this is what I can come up with to get some kind of value for each character in the string, however, what I am trying to get is the decimal value for each character.
    public static void main(String args[]){
         String word = "abcdefghijklmnopqrstuvwxyz";
         for (int i=0 ; i < word.length(); i++){
         System.out.print((word.substring(i,i+1)));
         System.out.print("\t : "+((word.substring(i,i+1))).getBytes());
    Thankyou for any replies.

    I'm not sure I completly understand your goal- what you mean by "decimal value", but, if you simply want to find the byte value of each character in a String, you would probably be better off using getBytes() in a way like this,
    byte [] bytes = string.getBytes();
    Then, if you need to map that to a charcter, you could use a for loop like
    for (int x = 0; x < bytes.length; x++) {
    table.put((char)bytes[x], bytes[x]);
    which assummes this bucket class of yours allows primitive data types like so (in Hashtable or HashMap, you would have to use a wrapper Object). I guess, my point reduces to, don't use substring and string search methods (like indexOf()), unless you have to because they are more expensive then just maping the array of bytes and chars, which seems to be what you are interested in doing.

  • Decimal  values for a field in ALV

    Hi,
    I created an ALV report.
    It has a field which will display the calculated value as '103,839,389'. This should be dispalyed as '103,839,389.00' with decimal value, I mean with 2 decimal places, how can this be achieved?
    Thanks,
    Kumar

    hi check this..
    use these in populating the fieldcat..
    it_fieldcat-decimalsfieldname = fieldname
    it_fieldcat-decimalstabname   = tabname
    it_fieldcat- decimals_out   = 2.
    regards,
    venkat

Maybe you are looking for