Msg Mapping :: Converting String ( source ) to double ( target ) Type

Hi
During my message mapping, I have to convert one String Field from Source Structure to Double ( primitive data type ) field in Target Structure.
String Weight   -
Source
Double Wght    -
Target
Java Code ****
<b>double Wght = Double.valueOf(Weight.trim()).doubleValue();</b>
But if I use this in UDF then it has default return type as String.
Can I change the return type in UDFs or is their any other way using which I can do this conversion.
Best Regards
- lalit chaudhary -

Hi Lalita,
Please see the following code try..
static public double parseDouble(String s)
      return doubleValueOf(s);
But XI always input ,output as string in MM.
is it your requirement..?
Regards
Chilla..

Similar Messages

  • Converting String  into a Double value

    Hi
    iam really stuck can anyone please help that what i should do
    to convert a String variable into a double value
    iam using CLDC1.1 and MIDP2.0
    please tell me how its done
    Thank in advance

    hi,
    thanx alot it really worked now i want to convert the answer of the double variable back to string can you please tell me how to do it thanx alot

  • How to convert a String data to Double or Float???? Thank you

    I need to convert String data to Double or Float , please help me about it. Thank you very muh!
    String a=Integer.parseInt("1234"); convert to integer.

    I found it but do not know if it is ok
    float a= Float.valueof(String to
    convert).floatValue();
    may be it can be!!!
    Thank you !!!!How did parseInt lead you do valueOf?
    Look for something more consistent. A pattern.As I said earlier, it depends if he wants an object or a primitive.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Convert string to floating-point

    Hi all,
    ..very basic question, but I tryed it for hours and only received short-dumps
    <b>How can I convert a string into a floating-point number?</b>
    Kind regards,
    Stefan

    hi
    try this
    to convert  string to float.
    data : a type f,
    s type string value '1.023'.
    a = s.
    write :/ a.
    to convert float to string.
    data : a type f value '1.023',
    s type string.
    s = a.
    write : s.

  • Warning "Cannot convert string" - linux jdk1.4

    when launching apps in jdk1.4 i get the following warnings: (any ideas anyone)
    Warning: Cannot convert string "<Key>Escape,_Key_Cancel" to type VirtualBinding
    Warning: Cannot convert string "<Key>Home,_Key_Begin" to type VirtualBinding
    Warning: Cannot convert string "<Key>F1,_Key_Help" to type VirtualBinding
    Warning: Cannot convert string "Shift<Key>F10,_Key_Menu" to type VirtualBinding
    Warning: Cannot convert string "<Key>F10,Shift_Key_Menu" to type VirtualBinding
    Warning: Cannot convert string "<Key>KP_Enter,_Key_Execute" to type VirtualBinding
    Warning: Cannot convert string "Alt<Key>Return,Alt_Key_KP_Enter" to type VirtualBinding

    The command:
    xmbind --help
    gives an examplanation of what is happening:
    With no FILE specified, the file .motifbind in the user's home directory
    is used. If this file is not found, xmbind loads the default virtual key
    bindings.
    If you run:
    xprop -root | grep -i bind
    This will show your default bindings.
    To remove the defaults run:
    xprop -root -remove MOTIFDEFAULT_BINDINGS
    To check it worked again run:
    xprop -root | grep -i bind
    To give the bindings I have created a file in my home directory called '.motifbind'. When you run your java app, if the default bindings have been removed the app will cause motif to get the bindings from the '~/.motifbind' file.
    This is my file:
    ! ~/.motifbind file
    osfActivate : <Key>KP_Enter
    osfAddMode : Shift<Key>F8
    osfBackSpace : <Key>BackSpace
    osfBeginLine : <Key>Home
    osfCancel : <Key>Escape
    osfClear : <Key>Clear
    osfCopy : Ctrl<Key>Insert
    osfCut : Shift<Key>Delete
    osfDelete : <Key>Delete
    osfEndLine : <Key>End
    osfHelp : <Key>F1
    osfInsert : <Key>Insert
    osfLeft : <Key>Left
    osfMenu : Shift<Key>F10
    osfMenuBar : <Key>F10
    osfPageDown : <Key>Next
    osfPageLeft : Ctrl<Key>Prior
    osfPageRight : Ctrl<Key>Next
    osfPageUp : <Key>Prior
    osfPaste : Shift<Key>Insert
    osfPrimaryPaste:Meta<Key>Insert
    osfRight : <Key>Right
    osfSelect : <Key>Select
    osfUndo : <Key>Undo
    osfUp : <Key>Up
    osfDown : <Key>Down
    When you run your app the errors hopefully will not show.
    If you want to make a change to your '~./motifbind' file you will first need to remove the property, by now running:
    xprop -root -remove MOTIFBINDINGS
    and then running your app.

  • Generating target-type xsd with element names in camelCase

    Env: ODSI 10gR3, Workshop 10gR3, Oracle DB 10gR3
    We are developing logical data services following a bottom up approach. The source physical data services that we use to build the logical ds have xsd definitions in which element names are in CAPS_CAPS naming convention (following the same names as the database tables). For example, FIRST_NAME, LAST_NAME, etc.
    When we use Query Map to generate xsd for the target types of the logical ds, it generates element names that are also in the CAPS_CAPS convention. Is there a way to generate the target type xsd in which CAPS_CAPS names are converted to camelCase, e.g. FIRST_NAME becomes firstName.
    Thank you in advance.

    mixed-case with underscores removed vs. upper case is only one variation. Someone might like to rename SSN to SocialSecurityNumber, someone might like to rename LAST_NAME to Surname or FamilyName etc.
    You can do any renaming etc. with a Logical Data Service. See the "Best Practices" which is posted as an Announcement in this forum.
    Typically customers put their Physical (i.e. generated) data services in a Physical folder, and then create a parallel Logical folder (including the schemas folder). Then you would create new schemas in Logical/schemas with the new names, create new Logical data services to match the physical ones, then create a 'read' function that uses the physical read function and map the elements of the physical read function to the logical schema (with the new names). Then you can generate the create/delete/update procedures in the Logical data services.
    Getting back to your original question - the answer is No. There is no feature with in ODSI to automatically transform element names to something else.
    - Mike

  • Question: map the whole source message into one field in the target.

    Hi Friends,
    Is there a way to populate the whole source message into one of the fields in the target message?
    I am trying to do this in message mapping. Guide if this could be done in any other way or is there a way to do it in message mapping.
    Waiting for your valuable guidance,
    Regards,
    Lakshmi

    Hi Friends,
    I tried to convert the source message into a string using XSLT mapping. It was successful, however i need to have the source message in XML format and not in any other format. This is because, I am mapping the source XML into a field in a WSDL. The webservice requires the entire source message be inside a field called "Request" in the WSDL (it is like XML inside another XML).
    Is there any way to do this? Please suggest.. (Im not good at java programming... may be i dont know)

  • Mapping conversion of source value 4448601.75 to target value 448601

    Mapping conversion of source value 4448601.75 to target value 4448601 or source value 999999.99 to target value 999999
    Here standard functions like round, floor, ceil..etc, will not work because they will convert source value 4448601.75 to 4448602 and source value 999999.99 to 1000000.
    Also i may have blank or white spaces coming in front of the source value from R/3 side like _____999999.99 and i want the value at the target side as _____999999. Here _____ representing blank or white spaces.
    How i will do the mapping, can someone help me out.
    Thanks,
    Ashish
    Edited by: Ashish Soni on Sep 6, 2008 9:53 PM

    >>Here standard functions like round, floor, ceil..etc, will not work because they will convert source value 4448601.75 to 4448602 and source value 999999.99 to 1000000.
    No....! The floor function can be used. It returns the largest integer that is not greater than the passed value. However this will also trim the spaces.
    So u can write a UDF that accept the number and substring till the decimal point and returns it.
    Try this.. It works..
    public String converv(String a,Container container)
    return a.substring(0,a.indexOf('.'));
    Thanks
    SaNv...

  • ABAP MAPPING Querry - How to create Different Target NODE NAME as of Source

    Hi,
    In abap Mapping
    <b>DATA READ FROM SOURCE XML NODE into <u>incode</u></b> ******
    data: incode type ref to if_ixml_node_collection.
    incode = idocument->get_elements_by_tag_name( 'BUSINESS_DAY' ).
    <b>CREATE OUTPUT XML NODE WITH SAME NAME AS <u>'BUSINESS_DAY'</u></b> **
    data: outcode type ref to if_ixml_node.
    outcode = incode->get_item( index = 0 ).
    data irc type i.
    irc = msgtype->append_child( outcode ).
    *<b>BUT TO CREATE OUTPUT XML NODE WITH <u>DIFFERENT NAME AS 'BUSS_DAY'</u></b>*
    data: ws_val type string VALUE 'xyz'.
    data: elementsender type ref to if_ixml_element.
    elementsender = odocument->create_simple_element(
    name = 'BUSS_DAY'
    value = ws_val
    parent = msgtype ).
    <b>Please guide me how I can assign <u>incode</u> value to ws_val.
    So that I can generate <u>OUTPUT XML NODE with different name as of SOURCE XML NODE</u></b>
    i.e. How to create Different Target NODE NAME as of
    Source with same Data
    <Note>: I am using "How to... Use ABAP Mapping in XI 3.0 ver.1.00" and to create different NODE name as of source
    is not given in it.
    Thanks & Regards.

    Hi ABAPers,
    Please Guide Me .....
    <u>This is ABAP Mapping problem in XI.</u>
    <b>How can I read data from incode into ws_val.</b>
    data: <b>ws_val</b> type string
    data: <b>incode</b> type ref to if_ixml_node_collection.
    <b>incode</b> = idocument->get_elements_by_tag_name( 'BUSINESS_DAY' ).
    Best Regards

  • Converting a String to a Double, may I use Double constructor?

    Hello,
    I need to convert A String to a Double in my application.
    Usually I use the Double.parseDouble(String) method that works fine.
    But I have found one line in the code that use the Double class constructor: new Double(String). It has been observed that that constructor sometimes throws NullPointerException.
    My question is, are theses two methods both good practices to do the convertion? Could threre be a multi-threading problem with the Double construtor?
    I'm using JDK 1.3.1.
    Here is a sample of stack trace:
    bvsmgr: java.lang.NullPointerException
         at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
         at java.lang.Double.valueOf(Unknown Source)
         at java.lang.Double.<init>(Unknown Source)
    Thank you for all answers,
    Florent.

    But I have found one line in the code that use the
    Double class constructor: new Double(String).
    It has been observed that that constructor sometimes
    throws NullPointerException.
    My question is, are theses two methods both good
    practices to do the convertion? Could threre be a
    multi-threading problem with the Double construtor?Both methods are the same (they both use valueOf()), and if the c'tor throws an NPE, then only because you feed it null. parseDouble would do that, too.

  • Having trouble converting a string to a double

    Im having problems converting a string to a double in my jsp pages, i have pasted part of the code that is causing the problem. Just a note, i have imported the java.lang.* classes also
    while ( rs.next() )
    String price = rs.getString("price");
    sPrice = double.parseDouble(price);
    out.println("<TD>$" + decimalFormat.format(sPrice) + " </TD>");
    An error occurred at line: 140 in the jsp file: /cs399/AddToShoppingCart.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\jakarta-tomcat-4.1.29\work\Standalone\localhost\_\cs399\AddToShoppingCart_jsp.java:277: class expected
              sPrice = double.parseDouble("price");
    ^

    double is a primitive. You want java.lang.Double, with a capital "D":
    sPrice = Double.parseDouble(price);MOD

  • Issue in OWB mapping - when changing source and target database

    Hi,
    I need help for resolution of the issue I am facing when moving mapping from development environment to QA.
    Here is situation,
    We develop ETL using one source, one staging and one target database.
    In development we use one control_center for Source to staging and another control center staging to target.
    All works fine in development.
    Now I have created new runtime repository and imported all OWB projects (with full dependencies, exact replica of development). Now I need to change source and staging and target as different database.
    I have created new database location connections and defined/attached DB connectors with stage and target location.
    Now issues are
    1.     Two Staging mapping are not able to bound with source table (giving different error
    a.     One mapping show error for source synonym translation no longer valid when deploying this mapping , but validation comes without any issue)
    b.     Other mapping show error for source table/object not bound to repository
    2.     All the target mapping show validation successful, but when deploying says “table or view does not exist”. But tables are exists on source stage and target. (also permission are set correctly for target user to read from staging tables).
    Not sure how to proceed from here.
    I have recreated new repository and re-imported all project/mappings and defined all connection but still same issue.
    Thanks in advance,
    Vipin

    1. Two Staging mapping are not able to bound with source table (giving different error
    a. One mapping show error for source synonym translation no longer valid when deploying this mapping , but validation comes without any issue)
    b. Other mapping show error for source table/object not bound to repository
    The above error were resolved when re-synchronized the table (for few I have to reimport the table) and mapping.
    2. All the target mapping show validation successful, but when deploying says “table or view does not exist”. But tables are exists on source stage and target. (also permission are set correctly for target user to read from staging tables).
    The above error still pending. My target mapping are not able to deployed/compiled.
    For the above I have defined one Staging location to one target target location and target location have connector to staging (not sure if I have to define connector name same as staging location, as I have created DB connector with different name but reference database is same as staging location).
    Mapping are assoicated with desired data locatoin and meta data.
    control center is also have that data location.
    Mapping are configured for the desired location.

  • Map two different source elements to one target element

    Hello,
    This is my scenario.
    RootSource1 (0..1)
             source1 (0..unbounded)---> one entry of this will create one TargetSource
                 nameA --> mapped to TargetSource/Target1
    RootSource2 (0..1)
             source2 (0..unbounded)---> one entry of this will create one TargetSource
                 nameB --> mapped to TargetSource/Target1  
    TargetSource (0..unbounded)
             Target1 (0..1)
    From graphical tool, I can map
    TargetSource = removeContexts(source1)
    I also have to do:
    TargetSource = removeContexts(source2)
    But it seems the tool does not let me do the second mapping. Does anybody know how?
    Any help appreciated.
    Best regards,
    -mhd

    Try it like this:
    in target message, right-clink on TargetSource field and select "duplicate entry".
    Map the 1st source field to the 1st TargetSource entry and the 2nd Source field to the 2nd TargetSource entry.
    Regards,
    Henrique.
    PS: I don't think you need removeContext in this case, since the root is 0...1.

  • Issue in mapping the same source and target fields

    Hi All,
    I am working on PI 7.0 and currently I am connecting to PI 7.0 via citrix desktop . Problem here is : in the mapping , direct mapping option that is available to map the same source and target fields is disabled . I do know that this is due to some java version issue .
    What I want to know is there any possibilty of solving this issue without installing an updated java version ?
    Regards
    Vinay P.

    I've faced the same for many times and all of that were due to Java version.
    1st of all, you have to check the authorizations you have. If you have enough (DEVELOPER_J2EE, CONTENT_ORGANIZER_J2EE, and so), and - obvious but very often forgotten - you have to assure you're trying to change it in the message mapping change mode On.
    Then, last shot should be downgrade your Java version.
    The 1.4.2 JRE version allow you to use not only the Mapp the Identical field but also Dependencies, Clear Mapping and some other tools/buttons. As mentioned above, if there's a fix in the new Java releases, I do not know (hope so) and would appreciate if you could let us know.
    Tks.

  • Idoc to jdbc mapping duplicate source node to target structure

    Dear all,
    I am working on PI 7.1
    My sceniro
    IDOC to JDBC  [sap to mssql ]  where the target is a table structure shown below: I execute a stored procedure to insert the below message type into sql table.
    <ns0:MT_SP_LFBK xmlns:ns0="http://test.com">
    - <Statement_Name>
    - <storedProcedureName action="EXECUTE">
      <table>spr_test</table>
      <BANKS type="Char">BOA</BANKS>
      <BANKL type="char">122207</BANKL>
      <BANKN type="char">4555--0</BANKN>
      <LIFNR type="char">1100000218</LIFNR>
      <KOINH type="char">varchar</KOINH>
      <BKONT type="char">01</BKONT>
      <BANKA type="varchar">S.A.</BANKA>
      </storedProcedureName>
      </Statement_Name>
      </ns0:MT_SP_LFBK>
    The mapping is between source CREMAS02 and the above target structure. Everything works fine.
    The problem is when the  vendor has more than one bank account number the IDOC CREMAS02 replicates the below segment E1LFBKM for each BANK account information. Since target and source are mapped one to one how can i map the second bank account information to the same target structure or genereate a new target Message type for the second bank account  information and send it to sql ?
    <E1LFBKM SEGMENT="1">
      <MSGFN>005</MSGFN>
      <LIFNR>110000021</LIFNR>
      <BANKS>BOA</BANKS>
      <BANKL>122207</BANKL>
      <BANKN>4555-0</BANKN>
      <BKONT>02</BKONT>
      <BANKA>S.A.</BANKA>
      <BNKLZ>3000000</BNKLZ>
      </E1LFBKM>
    Thank you ,
    Teresa

    Hi Teresa,
    which segment have you mapped with <storedProcedureName action="EXECUTE"> ?
    Because according to me , if you send <E1LFBKM> to <storedProcedureName action="EXECUTE">
    , you will be able to use your stored procedure several times, in fact each times that you have a <E1LFBKM>.
    Reminds: inside <Statement_Name> you can do several SQL actions like execute one or several stored procedures (could be different).
    Of course, after that your table should accept to have several bank account for a same customer.
    So to have something like that:
    <Statement_Name>
    <storedProcedureName action="EXECUTE">
    </storedProcedureName>
    <storedProcedureName action="EXECUTE">
    </storedProcedureName>
    <storedProcedureName action="EXECUTE">
    </storedProcedureName>
    </Statement_Name>
    regards
    mickael

Maybe you are looking for