Converting type from SAP to Java...

Hi everyone,
I am calling a BAPI wich returns me numbers like for example : 19,887.54
When I get this number in my Java code, it does not save the ",".
Can someone help ???

The decimal format is probably the best way for parsing and displaying in another locale/style.
The following code works:
import java.text.DecimalFormat;
import java.text.ParseException;
try {
               //This is the actual format you would like to parse from, and print out using
               DecimalFormat formater = new DecimalFormat("#,###.##");
               //Get the number from a string
               Number number = formater.parse("19,887.54");
               System.out.println("Number:"+number);
               //format the number to a String which is the number as a pattern
               String formatedNumber= formater.format(number.doubleValue());
               System.out.println("Formated number "+ formatedNumber);
          } catch(ParseException p){
               System.out.println("Parse failed");               
and the output is:
Number:19887.54
Formated number 19,887.54

Similar Messages

  • Convert report from SAP to Excel

    Hi All,
    How to convert report from SAP to Excel.Here now taking default text(.txt) format.But we want defualt taking (.xls) format only.
    Regards
    Usha

    hi usha
    u can even export the text in txt format and later right click and open with excel , u wont be able to directly import it into excel as it is not giving u any option to upload in excel directly
    Regards,
    Manish

  • Handling RAW data types (from SAP) in Adobe forms - Illegal Arg Exception

    Hi,
          I have a scenario where I have to get data of type RAW in SAP to Adobe Forms using web dynpro java. What is the corresponding type in Web Dynpro / Adobe Forms.
    I am using Adaptive RFC and when I get the model from SAP function module, the RAW type is created as Binary type in the data dictionary of Web Dynpro.
    When I map the model context to controller context, the type is taken as byte[].
    I tried to set the attribute for this field and I got the Illegal Argument Exception error.
    I am using NWDS 7.0.9 and NW04s SP12. Pl help. I am working on this since 10 days but could get no solution.
    The initial exception that caused the request to fail, was:
    <b>java.lang.IllegalArgumentException</b>
    at com.sap.dictionary.runtime.DdTypeBinary.format(DdTypeBinary.java:60)
    at com.sap.dictionary.runtime.DdTypeBinary.toString(DdTypeBinary.java:64)
    at com.sap.tc.webdynpro.clientserver.data.DataContainer.doFormat(DataContainer.java:1405)
    at com.sap.tc.webdynpro.clientserver.data.DataContainer.getAndFormat(DataContainer.java:1098)
    at com.sap.tc.webdynpro.clientimpl.xdp.renderer.data.XfdRenderer.renderAttributes(XfdRenderer.java:370)
    ... 41 more

    Issue with the RAW data types is resolved now. I have changed the data type of the field into String in the dictionary (web dynpro).. I have changed the corresponding getters and setter functions from byte[] to string. And everything working fine now. I got the Illegal Argument exception initially because I was trying to display the binary data type fields on the adobe form or view which I am not supposed to do.
    Also it is better to create separate view attributes in the context to get the values rather than mapping the model attributes directly in the form or view.
    Thank you one and all.
    Regards
    Vasu

  • How to pass data from SAP to JAVA ( very urgent )

    Hi Experts,
    I have worked in ABAP, but now I joined to a new company. Here in my project requirement is as below:
    1. Need to transfer data ( account information ) from SCRM to SAP ( Business partner) using JCO.
    2. Need to transfer material information from SAP to SCRM through JCO.
    for 1st one I got solution in java and JSP , but for 2nd requirement I am unable to get. Can u please help me in this. How to do this and if any code required for this can u send me to me. 
    Very urgent , please help me.
    Thanks in advance,
    HP.

    Hi,
    Follow the below link..
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=crm+jco%27s&cat=sdn_all&start=11
    Award Points If Useful...

  • Extracting data from sap to java application using JCO

    Hi,
    I am new to sap and wanted to know what is the procedure to extract data from  based on the java application client (user defined input from different tables of sap) input and need to manage huge data meaning reading millions of records.kindly help me how to handle this in ABAP.

    Hi,
    Pls chk these links
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ad09cd07-0a01-0010-93a9-933e247d3ba4
    Accessing SAP Tables from a Java application
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/47b6cd90-0201-0010-5aba-b6b7474d4aff
    Java Application ,SAP BW
    <b>***Reward Points if Useful</b>
    Regards
    Gokul

  • Data transfer b/w SAP to Java using IDOC and Interface SAP Jco

    Dear Experts,
    The challenging requirement we are having is, we need to create the interface for data transfer between SAP system and the Java system. The data will be transferred from SAP to java and similarly once some processing done in Java again the details needs to be transferred from Java to SAP.
    For this data transferred we are planning to use IDOC process and for interface "SAP Java connector (Version 3.0.5)" we are planning to use. As per our understanding, from Java side one program needs to be written to connect with SAP as "Registered program". This registered program will appear in SAP GATEWAY automatically and using tRFC, TCP/IP connection both SAP and Java system will be connected.
    In this case we are having some doubts.
    1. The data from SAP is going to be transfered from one Custom transaction (Z tcode). Once "Outbound IDOC" will get triggered and will carry the details. Now the doubt is, whether the data / details will get transfered to JAVA system automatically or we need to perform any other steps from SAP ABAP coding...(like converting in to flat file, XML file and etc) ??
    2. We are planning to install "SAP Jco" in Java server. Is this correct...??
    3. Other than SAP Jco any other softwares needs to be installed or not..??
    4. Since we are going to trigger the "outbound IDOC" from custom transaction, we are planning to develope one program in SE37. Other than this any other program we need to develop or not..??
    5. Any sample Java program for the SAP Jco version 3.0.5 to create the "Registered program" with SAP..? (e.g. SAP Listener program).?
    If anybody has detailed steps or explanation please share it with us.
    Thanks in advance
    Warm Regards,
    VEL

    Hi All,
      For the above mentioned issue, we implemented JCo software in JAVA system and created the JAVA program including SAP logon credential details like Client, User name, password and Language details.
    When this JAVA program was compiled successfully then, that non SAP system will appear in SAP gateway Tcode.
    Once non SAP system started appearing in SAP gateway that means, both SAP & Non SAP are connected automatically.
    Regards,
    Velmurugan P

  • IDOC data transfer SAP to Java using SAP JCo

    Dear Experts,
              The challenging requirement we are having is, we need to create the interface for data transfer between SAP system and the Java system. The data will be transferred from SAP to java and similarly once some processing done in Java again the details needs to be transferred from Java to SAP.
                 For this data transferred we are planning to use IDOC process and for interface "SAP Java connector" we are planning to use. In this case we are having some doubts.
    1. The data from SAP is going to be transfered from one Custom transaction (Z tcode). Once  "Outbound IDOC" will get triggered and will carry the details. Now the doubt is, whether the data / details will get transfered to JAVA system automatically or we need to perform any other steps from SAP ABAP coding...(like converting in to flat file, XML file and etc) ??
    2. We are planning to install "SAP Jco" in Java server. Is this correct...??
    3. Other than SAP Jco any other softwares needs to be installed or not..??
    4. Since we are going to trigger the "outbound IDOC" from custom transaction, we are planning to develope one program in SE37. Other than this any other program we need to develop or not..??
    If anybody has detailed steps or explanation please share it with us.
    Warm Regards,
    VEL

    Hi All,
      For the above mentioned issue, we implemented JCo software in JAVA system and created the JAVA program including SAP logon credential details like Client, User name, password and Language details.
    When this JAVA program was compiled successfully then, that non SAP system will appear in SAP gateway Tcode.
    Once non SAP system started appearing in SAP gateway that means, both SAP & Non SAP are connected automatically.
    Regards,
    Velmurugan P

  • Flow of tables information between sap and java

    How should i pass the table information from sap to java.
    and how to process the data of a table in the java program. i had seen the examples of JCO. BUT I IS VERY CONFUSING (BCOZ I DON'T KNOW JAVA).
    PLZ IF U DON'T MIND SEND ME CODE SNIPPET TO
    1.GET THE TABLE INTO THE JAVA PROGRAM
    2.PROCESSING THE TABLE INFORMATION IN JAVA PROGRAM
    3.MODIFYING THE TABLE INFORMATION IN JAVA PROGRAM
    4.SENDING BACK THE TABLE TO SAP FROM JAVA PROGRAM

    hi,Kondani
    as JCO offers both Client side and server Side programming.
    you can use JCO to connect SAP ABAP.outbound and inbound.
    1) JCO example 5 is about Server side programming java code. And you can see the data mapping is this example.And you must use sm59 to define the connections in SAP before you start.
    2) example 1 is about client side programming.
    try example 1 first. you can get a table from SAP using BAPI.
    Lots of JCO weblog you can see here
    https://www.sdn.sap.com/sdn/search.sdn?contenttype=url&query=jco&selected=9&content=/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fSDN!2fiViews!2fWCM!2fcom.sap.sdn..wcm.search.search_adv%3Fprttheme%3DCSIN%26QueryString=jco%26SearchPluginName=sdn_weblog%26SelectedCustomProps=resourcetype(value=sdn_weblog)
    Regards

  • Flow of tables informaion between sap and java

    How should i pass the table information from sap to java.
    and how to process the data of a table in the java program. i had seen the examples of JCO. BUT I IS VERY CONFUSING (BCOZ I DON'T KNOW JAVA).
    PLZ IF U DON'T MIND SEND ME CODE SNIPPET TO
    1.GET THE TABLE INTO THE JAVA PROGRAM
    2.PROCESSING THE TABLE INFORMATION IN JAVA PROGRAM
    3.MODIFYING THE TABLE INFORMATION IN JAVA PROGRAM
    4.SENDING BACK THE TABLE TO SAP FROM JAVA PROGRAM

    hi,Kondani
    as JCO offers both Client side and server Side programming.
    you can use JCO to connect SAP ABAP.outbound and inbound.
    1) JCO example 5 is about Server side programming java code. And you can see the data mapping is this example.And you must use sm59 to define the connections in SAP before you start.
    2) example 1 is about client side programming.
    try example 1 first. you can get a table from SAP using BAPI.
    Lots of JCO weblog you can see here
    https://www.sdn.sap.com/sdn/search.sdn?contenttype=url&query=jco&selected=9&content=/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fSDN!2fiViews!2fWCM!2fcom.sap.sdn..wcm.search.search_adv%3Fprttheme%3DCSIN%26QueryString=jco%26SearchPluginName=sdn_weblog%26SelectedCustomProps=resourcetype(value=sdn_weblog)
    Regards

  • Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob

    Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
    Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
    I am using the production release of Jdeveloper11G

    Reproduced and filed bug# 7487124
    The workaround is to add a custom converter class to your ViewController project like this
    package oow2008.view;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    import oracle.jbo.domain.DataCreationException;
    public class ClobConverter implements Converter {
         public Object getAsObject(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   String string) {
           try {
             return string != null ? new ClobDomain(string) : null;
           } catch (DataCreationException dce) {
             dce.setAppendCodes(false);
             FacesMessage fm =
               new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                "Invalid Clob Value",
                                dce.getMessage());
             throw new ConverterException(fm);
         public String getAsString(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   Object object) {
           return object != null ?
                  object.toString() :
                  null;
    }then to register the converter in faces-config.xml like this
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
      <application>
        <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
      </application>
      <converter>
        <converter-id>clobConverter</converter-id>
        <converter-class>oow2008.view.ClobConverter</converter-class>
      </converter>
    </faces-config>then reference this converter in the field for the ClobDomain value like this
              <af:inputText value="#{bindings.Description.inputValue}"
                            label="#{bindings.Description.hints.label}"
                            required="#{bindings.Description.hints.mandatory}"
                            columns="40"
                            maximumLength="#{bindings.Description.hints.precision}"
                            shortDesc="#{bindings.Description.hints.tooltip}"
                            wrap="soft" rows="10">
                <f:validator binding="#{bindings.Description.validator}"/>
                <f:converter converterId="clobConverter"/>
              </af:inputText>

  • Error Converting Currency --  Load from SAP ECC / R/3  to BW / BI

    Hi,
    I have a custom extractor pulling data from ECC.
    However, I am getting the following error.
    'Error Converting Currency from USD4 to  on 8/27/2008'
    RSA3 works fine. PSA load fails and the above message can be seen in the application log in ECC.
    Any ideas?
    Points will be assigned.
    Thanks,
    Edited by: Rajen SAP BI on Aug 29, 2008 2:23 AM

    I believe in the transfer rule info object 0currency should be assigned with field from transfer structure which contains Currency . Once the assignment is done , delete data from info cube and reload the data and this time it should give
    corresponding currency along with Amount.
    Once you are able to see the currencies along with amount second step would be to create Currency translation ( RRC1 ) Put description ( Fixed Currency USD )
    Tab page exchange rate : Rate type M
    Source currency : From Data record
    Target currency : Fixed ( USD )
    Time ref. Fixed time ref. (Current datE) ( varies per scenario )
    Save it.
    Or
    Use this function module for converting currency from one format to another format...
    CONVERT_TO_FOREIGN_CURRENCY...

  • Download Stack from SAP Marketplace to my ECC 6.0 (abap+java)

    Hi gurus
    I have a doubt about the process of support package (stack) download. I don´t want downloading from maintenance optimizer, I´m doing this process directly from Sap Marketplace, in first step (1 of 3) I have to select the target stack (which is the stack level that I intend to make an update) and the source target (which is the actually stack level of my system)... Ok I choose them with no problem, the situation and my doubt is below that where I have a check list of "Usage Selection" (image). How can I know which one I must choose for my system... I don´t understand what is that, for instance "Strategic Enterprise Mgmt" ; E-"Recruting" or "EP Core"!!!... etc...
    So how can I know which of these components I need to check to downloading for my system, how can I know that?
    *Image: http://img188.imageshack.us/img188/664/imagem1b.jpg
    Help me please!
    Best regards,
    João Dimas - Portugal

    Hi Sunny,
    Yes ok, I understand that but... I think I didn´t explain what I want to learn/know or you didn´t understant what I want...
    At download windows you see this list:
    ERP Central Component (ECC)                  
    XI Content         
    Strategic Enterprise Mgmt                                  
    Self Services      
    Supplier Relationship Mgmt              
    Extended E-Commerce Components      
    Financial Supply Chain Mgmt              
    cProject Suite      
    E-Recruiting                                                         
    Learning Solution      
    Process Integration (XI)                                   
    Workforce Mgmt Core      
    Business Intelligence                                   
    Portal Content      
    Enterprise Portal                                   
    Easy Document Management      
    EP Core                                                       
    Mobile Infrastructure
    How can I know which of these types I must have choose for my system...? The output of that url doesn´t inform me which of these type I have in my system, it only inform me the master components or in other words which stacks I have in my system (ABAP and JAVA stack´s)!!!
    Best regards,
    João Dimas - Portugal
    Edited by: João Dimas on Jul 2, 2009 2:28 PM

  • Is SAP going from ABAP to Java

    Upto how much extent are following true, i heard from few SAP people.
    1. lot of features currently implemented on ABAP will be shifted to Java gradually.
    2. all the new functionalities  will be preferably developed by SAP in Java instead of ABAP.
    3. in the future, all of the components/features will be in Java instead of ABAP.
    thanks,
    Ganesh.

    > I have a doubt over here ...All the SAP ESS/MSS applications were in Web Dynpro for Java but now they are slowly been converted to Web Dynpro ABAP ..... so is SAP going the other way round ...converting all its previous Java applications back to ABAP?
    Yes - you're right - but that's something many customers highly appreciate, especially in the case, when they enhanced/modified/adapted the pre-ERP ESS/MSS functionality in ABAP which would now needed to be ported over to Java. Due to the conversion back to WD-ABAP they can stay with their current code logic and "just" need to adapt the frontend to WD.
    I heard from quite some (SAP-)people something like
    ABAP --> Service provisioning
    Java --> Service consumption
    so the business logic stays in ABAP but the frontend, that actually uses the functionality, is written in Java.
    IMO the main problem of all that Java stuff is, that there is no consistency about how it's used across the applications. If you e. g. compare ESS/MSS to the BI (the Java parts) then you'll see, that ESS/MSS uses the ABAP customizing to layout the functionality on the portal but the BI uses real functionality to do that. Some applications use JCo, others use WebDynpro connections, others use ICM - just as the application grew up over the time. This makes handling different applications in a portal so utterly cumbersome because you first have to find out, how they connect to backends before there's a chance to find out, why something is not working.
    Another example is e. g. the Redwood scheduler (provided as a basic license for free with each Netweaver license) - the software itself is VERY good but I would never dare to run such a crucial functionality as batch scheduling (on which we highly rely on for our business) on a Web-AS Java in production.
    Markus

  • Connect from SAP gateway to RFC server failed - Java StandAlone app X SAP RAC System

    Dears,
    I'm developing a Java application (RFC SERVER) with JCo3 and I need to connect to SAP RAC system.
    I have configured the TCP/IP connection via transaction SM59, but when I try to start my server I face the error below (dev_jco_rfc.trc):
    ==========================================================================================
    **** Error file opened at 20140714 112024 Brasilia Time Rel 3.0.10 (2013-08-08) [720.440]
    Error:  >Mon Jul 14 11:20:24,636<    RfcException: [null]
        message: Connect from SAP gateway to RFC server failed
    Connection parameters: TYPE=A DEST=VSPAGUE ASHOST=cpe1601 SYSNR=01 SAPROUTER=/H/155.56.49.28 PCS=1
    LOCATION    SAP-Gateway on host ld7624.dmzwdf.sap.corp / sapgw01
    ERROR       hostname 'cpe1601' unknown
    TIME        Mon Jul 14 16:20:25 2014
    RELEASE     740
    COMPONENT   NI (network interface)
    VERSION     40
    RC          -2
    MODULE      /bas/740_REL/src/base/ni/nixxhl.cpp
    LINE        193
    DETAIL      NiHLGetNodeAddr: hostname cached as unknown
    COUNTER     3
        Return code: RFC_FAILURE(1)
        error group: 102
        key: RFC_ERROR_COMMUNICATION
    ==========================================================================================
    This problem happens when my app executes the line:
    JCoServer myServer = JCoServerFactory.getServer(myServerName);
    My system properties:
    jco.client.lang=EN
    jco.destination.peak_limit=10
    jco.client.client=800
    jco.client.passwd=********
    jco.client.user=********
    jco.client.sysnr=01
    jco.destination.pool_capacity=3
    jco.client.ashost=/H/155.56.49.28/H/cpe1601
    jco.server.connection_count=3
    jco.server.gwhost=/H/155.56.49.28/H/cpe1601
    jco.server.progid=VSPAGUE
    jco.server.gwserv=sapgw01
    jco.server.repository_destination=VSPAGUE
    Using SAP Logon i can connect to server cpe1601 system E16 without problems.
    Please, I really need some help, because my knowledge on SAP platform is minimum.

    Hi Markus,
    Changing ASHOST=ld7624.dmzwdf.sap.corp as you have suggested, I got the error message: Connect to SAP gateway failed ...
    As you could see, the host I'm connecting is from SAP RAC Service.
    Here in our company we have only SAP Logon and my RFC Application, and I can connect to SAP remote system via SAP Logon with this settings:
    System Connection Parameters
    Description: SAP ECC 6.0
    Application Server: cpe1601
    Instance Number: 01
    System ID: E16
    SAProuter String: /H/155.56.49.28/H/
    Below the connection information I received from SAP RAC SUPPORT for testing purposes:
        E16 System:
        SID: E16
        Client: 800
        System Number: 01
        Server: cpe1601
        Component Version: SAP ERP Central Component 6.0 Enhancement Pack 6 Suite on HANA
        User: ********
       Password: ********
       SAProuter String:
       If you don't plan to use SAPRouter at your end,
       /H/155.56.49.28/H/    

  • SSO implementation from SAP EP to non SAP application (JAVA Appln)

    I want to implement the SSO from SAP EP to java application i.e. on oracle 10g application server. For this i have downloaded ssoexample with relevant libraries and jsp aswell as java file. But where i need these files to be placed in java application and what all things i have to do on portal as well.
    Regards
    Ashwani

    i don't know, but what i see is, the calling application shd try to do the following... this is the sample code from the blog which i posted earlier.  This application shd have reference for your .so  files.  Now you will get the user details to authenticate.  You can use your API in .so files with these details.
            String systemalias = "system";
             // get user from request
             IUser iuser = request.getUser ();
             // get usermapping service
             IUserMappingService iums = (IUserMappingService)
                PortalRuntime.getRuntimeResources()
                   .getService(IUserMappingService.KEY);
             IUserMappingData iumd = iums
                 .getMappingData (systemalias, iuser);
             Map map = new HashMap ();
             try {
                iumd.enrich (map);
             catch (NoLogonDataAvailableException nldae)   {  
                // ... Error handling
    this is the max i can think.

Maybe you are looking for

  • Getting Error message while deploying the OAF page in custom top

    Hi, I have created a new custom OAFpage(datafileupload).It's working fine when I'm running from Jdeveloper but after deploying the page in application server under custom top($CUSTOM_TOP/java).I'm getting following error. I have deleted all my files

  • Scatter Plot Axis Choice

    Hi folks. Just wanting to make a scatter chart, but she doesn't seem to want to give me what I want. Oh my table, first row has a header, then 4 items. Fourth row has the same: Listings | 50 | 60 | 70 | 80 EPL | 900 | 600 | 450 | 200 How do I turn th

  • Safari Will Not Work Even After Downloading New Version

    Several months ago I experienced a brief power outage and since then Safari has not worked. At All. I have downloaded Safari twice directly from the Apple site and still no luck. THe Software Restore disks with my original OSX package do not seem to

  • Setting multiple values in a preparedStatement

    Hi all, I am working on an application that has a couple of methods that use the same preparedStatement multiple times (in one case 6 or 7 times), (there is also more than 1 preparedStatement in the method) and I was wondering if there is a simple wa

  • How to get my photo files on the left panel for easy access?

    I was watching a informational video about adobe photoshop. I have been opening my pictures file from my computer and dragging the pictures from the my computer window to the project bin and then each picture pops up in a window overlapping eachtothe