How to create a .CSV file & place it  in Application server

Hi All,
I have a requirement like .
1.Create a .CSV file by using report output data.
2.The .csv file should be placed in application server.
When user will execute the report,
automatically a .csv has to generate and that should be available at application server.
points will be rewarded.
Thanks,
Anil

Hi,
  Whatever the final output internal table is there  loop that
DATA : begin of i_final occurs 0,
              field1(20),
              field2(20),
            end of i_final.
DATA : v_filepath (200) TYPE c Value '/data/sapdata/test.csv' .
DATA : begin of i_file_data occurs 0,
              Rec(500),
            end of i_file_data.
LOOP AT i_final.
CONCATENATE i_final-field1  i_final-field2  INTO i_file_data-rec SEPARATED BY ','.
APPEND i_file_data.
CLEAR  i_file_data.
ENDLOOP.
OPEN DATASET v_filepath IN OUTPUT  FOR TEXT MODE.
LOOP AT i_file_data.
  TRANSFER  i_file_data-rec TO  v_filepath.
ENDLOOP.
CLOSE v_filepath.
To check the file goto Tcode->AL11>data/sapdata/test.csv.

Similar Messages

  • How to create a CSV file in java

    how to create a CSV file in java

    this is the code that I have used in a hp project:
    private static final String DELIMIT = ",";
    StringBuffer buf = new StringBuffer();
    public void addString(String str){
    buf.append(toEscapedStringLiteral(str.replaceAll(" ","").trim())).append(DELIMIT);
    public void sendFile( String strData ,
                                String strTitle,
                                String strContType,
                                HttpServletResponse res ) throws IOException {
              byte[] _filedata=strData.getBytes();
              res.setContentType( strContType );
              res.setHeader( "Content-Disposition", "attachment;filename="+ strTitle );     
                     DataOutputStream out = new DataOutputStream( res.getOutputStream() );
              out.write( _filedata, 0, _filedata.length );
              out.close();
    public void addStringWhithReturn(String str){
              buf.append(toEscapedStringLiteral(str.replaceAll(" ","").trim()));
              buf.append( "\n" );
    private String toEscapedStringLiteral( String charSeq ) {
              if ( null == charSeq ) {
                   charSeq = "";
              return "\"" + charSeq + "\"";
    ....hope its help
    kou

  • How to create a csv file with NCS attributes?

    Hi
    i installed Cisco Prime NCS and trying to perform bulk update of device credentials with csv file.
    How to create a csv file with all required attributes?
    This is part of NCS online help talking about this topic:
    Bulk Update Devices—To update the device credentials in a bulk, select Bulk Update Devices from the Select a command drop-down list. The Bulk Update Devices page appears.You can choose a CSV file.
    Note        The CSV file contains a list of devices to be updated, one device per line. Each line is a comma separated list of device attributes. The first line describes the attributes included. The IP address attribute is mandatory.
    Bellow is test csv file i created but does not work:
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    The error i am getting while importing this file:
    Missing mandatory field [ip_address] on header line:10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    Assistance appreciated.

    It looks like the IP address field is incorrectly set.,
    It should be as follows
    {Device IP},{Device Subnet Mask}, etc etc
    so a practical example of the aboove could be (i dont know if this is completely correct after the IP address / Subnet Mask)
    10.64.160.31,255.255.255.0,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    below is a link to the documentation
    http://www.cisco.com/en/US/docs/wireless/ncs/1.0/configuration/guide/ctrlcfg.html#wp1840245
    HTH
    Darren

  • How to create a .exe file for a java application

    Hi, I want to create a .exe file for a java application I am developing so that I can schedule it to run at a particular time using Windows Scheduler on WinNT. Is there any way to accomplish this? Or is there any other way in which a Java application can be scheduled to run at a particular time on Windows everyday?

    Create a .bat file and run that. Just have, in the .bat file:
    java YourClassName Alternatively, you can use javaw YourClassName (without *.bat, just put it into Windows Scheduler like suggested above).
    using javaw won't pop up any window...

  • How to store a JSP file in the SAP Application server ?

    Hello All,
    My reqt. is as follows :
    1. I need to store a JSP File on the SAP Application server .
    How can I do this ?
    2. I want to call the uploaded jsp file from the server and call this jsp from abap to view the result of it .
    How can I achieve this ?
    First of all is this possible ?
    Regards,
    Deepu.K

    Hello Mike,
    Thanks for ur reply.
    I've imported the JSP as a mime object into the BSP.
    Now I've created the page to show that Mime Object as an image.
    But nothing is coming as an output.
    But then,there is an option for that mime object. i.e when I right click on the mime object there is an option called " convert to BSP".
    I selected that option and it created a view in my BSP .( My BSP is a page with flow logic application )
    Now how should i make this view to be an output ?
    I guess this shud be posted in the BSP Forum ...but still taking a chance here :)-
    Regards,
    Deepu.K

  • How to add a CSV file to a desktop application and access it?

    I'm writing a desktop application for looking up phone numbers (this numbers are stored in a .CSV file). Where should I put the file in the project and how to access it? I intend to put it in the project and open it in a buffered reader!
    Thanks!

    The best place to put application data is probably user.home, as described in the [Store Application Settings and Components|http://sdnshare.sun.com/view.jsp?id=2305] post at SDNShare.
    If those listings are still messed up, try these alternate renderings of [AppStore.java|http://pscode.org/fmt/sbx.html?url=/test%2FAppStore.java&col=2&fnt=2&tab=2&ln=0] & [AppStoreDemo.java|http://pscode.org/fmt/sbx.html?url=/test%2FAppStoreDemo.java&col=2&fnt=2&tab=2&ln=0].

  • How to create a exe file from a Java application

    hi,
    i have developed an application in java,now i want to distribute it to my client, for this i need to build a .exe file out of this application.
    i already have a jar file ,now can i convert a jar file to a exe file.
    im trying this out with JSmooth project but im getting it right, so can anyone help me .
    thanks,
    vishal j

    if u use dos to run your app like
    "java myapp"
    u can create a shortcut link
    in target wright java remove the path
    just leave the file name without the extension,
    like this Target: "java myapp"
    when u click on appy u'll c that java gets its full path, thats fine
    that works 4 me, ofcourse ur client needs to have JRE or JDK.

  • How to create the deployment descriptor with the sun application server

    I have packaged my .war and ejb-jar files. I go to autodeploy and it says i need a deployment descriptor?

    this is actually an example .ear file that i am trying to run. When i create the client with the deploytool that comes with suns application server i get
    C:\appclient>appclient -client swe645-appClient.jar
    Caught an unexpected exception!
    javax.naming.NameNotFoundException: EditEmpBean not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.
    java:185)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.ja
    va:157)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialCont
    extProviderImpl.java:101)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(Reflecti
    veTie.java:123)
            at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
    tchToServant(CorbaServerRequestDispatcherImpl.java:648)
            at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
    tch(CorbaServerRequestDispatcherImpl.java:192)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    Request(CorbaMessageMediatorImpl.java:1709)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    (CorbaMessageMediatorImpl.java:1569)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(C
    orbaMessageMediatorImpl.java:951)
            at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.call
    back(RequestMessage_1_2.java:181)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    (CorbaMessageMediatorImpl.java:721)
            at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatc
    h(SocketOrChannelConnectionImpl.java:473)
            at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(
    SocketOrChannelConnectionImpl.java:1262)
            at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.
    run(ThreadPoolImpl.java:409)

  • How to see the log file on the Reports Application server?

    Hi,
    I am new to this Reports, please correct me if i am wrong or in the wrong forum, we have a java based front-end application which calls oracle reports to display requested reports. We are using oracle reports (9i/10g). I need work on a report, It is working fine if i provide parameters on the report itself, but if i run from the application it is not running properly. I want to see the parameters the application is sending to this report, is there any way that i can some log file or any other one on the report server?
    thanks,

    Thank you.
    When you fire the processes to the report server you
    can trace the report with the following parameter:
    RWCLIENT.EXE SERVER=my_server
    TRACEFILE=c:\my_trace.trc
    TRACEMODE=TRACE_REPLACE
    TRACEOPTS=TRACE_ALL

  • How to create a PAR file in Web Dynpro

    Hi !!
    Could any one tell me how to create a par file of the java application developed in WebDynpro..
    thanks
    ChandraSekar Maheswaran

    Hi,
    Refer the link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/a-c/creating%20your%20first%20web%20dynpro%20application.pdf
    Webdynpro concepts
    Regards,
    Tamil K

  • How to create a war file of web application

    Hi Techies
    How to create a war file of the web application?
    And plz tell me the utilities used for it.

    hi,
    To compress a 'abc' web application into a "Web Archive" file named abc.war, follow the steps below:
    1> Open a command prompt and cd to the application's dir:
    <TOMCAT_HOME>\webapps\abc
    2> Use the java archive command 'jar' to bundle up your application:
    jar -cvf abc.war *
    3> Move this to any other server and work with it!! :)
    -- Abdel Raoof Olakara
    http://olakara.googlepages.com

  • How to write a CSV file in OSB

    Hi All,
    can any one tell me How to write a CSV file in OSB?
    Thanks.

    Hey, I couldnot find any xsl usage inside pipeline pair in the links given by you. Do you have any links that gives a sample example.I could not find any links with examples. I will send you a simple config jar demonstrating the use of XSLT resources/transformations.
    secondly should MFL doc replicate the name(s)of the nodes of the source xsd:I'm not sure If I understood your question.Can you please explain?
    Ex: My database schema looks like:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="CountriesCollection" type="CountriesCollection"/>
    <xs:complexType name="CountriesCollection">
    <xs:sequence>
    <xs:element name="Countries" type="Countries" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Countries">
    <xs:sequence>
    <xs:element name="countryId">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="2"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="countryName" minOccurs="0" nillable="true">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="40"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="regionId" type="xs:decimal" minOccurs="0" nillable="true"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    and the corresponding MFL that I have created gives this output
    <?xml version="1.0" encoding="windows-1252"?>
    <countriesCollection1>
    <Countries>
    <counrtyId>counrtyId</counrtyId>
    <country_name>country_name</country_name>
    <regionId>regionId</regionId>
    </Countries>
    <Countries>
    <counrtyId>counrtyId</counrtyId>
    <country_name>country_name</country_name>
    <regionId>regionId</regionId>
    </Countries>
    </countriesCollection1>
    Why I am asking this beacuse there is an error that i am getting:
    Jun 19, 2009 5:50:50 PM IST> <Error> <JCATransport> <BEA-381951> <JCA inbound r
    quest only invocation failed, exception: java.security.PrivilegedActionExceptio
    : com.bea.wli.sb.transports.TransportException: Binary to XML mfl transformatio
    failed for the MFL Resource Database-Jms-File/Database-File/MFLSample : null
    ava.security.PrivilegedActionException: com.bea.wli.sb.transports.TransportExce
    tion: Binary to XML mfl transformation failed for the MFL Resource Database-Jms
    File/Database-File/MFLSample : null..................................................
    Any help?
    Regards
    PS

  • How to write to csv file - Whats wrong with this???

    Hi ALL,
    I created a view that does all sorts of calculations, now I need to write the output in csv file. How do I do this thru a procedure? Sorry I've never had to create a csv file before and this is my first time.
    Thanks!
    Edited by: user5737516 on Nov 18, 2009 9:47 AM

    What is wrong with this?? Am I supposed to do something else before I could run this?
    CREATE OR REPLACE DIRECTORY PAYROLL as 'c:\';
    Directory created.
    grant read, write on directory PAYROLL to my_user;
    Grant succeeded.
    CREATE OR REPLACE PROCEDURE baninst1.PAY_CSV(p_year NUMBER, p_qtr NUMBER) AS
      CURSOR c_data IS
        SELECT pay_period,
               pay_group,
               p_qtr,
               check_date,
               SUM(soc_sec_gross) as SOC_SEC_GROSS,
               SUM(medicare_gross) as MEDICARE_GROSS,
               SUM(TOTAL_DEDUCTIONS) as Total_Deductions,
               SUM(NET_PAY) as Net_Pay
        FROM   baninst1.pzvdedn
        WHERE  pay_year = p_year
        AND        p_qtr = p_qtr
        GROUP BY pay_period, pay_group, check_date, pay_qtr
        ORDER BY pay_period, pay_group, check_date, pay_qtr;
      v_file  UTL_FILE.FILE_TYPE;
    BEGIN
      v_file := UTL_FILE.FOPEN('PAYROLL',
                               'pay_csv.csv',
                               'w',
                               max_linesize => 32767);
      FOR cur_rec IN c_data LOOP
        UTL_FILE.PUT_LINE(v_file,
                          cur_rec.pay_period    || ',' ||
                          cur_rec.pay_group    || ',' ||
                          cur_rec.check_date     || ',' ||
                          cur_rec.soc_sec_gross      || ',' ||
                          cur_rec.medicare_gross || ',' ||
                          cur_rec.total_deductions    || ',' ||
                          cur_rec.net_pay);
      END LOOP;
      UTL_FILE.FCLOSE(v_file);
    EXCEPTION
      WHEN OTHERS THEN
        UTL_FILE.FCLOSE(v_file);
    END;
    Procedure created.
    SQL> exec baninst1.PAY_CSV(2009,1);
    BEGIN baninst1.PAY_CSV(2009,1); END;
    ERROR at line 1:
    ORA-20003: File could not be opened or operated on as requested.
    ORA-06512: at "BANINST1.PAY_CSV", line 45
    ORA-06512: at line 1Edited by: user5737516 on Nov 18, 2009 9:16 AM
    Edited by: user5737516 on Nov 18, 2009 9:18 AM
    Edited by: user5737516 on Nov 18, 2009 9:20 AM
    Edited by: user5737516 on Nov 18, 2009 9:35 AM

  • Getting CLOB fron Database then creating a CSV File

    Hi,
    I am trying to read a CLOB for the DB in my Backing Bean with the help of EJB.
    The code in my backing bean is:
    char[] strReportContent = reportObj.getReportText();The API where the accessors for getReportText() is;
      @Lob
      @Column(name="REPORT_TEXT")
      public char[] getReportText()
        return reportText;
      public void setReportText(char[] reportText)
        this.reportText = reportText;
      }The problem is that when I do a system out on strReportContent I get a garbage value and not what is in the DB.
    Please Help.
    Then to render it on the CSV the code is:
      // Init servlet response.
          response.reset();
          response.setContentType("plain/text");
          // response.setContentLength(input.available());
          response.setHeader("Content-disposition",
                             "inline; filename=\"" + selectedReportId.getReportName() + "\"");
          output =
              new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
    char[] strReportContent = reportObj.getReportText();
    output.write(strReportContent.toString().getBytes(), 0, strReportContent.length);

    Hi,
    I am not removing any zeroes . I created the same file in .txt format and XI was able to write the value 008.2010 to the txt file.
    I suppose this has somehting to do with excel file properties . By default when we add 008.2010 in the excel sheet , it takes only 8.201. We need to change the format to "text" manually in the excel file to take in zeroes as well.
    So , i really dont know how to make sure that the excel file properties does not truncate zeroes while XI is creating the CSV file.
    Regards
    Vinay P.

  • How get a correct CSV file

    Hi,
    I've this table:
    CREATE TABLE TAB_BW (
    COD VARCHAR2 (2),
    COD_ID VARCHAR2 (20),
    DESCRIPTION VARCHAR2 (64),
    AREA NUMBER);
    with these data:
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '00', '000099', 'MY HOME', 21.654);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '01', '001234', 'MY HOME, MY DOG', 2111.3232);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '11', '033333', 'OK, NO', 1222.22);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '03', '111111', 'NOW', 12);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '05', '000001', 'GOOD BYE', 1234567.34234);
    Now I'd like to create a CSV file with these data
    I created this pl/sql stored procedure:
    CREATE OR REPLACE procedure BW is
    file_a sys.utl_file.file_type;
         file_l sys.utl_file.file_type;
    DATA_ELAB varchar2(50);
    MSG varchar2(200);
    directory varchar2(50) := 'C:\EXTRACT';
    file_name varchar2(50) := 'BW';
    VAR_COD VARCHAR2(66);
    VAR_COD_ID VARCHAR2(20);
    VAR_DESCRIPTION VARCHAR2(64);
    VAR_AREA VARCHAR2(64);
    CURSOR CUR_IMM IS
    SELECT COD,
    COD_ID,
    DESCRIPTION,
    AREA
    FROM TAB_BW;
    PROCEDURE GET_DATA_DAY IS
    begin
         SELECT to_char(SYSDATE,'Day dd Month yyyy * hh24:mi:ss')
    INTO DATA_ELAB
    FROM DUAL;
    end GET_DATA_DAY;
    PROCEDURE OPEN_FILE IS
    BEGIN
    file_a :=
    sys.utl_file.fopen(directory,file_name||'_'||TO_CHAR(SYSDATE,'DD_MM_YYYY')||'.
    csv','w');
    END OPEN_FILE;
    PROCEDURE CLOSE_FILE IS
    BEGIN
    sys.utl_file.fclose(file_a);
    END CLOSE_FILE;
    PROCEDURE NOT_FOUND IS
    BEGIN
    sys.utl_file.put_line(file_l,('DATA NOT FOUND'));
    END NOT_FOUND;
    PROCEDURE WRITE_DATA IS
    BEGIN
    sys.utl_file.put_line(file_a,VAR_COD||','||VAR_COD_ID||','||VAR_DESCRIPTION||'
    ,'||VAR_AREA);
    END WRITE_DATA;
    BEGIN
    OPEN_FILE;
    GET_DATA_DAY;
    OPEN CUR_IMM;
    IF (CUR_IMM%NOTFOUND)
    THEN
    NOT_FOUND;
    ELSE
    LOOP
    FETCH CUR_IMM INTO VAR_COD,
    VAR_COD_ID,
    VAR_DESCRIPTION,
    VAR_AREA;
    EXIT WHEN (CUR_IMM%NOTFOUND);
    WRITE_DATA;
    END LOOP;
    END IF;
    CLOSE CUR_IMM;
    GET_DATA_DAY;
    CLOSE_FILE;
    END BW;
    but when I open the file BW.csv
    I get these output:
    COD......COD_ID...........DESCRIPTION...........AREA
    00.......000099...........MY HOME...............21.654
    01.......001234...........MY HOME...............MY DOG...........2111.3232
    11.......033333...........OK....................NO................1222.22
    03.......111111...........NOW....................12
    05.......000001...........GOOD BYE...............1234567.34234
    I'd like to get this output when I open the file BW.csv:
    COD......COD_ID...........DESCRIPTION...........AREA
    00.......000099...........MY HOME...............21.654
    01.......001234...........MY HOME, MY DOG.......2,111.3232
    11.......033333...........OK, NO................1,222.22
    03.......111111...........NOW....................12
    05.......000001...........GOOD BYE...............1,234,567.34234
    How Can I modify my procedure to get this output?
    Thanks in advance!

    MY HOME and MY DOG
    OK and NO
    are in separated columns
    I'd like to have it in same columnsEnclose the strings in double quotes
    Something like
    00.......000099..........."MY HOME"...............21.654Two more thing I just noticed:
    - Some of your rows seems to have 5 columns instead of 4
    - Excel is going to convert your Id to Numbers; 000 will be displayed as 99
    By the way your format is just a fixed-length format but not a CSV-format.
    CSV (comma separated values) would be something like
    "COD";"COD_ID";"DESCRIPTION";"AREA"
    "00";"000099";"MY HOME",21.654

Maybe you are looking for

  • Regarding The Discover Reports

    Hi, CAn any body can get me the setup file for downloading the Discover reports Thank you

  • Wide screen problem with my humax

    Hi Am aware this is not a BT vision problem but any help appreciated. Just connected a new TV to Vision box and Humax Freesat HD. For the HD box switched to hdmi connection but can't get a full screen resolution, tried going to settings etc...The TV

  • Add custom list UIBB in standard BS_OVP_SP application

    Hi All, Can anyone please tell me how we can add one custom (z component) in standard OVP aapplication named (BS_OVP_SP). step by step process. Thanks ashutosh

  • InDesign CS6 crashing as it starts up

    I have had this problem all day. I have repaired my permissions and repaired my disk already. I've tried reseting the preferences, too. As soon as I hit the yes button to reset, it crashes again. I'm on a Mac so I have this crash report to share. Any

  • Installed Maverick, how do I get my iPhoto back

    I "upgraded" to Maverick and now find that iPhoto is completely missing, how dom I get it back? off topic, and is my mailroom ever so screwed up since the "upgrade" What's going on with Apple?