Is it possible to generate a report in CSV/text format ?

Hello , I received a request from a client to generate a report in CSV/text format ? Is it possible ?
How should I do it ? Thanks.

Hi!
If i understood right, you want to generate a .csv-file from all item-values and records in your / customers form:
So try this procedure:
procedure write_csv_file( p_csv_file in varchar2,
                          p_block    in varchar2 ) is
l_file      client_text_io.file_type;
l_item      varchar2(61) := p_block || '.' || get_block_property ( p_block, first_item );
l_tmp_str   varchar2(32000);
l_delimeter varchar2(1) := ';';  --> change as you need (',' or char(9) for tab)
l_cnt       pls_integer := 1;
l_too_big   exception;
begin
l_file := client_text_io.fopen ( p_csv_file, 'W' );  --> existing file will be deleted!
if
  NOT client_text_io.is_open ( l_file )
then
  message ( 'File ' || p_csv_file || ' could not be opened for writing. Please check filename and path.' );
  message ( ' ' );
  return;
end if;
for l_rec in ( select :system.cursor_block cur_block from dual ) loop --> this one-count-loop is just for Steve C.
                                                                     --> spare one variable and plenty of ram ;-)
  if
    :system.cursor_block != upper ( p_block )
  then
    go_block ( p_block );
  end if;
  first_record;
  loop
    loop
      if
        get_item_property ( l_item, item_type ) in ( 'TEXT ITEM', 'LIST', 'RADIO GROUP', 'CHECKBOX', 'DISPLAY ITEM' )
      then
        if
          length ( l_tmp_str || name_in ( l_item ) || l_delimeter ) > 32000
        then
          raise l_too_big;
           end if;
        l_tmp_str := l_tmp_str || name_in ( l_item ) || l_delimeter;
      end if;
      exit when     l_item = p_block || '.' || get_block_property ( p_block, last_item );
      l_item := p_block || '.' || get_item_property ( l_item, nextitem );
    end loop;
    client_text_io.put_line ( l_file, l_tmp_str );
    l_tmp_str := null;
    exit when :system.last_record = 'TRUE';
    next_record;
    l_item := p_block || '.' || get_block_property ( p_block, first_item );
    l_cnt := l_cnt + 1;
  end loop;
  go_block ( l_rec.cur_block );
end loop;
client_text_io.fclose ( l_file );
message ( l_cnt || ' record/s written to ' || p_csv_file );
message ( ' ' );
--> if you don't use webutil, comment out or delete the following line
--> in forms 6i use host instead of webutil_host.nonblocking.
--> it starts the csv_file-mimetype attached application
webutil_host.nonblocking ( 'cmd /c start ' || p_csv_file );
exception when
  l_too_big
then
  client_text_io.fclose ( l_file );
  message ( 'Error: The amount of data in record ' || l_cnt || ' exceeds the max. length of 32000 characters. Your file is not complete.' );
  message ( ' ' );
when
  others
then
  client_text_io.fclose ( l_file );
  message ( 'Error ' || sqlerrm || ' in write_csv_file Procedure.' );
  message ( ' ' );
end;You can call this procedure in your when-button-pressed-trigger like:
begin
write_csv_file( 'c:\temp\test.csv', :system.cursor_block );
end;Hope this is what you are looking for.
Regards

Similar Messages

  • Error when generating the report (see long text), Message no. AQ_AD_HOC221

    Hi All,
    I am facing a peculiar problem while executing an infoset query.I have created 2 customized fields Compa-ratio and PIR in infotype 0008 in an infoset.I have coded in these additional fields.
    When I execute a query using 1 of these customized fields the report is generated correctly.But when I put both the fields in the output the report shows an error "Error when generating the report (see long text)". The message# associated with this errAQ_AD_HOC221.
    I have also checked the data types and the references. Nothing seems to be wrong here.
    Does anybody has any clue about this ?
    Kajal

    Hi Bernd,
    I had a look at those notes. But the information provided did'nt prove to be helpful. I found out the problem. I was using the same local variable for both the fields in their code. This generated the error. This error is a very generic one and does'nt help in finding out what exactly is the problem.
    I changed the other local variable and it started working. When I was using the same variable that time I did'nt forget to clear the values but the query still generated the error.
    Anyways thanks a lot for the reply.
    Kajal

  • DMEE tree:it's possible to generate more files using one DMEE format tree?

    Hello Expert,
    I have a question and i need you help.
    It's possible to generate two files with one DMEE format tree? If yes, how can i do it?
    Thank you in advance.
    Amal

    In DMEE we define the structure ie the kind of feilds that needs to be populated.As far as my knowledge I think one DMEE tree can be used to create one file FORMAT
    Thanks,
    K.Kiran.

  • Is it possible to generate a report without supplying the Hierarchy Id and Entity Ids?

    Hi,
    I'm new to this Chargeback JAVA API.
    What I wanted was to create/generate a report without having to provide a hierarchy id or entity id.
    It's like more of a dump report for all the hierarchies and entities managed by the Chargeback server.
    Thanks.

    Thanks Diwakar.
    I would be doing something like this then...
    HierarchyManagerImpl hm = HierarchyManagerImpl.getInstance();
    List hierarchiesList = hm.getAllHierarchies(cbClient);
    //loop hierarchiesList
        // HierarchyEntitiesType entityType = hierarchiesList [n].getEntities()
       // entityType.getEntities()
    How do I determine if this "entity" is a "vCenter Server entity" and not "vCenter Chargeback Manager entity"?
    Im quite confused on the following classes and please confirm if getting the steps for getting the attribute value is correct:
    HierarchyType
    HierarchyEntitiesTypethis has a getEntity() which returns a list of:
    HierarchyEntityTypethis has a getAttributes() which returns
    EntityAttributesTypethis has has a getAttribute() which returns
    EntityAttributeType
    does invoking getValue() return 101 for Chargeback Manager entity or 0 for vCenter Server entity? (based on cbm_users_guide_2_0_0.pdf, Table 4-1. p57)
    Thanks heaps for any help.

  • Is it possible to output a report as a text file (.txt) in a Data Driven Subscription?

    Is it possible to create a Data Driven Subscription report as a text file output to a shared folder? Thanks.
    Kahlua

    Hi Vicky:
    Thank you for your reply. I changed the config file in SSRS and it works. I managed to generate a text file with Data Driven Subscription as the report output in a shared folder. However is it possible not to have the "double quote" wrapping around
    the text. Do I need to modify the config file to remove the "double quote" and how. Thanks. 
    Kahlua
    <Render>
    <Extension Name="XML" Type="Microsoft.ReportingServices.Rendering.DataRenderer.XmlDataReport,Microsoft.ReportingServices.DataRendering"/>
    <Extension Name="NULL" Type="Microsoft.ReportingServices.Rendering.NullRenderer.NullReport,Microsoft.ReportingServices.NullRendering" Visible="False"/>
    <Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering"/>
    <Extension Name="PDF" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer,Microsoft.ReportingServices.ImageRendering"/>
    <Extension Name="TAB" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <OverrideNames>
    <Name Language="en-US">TAB (Tab Delimited Text File)</Name>
    </OverrideNames>
    <Configuration>
    <DeviceInfo>
    <FieldDelimiter xml:space="preserve">[TAB]</FieldDelimiter>
    <UseFormattedValues>True</UseFormattedValues>
    <NoHeader>True</NoHeader>
    <FileExtension>txt</FileExtension>
    <Qualifier xml:space="preserve"></Qualifier>
    <ExcelMode>False</ExcelMode>
    </DeviceInfo>
    </Configuration>
    </Extension>
    <Extension Name="RGDI" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.RGDIRenderer,Microsoft.ReportingServices.ImageRendering" Visible="False" LogAllExecutionRequests="False"/>
    <Extension Name="HTML4.0" Type="Microsoft.ReportingServices.Rendering.HtmlRenderer.Html40RenderingExtension,Microsoft.ReportingServices.HtmlRendering" Visible="False" LogAllExecutionRequests="False"/>
    <Extension Name="MHTML" Type="Microsoft.ReportingServices.Rendering.HtmlRenderer.MHtmlRenderingExtension,Microsoft.ReportingServices.HtmlRendering"/>
    <Extension Name="EXCEL" Type="Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering"/>
    <Extension Name="RPL" Type="Microsoft.ReportingServices.Rendering.RPLRendering.RPLRenderer,Microsoft.ReportingServices.RPLRendering" Visible="false" LogAllExecutionRequests="false"/>
    <Extension Name="IMAGE" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering"/>
    <Extension Name="WORD" Type="Microsoft.ReportingServices.Rendering.WordRenderer.WordDocumentRenderer,Microsoft.ReportingServices.WordRendering"/>
    </Render>

  • Any way to generate trace report from the TKPROF formatted trace file?

    As titled.
    Is there any automatically way to make a report on SQL tuning report from the TKPROF formatted trace file(or from the dynamic performance views)
    Paul

    Dave,
    That's what report queries are for, take a look at shared components. Walk through the create report query wizard, and on the final page, you'll get a URL that you can use to integrate this with your page. You'll find the same URL when editing your report query afterwards.
    Alternatively, suppose you already have you report page, but don't want to always go there, you can just copy that report region print link (reference my answer to your previous question), and make that the target of a branch or from another page.
    Regards,
    Marc

  • Report output in text format

    Using Report Builder 9.02. My customer wants to have the report output to be generated to a file (preferably text vs. RTF). Then they want to be able to open the output file in MS Word and be able to cut and paste selected pages of the report to another Word documdnt. How do I best do this keeping as much of the same font and objects (underlining of headers, etc.) defined in the report as possible? What printer definition should I use? Should the format be character mode? SHould the report be generated to Previewer first, the generated to a file? Any input would be greatly appreciated, and I thank you in advance.

    Hi Patricia
    and be able to cut and paste selected pages of the report to another Word documdnt...I suggest that you create a report that generates just the selected pages of the report instead of the indirect means that you want to follow. The query must be written in such a way that only the required data are fetched out of the database.
    If you generate to text file, you will loose all the formatting information. It will be intact only if you generate to "Bitmap" formats such as PDF, HTMLCSS and RTF.
    Hope this helps.
    Regards
    Sripathy Rao

  • How to create reports of rich text format usuing oracle pl/sql - urgent

    I want to generate reports of the format rich text format usuing pl/sql,So can any one help me out on this...

    946903 wrote:
    I want to generate reports of the format rich text format usuing pl/sql,So can any one help me out on this...There is no "urgent" here.
    "Urgent" means one of two things -
    1) people are dying, or
    2) you have a customer-facing, revenue-producing production system that is down.
    (And to get some perspective on the second case, keep the first in mind.)
    For the first, you call whatever civil emergency service seems appropriate.
    For the second, you open an SR with Oracle - which requires a paid-up support contract. For them to consider your problem "urgent", you will need to demonstrate that your problem falls under item #2. I seriously doubt your problem fits that criteria.

  • Crystal report : Export to Text format from BI Launch pad

    Hi,
    We are facing issue in exporting the Crystal report to text format option from BI Launch pad view mode. Currently BI launch pad doesn’t support export to Text format option for crystal report in view mode. But export to text format option is feasible in schedule mode. But customer is not interested in exporting the reports through schedule mode.
    Please advise, if we have any alternative way of exporting the crystal report to text format option from BI Launch pad.
    Thanks,
    Chinnu A

    Hi Chinnu,
    The question is better suited to be asked in the BI Platform space.
    -Abhilash

  • Schedule Webi report to CSV - text qualifier

    Hi
    We are running the latest version of Business Objects 4.0 SP04 (FP3) with Patch 1.
    I am having a problem scheduling a Webi report to CSV format. The text qualifier option only allows the choice of ' (single quote). Not only is the text qualifier on text fields - it's also on numeric fields. This obviously causes a problem for Excel and other systems.
    Is there a way of removing or replacing this text qualifier or preventing numeric fields from been wrapped with the text qualifier?
    We are not having this problem with the interactive "Save as - TXT file" option.
    Thanks for any input on this.
    Kieran

    Hi Experts,
    Seeking your opinion on the following issue,
    We are in version SAP BO 4.0 SP 4 Update
    While trying to schedule a report with as CSV, the only option available as the Text qualifier is single quote ( ' ). Any sort of clue on why we don't see the option "None" listed in the combo?
    Thanks,
    Thilani

  • Is it possible to generate multiple reports output in single click

    Hi All,
              I am using OBIP 10.1.3.4.1
              I am having 5 reports in a folder. I want to generate all the 5 reports output in a single.
              Is there any possibilities to do it.
    Regards
    Balaji

    Hello Balaji,
    You can schedule the reports at the same time and send the output on the e-mail.
    You cannot use Interactive View for viewing 5 outputs on the same time.
    Regards,
    Liviu

  • RWRBE60.exe error when generating a report to a file format

    Hi people,
    I'm employed as a consultant by a major Petrochemical facility in South Africa.
    My problem is as follows:
    Our product dispatching system contains a number of reports which need to be generated to a file format (either PDF, RTF or Text).
    Whenever one of the users attempts to do the above in the Reports Previewer
    (by clicking on "File" -> "Generate to File" -> "Text"); the following error is displayed:
    "RWRBE60.exe - Application Error. The instruction at 0x00281036 referenced memory at 0x00000000. The memory could not be read."
    This error only occurs when they attempt to run a report through the Application itself.
    I've recompiled and executed the same report(s) using Reports Builder 6, and it generates the file(s) with no problems whatsoever!
    Only when running said reports through the Production application, does this error appear.
    Your feedback will be highly appreciated!
    Thanks!

    This certainly looks like a bug, but you should probably check and make sure that you're on the latest patch set (or at least patch set 10 - Reports 6.0.8.19) before contacting support and pursuing further.
    Hope this helps,
    Danny

  • How to download a report into CSV file format?.

    Hello all,
    I have a requirement like this.
    I have one custom Report. I need to download this report output into CSV format. In the selection screen, i am giving the pathname where report output need to be saved. Please let me know how to do it..
    Thanks in advance....
    Regards
    Ravi

    TYPE-POOLS: truxs.
    TYPES:
      BEGIN OF ty_Line,
        vbeln LIKE vbap-vbeln,
        posnr LIKE vbap-posnr,
      END OF ty_Line.
      ty_Lines TYPE STANDARD TABLE of ty_Line WITH DEFAULT KEY.
    DATA: itab   TYPE ty_Lines.
    DATA: itab1  TYPE truxs_t_text_data.
    SELECT
      vbeln
      posnr
      UP TO 10 ROWS
      FROM vbap
      INTO TABLE itab.
    CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
      EXPORTING
        i_field_seperator    = ';'
      TABLES
        i_tab_sap_data       = itab
      CHANGING
        i_tab_converted_data = itab1
      EXCEPTIONS
        conversion_failed    = 1
        OTHERS               = 2.
    IF sy-subrc &lt;&gt; 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename = 'C:\TEMP\test.txt'
      TABLES
        data_tab = itab1
      EXCEPTIONS
        OTHERS   = 1.
    I found this in the blogs ....reward if it helps

  • How to generate a report in swing

    Hi
    I Would like to generate a report in the following formate. Could you please help me By providing some Sample code.
              BOSCO COLLEGE LIBRARY
                Book Details
    BookID | Book Name |  Book Author| Refrence/Non Reference
    ---------------------------------------------------------here the details should come from the Database.
    Thank you very much

    hi
    i tried out your idea, It is working well But here with me the Problem is I am not able to align the Page with in the A4 Sheet and then Roport Heading is shown at the CENTER on the Screen But while Printing at the Papar it is going to the Top Right Corner. Here i am posting My code please check it and give me Solution for it
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.util.Vector;
    import java.sql.*;
    import java.util.*;
    import java.text.*;
    import java.io.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    public class Report extends JFrame implements Printable, ActionListener{
         JPanel headerPanel,titlePanel,dataPanel,btnPanel,masterPanel;
         String headerStr,titleStr;
         JTable table;
         DefaultTableModel dtm;
         Vector dataVector,temp,colVec;
         JScrollPane scrollPane;
         JLabel headerLabel,titleLabel;
         private JButton btnprint, btncancel;
         private Connection con;
         private Statement st;
         // Founction FOR PRINTING
           public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
            if (page > 0) { /* We have only one page, and 'page' is zero-based */
                return NO_SUCH_PAGE;
            /* User (0,0) is typically outside the imageable area, so we must
             * translate by the X and Y values in the PageFormat to avoid clipping
            Graphics2D g2d = (Graphics2D)g;
            g2d.translate(pf.getImageableX(), pf.getImageableY());
            /* Now print the window and its visible contents */
            masterPanel.printAll(g);
            /* tell the caller that this page is part of the printed document */
            return PAGE_EXISTS;
         public Report(Connection con){
              headerPanel=new JPanel();
              headerPanel.setLayout(new BorderLayout());
              titlePanel=new JPanel();
              titlePanel.setLayout(new BorderLayout());
              dataPanel=new JPanel();
              dataPanel.setLayout(new BorderLayout());
              //you can take dynamic values here..
              headerStr="DON BOSCO SCHOOL LIBRARY";
              this.setSize(750,500);
              titleStr="Book Details";
              //Creating button for print
              btnprint= new JButton("Print");
              btnprint.addActionListener(this);
              btncancel = new JButton("Cancel");
              btncancel.addActionListener(this);
              btnPanel = new JPanel();
              btnPanel.add(btnprint);
              btnPanel.add(btncancel);
              //getContentPane().add(btnPanel,BorderLayout.SOUTH);
              colVec=new Vector();
              dataVector=new Vector();
              headerLabel=new JLabel(headerStr);
              headerLabel.setHorizontalAlignment(SwingConstants.CENTER);
              titleLabel=new JLabel(titleStr);
              titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
              headerPanel.add(headerLabel,BorderLayout.NORTH);
              headerPanel.add(titleLabel,BorderLayout.CENTER);
              table=new JTable();
              //table=new JTable();
              //write your code to get details from database and return in vector if possible
              //I am giving static values here it here
              try
                   st=con.createStatement();
                   ResultSet rs=st.executeQuery("Select * from Books");
                   ResultSetMetaData md= rs.getMetaData();
                   int columns =md.getColumnCount();
                   String booktblheading[]={"BOOK ID","BOOK NAME","AUTHOR","REFERENCE","CATEGORY"};
                   for(int i=1; i<= booktblheading.length;i++)
                        colVec.addElement(booktblheading[i-1]);
                   while(rs.next())
                        Vector row = new Vector(columns);
                        for(int i=1;i<=columns;i++)
                             row.addElement(rs.getObject(i));
                        dataVector.addElement(row);
                   ((DefaultTableModel)table.getModel()).setDataVector(dataVector,colVec);
                   rs.close();
                   st.close();
              catch(Exception e)
                   System.out.println(e);
              /**dtm=new DefaultTableModel();
              dtm.setDataVector(dataVector,colVec);*/
              table.setShowHorizontalLines(false);
              table.setEnabled(false);
              table.getTableHeader().setBackground(Color.WHITE);
              scrollPane=new JScrollPane(table);
              scrollPane.setAutoscrolls(false);
              masterPanel = new JPanel();
              dataPanel.add(scrollPane,BorderLayout.CENTER);
              dataPanel.setPreferredSize(scrollPane.getPreferredSize());
              dataPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
              getContentPane().setPreferredSize(new Dimension(750,500));
              getContentPane().setLayout(new BorderLayout());
              headerPanel.setBackground(Color.WHITE);
              dataPanel.setBackground(Color.WHITE);
              masterPanel.setLayout(new BorderLayout());
              masterPanel.add(headerPanel,BorderLayout.NORTH);
              masterPanel.add(dataPanel,BorderLayout.CENTER);
              getContentPane().add(masterPanel,BorderLayout.CENTER);
              //getContentPane().setBackground(Color.WHITE);
              getContentPane().add(btnPanel,BorderLayout.SOUTH);
              pack();
              setVisible(true);
    public void actionPerformed(ActionEvent ae)
         Object obj = ae.getSource();
         if(obj==btnprint)
              PrinterJob job = PrinterJob.getPrinterJob();
                  job.setPrintable(this);
                  boolean ok = job.printDialog();
                  if (ok)
                      try {
                           job.print();
                   catch (PrinterException ex)
                            /* The job did not successfully complete */
         else if(obj== btncancel)
              setVisible (false);
              dispose();
    }Thank you very much

  • Can we generate custom reports in oIM 10g

    hi,
    Is it possible to generate custom reports in OIM 10g? Is it a complex process?
    Thanks

    Thanks for the reply,
    I am able to generate the report, but the issue is with the filter condition, I am trying to filter the results with a udf field but filtering is not happening and in logs the error coming is
    Thor.API.Exceptions.tcColumnNotFoundException
    at Thor.API.tcMetaDataSet.getStringValue(Unknown Source)
    at com.thortech.xl.webclient.util.ReportUtilities.getLinkHref(Unknown Source)
    at com.thortech.xl.webclient.util.ReportUtilities.populateTableDataForTabularDisplay(Unknown Source)
    at com.thortech.xl.webclient.util.ReportUtilities.displayReportWithTabularLayout(Unknown Source)
    at com.thortech.xl.webclient.util.ReportUtilities.displayReportWithLayout(Unknown Source)
    at com.thortech.xl.webclient.actions.ReportAction.displayTabularReport(Unknown Source)
    at com.thortech.xl.webclient.actions.ReportAction.displayReport(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
    at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
    at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
    at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
    and one more thing , how to give two conditions in where clause in stored procedure , for e.g i have given like
    strWhereClause := 'usr_key IN(SELECT DISTINCT usr_key FROM usr) and UPPER(usr.usr_status) like '
    || UPPER(''''||strstatus_in||'''')
    || ' AND UPPER(usr.USR_UDF_CUSTOMATTR) LIKE '
    || UPPER(''''||strcustattr_in||'''')
    || ' ';
    and its not taking the two values.pls tell me where its going wrong

Maybe you are looking for