Exporting table data into text files

I got a request to export the data from about 85 tables into 85 text files. I assume that they will want a header row and some delimiter character. This is a process that must run every night by a sql job.
Obviously I want it to be flexible. Tables could be addede and removed and columns could be added and removed. There will probably be a control table that has the list of tables to export.
Looked at bcp - but seems that it is command line only?
SSIS package?
What other options are there?

Wanted to post my solution. Ended up using bcp in a PowerShell Script. I was unable to use bcp in SQL because it requires xp_cmdshell and that is not allowed at many of our client sites. So wrote a Powershell script that executes bcp. The ps script
loops through a table that contains a row for each table/view to export along with many values and switches for the table/view export: export path, include column headers, enclose each field in double quotes, double up embedded double quotes, how to format
dates, what to return for NULL integers - basically the stuff that is not flexible in bcp. To get this flexibility I created a SQL proc that takes these values as input and creates a view. Then the PS bcp does a SELECT on the view. Many of my tables are
very wide and bcp has a limit of 4000/8000. Some of my SELECT statements ended up being GT 35k in length. So using a view got around this size limitation.
Anyway, the view creation and bcp download is really fast. It can download about 4 gb of data in 20 minutes. It can download it faster the 7z can zip it.
Below is the SQL proc to format the SELECT statement to create the view for bcp (or some other utility like SQLCMD, Invoke-SQLCMD) or SQL query by "SELECT * from v_ExportData". the proc can be used from SQL or PS, or anything that can call a SQL
Proc and then read a SQL view.
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ExportTablesCreateView]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[ExportTablesCreateView]
GO
CREATE PROCEDURE [dbo].[ExportTablesCreateView]
ExportTablesCreateView
Description:
Read in a tablename or viewname with parameters and create a view v_ExportTable of the
data. The view will typically be read by bcp to download SQL table data to flat files.
bcp does not have the options to include column headers, include fields in double quotes,
format dates or use '0' for integer NULLS. Also, bcp has a limit of varhar 4000 and
wider tables could not be directly called by bcp. So create the v_ExportTable and have
bcp SELECT v_ExportTable instead of the original table or view.
Parameters:
@pTableName VARCHAR(128) - table or view to create v_ExportTable from
@pColumnHeader INT =1 - include column headers in the first row
@pDoubleQuoteFields INT = 1 - put double quotes " around all column values including column headers
@pDouble_EmbeddedDoubleQuotes INT = 1 - This is usually used with @pDoubleQuoteFields INT = 1. 'ab"c"d would be 'ab""c""d.
@pNumNULLValue VARCHAR(1) = '0' - NULL number data types will export this value instead of bcp default of ''
@pDateTimeFormat INT = 121 - DateTime data types will use this format value
Example:
EXEC ExportTablesCreateView 'custname', 1, 1, 1, '0', 121
@pTableName VARCHAR(128),
@pColumnHeader INT = 1,
@pDoubleQuoteFields INT = 1,
@pDouble_EmbeddedDoubleQuotes INT = 1,
@pNumNULLValue VARCHAR(1) = '0',
@pDateTimeFormat INT = 121
AS
BEGIN
DECLARE @columnname varchar(128)
DECLARE @columnsize int
DECLARE @data_type varchar(128)
DECLARE @HeaderRow nvarchar(max)
DECLARE @ColumnSelect nvarchar(max)
DECLARE @SQLSelect nvarchar(max)
DECLARE @SQLCommand nvarchar(max)
DECLARE @ReturnCode INT
DECLARE @Note VARCHAR(500)
DECLARE db_cursor CURSOR FOR
SELECT COLUMN_NAME, ISNULL(Character_maximum_length,0), Data_type
FROM [INFORMATION_SCHEMA].[COLUMNS]
WHERE TABLE_NAME = @pTableName AND TABLE_SCHEMA='dbo'
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @ColumnName, @ColumnSize, @Data_type
SET @HeaderRow = ''
SET @ColumnSelect = ''
-- Loop through each of the @pTableColumns to build the SELECT Statement
WHILE @@FETCH_STATUS = 0
BEGIN
BEGIN TRY
-- Put double quotes around each field - example "MARIA","SHARAPOVA"
IF @pDoubleQuoteFields = 1
BEGIN
-- Include column headers in the first row - example "FirstName","LastName"
IF @pColumnHeader = 1
SET @HeaderRow = @HeaderRow + '''"' + @ColumnName + '"'' as ''' + @columnname + ''','
-- Unsupported Export data type returns "" - example "",
IF @Data_Type in ('image', 'varbinary', 'binary', 'timestamp', 'cursor', 'hierarchyid', 'sql_variant', 'xml', 'table', 'spatial Types')
SET @ColumnSelect = @ColumnSelect + '''""'' as [' + @ColumnName + '],'
-- Format DateTime data types according to input parameter
ELSE IF @Data_Type in ('datetime', 'smalldatetime', 'datetime2', 'date', 'datetimeoffset')
-- example - CASE when [aaa] IS NULL THEN '""' ELSE QUOTENAME(CONVERT(VARCHAR,[aaa], 121), CHAR(34)) END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @columnname + '] IS NULL THEN ''""'' ELSE QUOTENAME(CONVERT(VARCHAR,[' + @columnname + '],' + CONVERT(VARCHAR,@pDateTimeFormat) + '), CHAR(34)) END AS [' + @ColumnName + '],'
-- SET Numeric data types with NULL value according to input parameter
ELSE IF @Data_Type in ('bigint', 'numeric', 'bit', 'smallint', 'decimal', 'smallmoney', 'int', 'tinyint', 'money', 'float', 'real')
-- example - CASE when [aaa] IS NULL THEN '"0"' ELSE QUOTENAME([aaa], CHAR(34)) END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @columnname + '] IS NULL THEN ''"' + @pNumNULLValue + '"'' ELSE QUOTENAME([' + @columnname + '], CHAR(34)) END AS [' + @ColumnName + '],'
ELSE
-- Double embedded double quotes - example "abc"d"ed" to "abc""d""ed". Only applicible for character data types.
IF @pDouble_EmbeddedDoubleQuotes = 1
BEGIN
-- example - CASE when [aaa] IS NULL THEN '""' ELSE '"' + REPLACE([aaa],'"','""') + '"' END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @ColumnName + '] IS NULL THEN ''""'' ELSE ''"'' + REPLACE([' + @ColumnName + '],''"'',''""'') + ''"'' END AS [' + @ColumnName + '],'
END
-- DO NOT PUT Double embedded double quotes - example "abc"d"ed" unchanged to "abc"d"ed"
ELSE
BEGIN
-- example - CASE when [aaa] IS NULL THEN '""' ELSE '"' + [aaa] + '"' END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @ColumnName + '] IS NULL THEN ''""'' ELSE ''"'' + [' + @ColumnName + '] + ''"'' END AS [' + @ColumnName + '],'
END
END
-- DO NOT PUT double quotes around each field - example MARIA,SHARAPOVA
ELSE
BEGIN
-- Include column headers in the first row - example "FirstName","LastName"
IF @pColumnHeader = 1
SET @HeaderRow = @HeaderRow + '''' + @ColumnName + ''' as ''' + @columnname + ''','
-- Unsupported Export data type returns '' - example '',
IF @Data_Type in ('image', 'varbinary', 'binary', 'timestamp', 'cursor', 'hierarchyid', 'sql_variant', 'xml', 'table', 'spatial Types')
SET @ColumnSelect = @ColumnSelect + ''''' as [' + @ColumnName + '],'
-- Format DateTime data types according to input parameter
ELSE IF @Data_Type in ('datetime', 'smalldatetime', 'datetime2','date', 'datetimeoffset')
-- example - CASE when [aaa] IS NULL THEN '''' ELSE CONVERT(VARCHAR,[aaa], 121) END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @columnname + '] IS NULL THEN '''' ELSE CONVERT(VARCHAR,[' + @columnname + '],' + CONVERT(VARCHAR,@pDateTimeFormat) + ') END AS [' + @ColumnName + '],'
-- SET Numeric data types with NULL value according to input parameter
ELSE IF @Data_Type in ('bigint', 'numeric', 'bit', 'smallint', 'decimal', 'smallmoney', 'int', 'tinyint', 'money', 'float', 'real')
-- example - CASE when [aaa] IS NULL THEN '"0"' ELSE CONVERT(VARCHAR, [aaa]) END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @columnname + '] IS NULL THEN ''' + @pNumNULLValue + ''' ELSE CONVERT(VARCHAR,[' + @columnname + ']) END AS [' + @ColumnName + '],'
ELSE
BEGIN
-- Double embedded double quotes - example "abc"d"ed" to "abc""d""ed". Only applicible for character data types.
IF @pDouble_EmbeddedDoubleQuotes = 1
-- example - CASE when [aaa] IS NULL THEN '' ELSE CONVERT(VARCHAR,REPLACE([aaa],'"','""')) END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @columnname + '] IS NULL THEN '''' ELSE CONVERT(VARCHAR,REPLACE([' + @columnname + '],''"'',''""'')) END AS [' + @ColumnName + '],'
ELSE
-- example - CASE when [aaa] IS NULL THEN '' ELSE CONVERT(VARCHAR,[aaa]) END AS [aaa],
SET @ColumnSelect = @ColumnSelect + 'CASE WHEN [' + @columnname + '] IS NULL THEN '''' ELSE CONVERT(VARCHAR,[' + @columnname + ']) END AS [' + @ColumnName + '],'
END
END
FETCH NEXT FROM db_cursor INTO @ColumnName, @ColumnSize, @Data_Type
END TRY
BEGIN CATCH
RETURN (1)
END CATCH
END
CLOSE db_cursor
DEALLOCATE db_cursor
BEGIN TRY
-- remove last comma
IF @pColumnHeader = 1
SET @HeaderRow = SUBSTRING(@HeaderRow , 1, LEN(@HeaderRow ) - 1)
SET @ColumnSelect = SUBSTRING(@ColumnSelect, 1, LEN(@ColumnSelect) - 1)
-- Put on the finishing touches on the SELECT
IF @pColumnHeader = 1
SET @SQLSelect = 'SELECT ' + @HeaderRow + ' UNION ALL ' +
'SELECT ' + @ColumnSelect + ' FROM [' + @pTableName + ']'
ELSE
SET @SQLSelect = 'SELECT ' + @ColumnSelect + ' FROM [' + @pTableName + ']'
---- diagnostics
---- PRINT truncates at 4k or 8k, not sure, my tables have many colummns
--PRINT @SQLSelect
--DECLARE @END varchar(max) = RIGHT(@SQLSelect, 3000)
--PRINT @end
--EXECUTE sp_executesql @SQLSelect
-- drop view if exists -- using view because some tables are very wide. one of my tables had a 33k select statement
SET @SQLCommand = '
IF EXISTS (SELECT * FROM SYS.views WHERE name = ''v_ExportTable'')
BEGIN
DROP VIEW v_ExportTable
END'
EXECUTE @ReturnCode = sp_executesql @SQLCommand
IF @returncode = 1
BEGIN
RETURN (1)
END
-- create the view
SET @SQLCommand = '
CREATE VIEW v_ExportTable AS ' + @SQLSelect
-- diagnostics
--print @sqlcommand
EXECUTE @ReturnCode = sp_executesql @SQLCommand
IF @returncode = 1
BEGIN
RETURN (1)
END
END TRY
BEGIN CATCH
RETURN (1)
END CATCH
RETURN (0)
END -- CREATE PROCEDURE [dbo].[ExportTablesCreateView]
GO

Similar Messages

  • Export table data in text file

    hi,
    i am using oracle 8.0.7 , i want to export a table data in to text file, thanks in advance
    Noman ul haq

    2 options:
    1) Spool the query results into a file using SQL*PLUS
    2) If you can use the Oracle Server, look at the UTL_FILE package. This writes files, but ONLY to the Oracle server. It will NOT write out to your client machine. Your DBA will need to add an entry to allow for the UTL_FILE package to write out to the directory you choose.
    Hope that helps - the documentation should have detailed usage of UTL_FILE package. Or search on this site b/c this is a common question - see it at least 3 times a week.

  • How to export waveform data into text file

    Hi..
        I am trying to export my waveform graph data into write spreadsheet file. When running the proram, I am getting graph values (values in a matrix) when checking with the probe. But once I save it to a text file, the values recorded are just zeros. I have attached the text file along with this. Could anyone please tell me why the graph data is not recorded in the spreadsheet? I have extracted the Y component of the graph and then wired it to the write to spreadsheet function. It seems like the labview is getting the data.. but now the problem is how to get the data out of labview?

    Please find the attched image of the whole program. I tried running the program after removing the array to matrix but still I am not able to export the graph values to spreadsheet. The program as a whole is working as I am able to display the oscilloscope graph into the waveform graph but I am not able to export the values. When I tried using probes, I am getting differnet matrix values till the end of the connection given to 'write to spreadsheet' but not able to export the values. The second image shows the write to spreadsheet file inside the while loop as i thought it will reduce the memory.. but it is still not working...
    Attachments:
    Scanner complete program.jpg ‏713 KB
    full scanner program 2.jpg ‏664 KB

  • How to give path in plsql while exporting table data into .csv file

    hi,
    i have a code like this
    PROCEDURE dump_table_to_csv (
    p_tname IN VARCHAR2,
    p_dir IN VARCHAR2,
    p_filename IN VARCHAR2
    IS
    l_output UTL_FILE.file_type;
    l_thecursor INTEGER DEFAULT DBMS_SQL.open_cursor;
    l_columnvalue VARCHAR2 (4000);
    l_status INTEGER;
    l_query VARCHAR2 (1000) DEFAULT 'select * from ' || p_tname;
    l_colcnt NUMBER := 0;
    l_separator VARCHAR2 (1);
    l_desctbl DBMS_SQL.desc_tab;
    BEGIN
    l_output := UTL_FILE.fopen (p_dir, p_filename, 'w');
    EXECUTE IMMEDIATE 'alter session set nls_date_format=''dd-mon-yyyy hh24:mi:ss''';
    DBMS_SQL.parse (l_thecursor, l_query, DBMS_SQL.native);
    DBMS_SQL.describe_columns (l_thecursor, l_colcnt, l_desctbl);
    FOR i IN 1 .. l_colcnt
    LOOP
    UTL_FILE.put (l_output,
    l_separator || '"' || l_desctbl (i).col_name || '"'
    DBMS_SQL.define_column (l_thecursor, i, l_columnvalue, 4000);
    l_separator := ',';
    END LOOP;
    UTL_FILE.new_line (l_output);
    l_status := DBMS_SQL.EXECUTE (l_thecursor);
    WHILE (DBMS_SQL.fetch_rows (l_thecursor) > 0)
    LOOP
    l_separator := '';
    FOR i IN 1 .. l_colcnt
    LOOP
    DBMS_SQL.column_value (l_thecursor, i, l_columnvalue);
    UTL_FILE.put (l_output, l_separator || l_columnvalue);
    l_separator := ',';
    END LOOP;
    UTL_FILE.new_line (l_output);
    END LOOP;
    DBMS_SQL.close_cursor (l_thecursor);
    UTL_FILE.fclose (l_output);
    EXECUTE IMMEDIATE 'alter session set nls_date_format=''dd-MON-yy'' ';
    EXCEPTION
    WHEN OTHERS
    THEN
    EXECUTE IMMEDIATE 'alter session set nls_date_format=''dd-MON-yy'' ';
    RAISE;
    END;
    I am getting error like :-------
    SQL> exec dump_table_to_csv('deptair','c:/csv','aa.deptair');
    BEGIN dump_table_to_csv('deptair','c:/csv','aa.deptair'); END;
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 8
    ORA-29280: invalid directory path
    ORA-06512: at "SCOTT.DUMP_TABLE_TO_CSV", line 58
    ORA-06512: at line 1
    pplease help me out
    thanks
    vicky

    look at your other thread, answer is already there.

  • Export data into text file

    Hi all,
    I want to export table data into a delimeted text file with SQL*Plus.
    [edit]
    Sorry, non delimited text file
    [edit]
    Example:
    CREATE TABLE delim (
    col_a VARCHAR2(20),
    col_b VARCHAR2(40)
    value stored in
    col_a = FISH_1
    col_b = FISH_2
    spool x:\test_1.lst
    set feedback off;
    set HEADING off;
    set pagesize 0;
    set linesize 60;
    select col_a, col_b
    from table delim;
    spool off;
    =>
    FISH_1
    FISH_2
    When I now do the same with
    set linesize 62;
    the reslut is like this
    =>
    FISH_1 FISH_2
    In the output of the second example there is a blank between col_a and col_b.
    I have to export the column data without this one blank between columns.
    Is there any way to do this?
    Thanks and cheers,
    ben
    Message was edited by:
    ben512

    Well in your example there is one space between the two columns, anyway you can see in my previous example that there is a set colsep and that show what you want.
    But here is another example:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create table test (
      2  col_a VARCHAR2(5),
      3  col_b VARCHAR2(3)
      4  );
    Table created.
    SQL>
    SQL> insert into test (col_a, col_b)
      2  values('abc', 'FA');
    1 row created.
    SQL>
    SQL> insert into test (col_a, col_b)
      2  values('def', 'KL');
    1 row created.
    SQL> insert into test values ('12345','123');
    1 row created.
    SQL> rem if you don't want to have a space between the two columns then
    SQL> set head off
    SQL> set colsep ""
    SQL> select col_a, col_b from test;
    abc  FA
    def  KL
    12345123
    SQL> rem if you want to have one space between the two columns then
    SQL> set colsep " "
    SQL> select col_a, col_b from test;
    abc   FA
    def   KL
    12345 123
    SQL>

  • Spool SQl data into text file using dynamic sql

    Hi,
    I am spooling output data into text file using command
    select 'select t.mxname,bo.lxtype,t.mxrev'||chr(10)||'from mx_1234567'||chr(10)||
    'where <condition>';
    here mxname varchar(128),lxtype(128),mxrev(128) all are of varchar type.I want the output in format
    e.g Part|1211121313|A
    but due to column width the output,I am getting is with spaces.
    "Part then blank spaces |1211121313 then blank spaces |A"
    how can I remove these spaces between columns.I used set space 0 but not working.
    Thanks in advance.
    Your help will be appreciated.

    Hi Frank,
    I have seen your reply for SET LINE SIZE function. But, I could not be able to understand it.
    I am facing similar kind of issue in my present project.
    I am trying spool more than 50 columns from a table into flat file. Because of more column lengths in few columns, i am getting space. There are so many columns with the same issue. I want to remove that space.so that, data can fit perfectly in one line in .txt file without any wrap text.
    Below is my sample query.sql. Please let me know the syntax. My mail id : [email protected]
    --Created : Sep 22,2008, Created By : Srinivasa Bojja
    --Export all Fulfillments
    --Scheduled daily after 1:00am and should complete before 3:30am
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    SET LINESIZE 800
    SET WRAP OFF
    SET PAGESIZE 800
    SET FEEDBACK OFF
    SET HEADING ON
    SET ECHO OFF
    SET CONCAT OFF
    SET COLSEP '|'
    SET UNDERLINE OFF
    SPOOL C:\Fulfillment.txt;
    SELECT SRV.COMM_METHOD_CD AS Method,
    SRV.SR_NUM AS "Fulfillment Row_Id",
    CON.LAST_NAME AS "Filled By"
    SRV.SR_TITLE AS Notes,
    SRVXM.ATTRIB_04 AS "Form Description"
    FROM SIEBEL.S_SRV_REQ SRV,
    SIEBEL.S_SRV_REQ_XM SRVXM,
    SIEBEL.S_USER USR,
    SIEBEL.S_CONTACT CON
    WHERE SRV.ROW_ID = SRVXM.PAR_ROW_ID AND
    SRV.OWNER_EMP_ID = USR.ROW_ID AND
    CON.ROW_ID= SRV.CST_CON_ID;
    SPOOL OFF;
    EXIT;

  • To get the table data into a file in pl/sql developer

    Hi
    i have table with 90k rows, i want to get the table data into a file like excel....
    i executed the select statement it shows only 5k rows because of buffer problem.
    can u please help me any alternative way to get the table data into a file.
    using cursors like that

    Really? excel for 90K rows :)
    face/desk/floor/"Hi and sorry neighbours below, it's me again"
    Err, I see you point, thanks Dang, I completely missed the 90k recs part, I must be getting old or modern ;)
    @Ramanjaneyulu,
    can u please help me any alternative way to get the table data into a file.You can always dump a query to a file, check these:
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteflat.html
    How to create Excel file (scroll down when necessary)
    http://forums.oracle.com/forums/search.jspa?threadID=&q=export+to+excel&objID=f137&dateRange=all&userID=&numResults=15&rankBy=10001
    Depending on your database version ( the result of: select * from v$version; ) you might have some other options.

  • Problem in converting table data into CSV file

    Hi All,
    In my Process i need to convert my error table data into csv file,my data is converted as csv file by using OdisqlUnload function,but the column headers are not converted,i use another procedure for converting column headers but iam getting below error ...
    com.sunopsis.sql.SnpsMissingParametersException: Missing parameter string.find, string.find
    SQL: import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+') myStmt = sourceConnection.createStatement() my_query = "select * FROM E$_LOCAL_F0911Z1" my_query=my_query.upper() if string.find(my_query, '*') > 0: myRs = myStmt.executeQuery(my_query) md=myRs.getMetaData() collect=[] i=1 while (i <= md.getColumnCount()): collect.append(md.getColumnName(i)) i += 1 header=','.join(map(string.strip, collect)) elif string.find(my_query,'||') > 0: header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',') else: header = my_query[7:string.find(my_query, 'FROM')] print header old=output_write.read() output_write.seek(0) output_write.write (header+'\n'+old) sourceConnection.close() output_write.close()
    And i used below code for converting.......
    import string
    import java.sql as sql
    import java.lang as lang
    import re
    sourceConnection = odiRef.getJDBCConnection("SRC")
    output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+')
    myStmt = sourceConnection.createStatement()
    my_query = "select FROM E$_COMPANY"*
    *my_query=my_query.upper()*
    *if string.find(my_query, '*') > 0:*
    *myRs = myStmt.executeQuery(my_query)*
    *md=myRs.getMetaData()*
    *collect=[]*
    *i=1*
    *while (i <= md.getColumnCount()):*
    *collect.append(md.getColumnName(i))*
    *i += 1*
    *header=','.join(map(string.strip, collect))*
    *elif string.find(my_query,'||') > 0:*
    *header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')*
    *else:*
    *header = my_query[7:string.find(my_query, 'FROM')]*
    *print header*
    *old=output_write.read()*
    *output_write.seek(0)*
    *output_write.write (header+'\n'+old)*
    *sourceConnection.close()*
    *output_write.close()*
    Any one can you help regarding this
    Edited by: 30021986 on Oct 1, 2012 6:04 PM

    This may not be an option for you but in pinch you may want to consider outputing your data to an MS Spreadsheet, then saving it as a CSV. It's somewhat of a cumbersome process, but it will get you by for now.
    You will need to change your content type to application/vnd.ms-excel.
    <% response.setContentType("application/vnd.ms-excel"); %>

  • Export batch data into CSV file using SQL SP

    Hi,
    I have created WCF-Custom receive adapter to poll Sql SP (WITH xmlnamespaces(DEFAULT 'Namespace' and For XML PATH(''), Type) . Get the result properly in batch while polling and but getting error while converting into CSV by using map.
    Please can anyone give me some idea to export SQL data into CSV file using SP.

    How are you doing this.
    You would have got XML representation for the XML batch received from SQL
    You should have a flat-file schema representing the CSV file which you want to send.
    Map the received XML representation of data from SQL to flat-file schema
    have custom pipeline with flat-file assembler on the assembler stage of the send pipeline.
    In the send port use the map which convert received XML from SQL to flat file schema and use the above custom flat-file disassembler send port
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • RE: How to Export the Table data Into PDF File  in ADF

    Hi Experts,
    I am using Jdeveloper 11.1.2.3.0
    I am created employee VO and Drag and Drop as a Table in a page. So need to Export the Table data into A PDF file.
    So please give me some suggestions regarding this Scnerio.
    With Regards,
    satish

    Hi Guys ,
    Any more answers for this question.
    Please find my jsff below
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:f="http://java.sun.com/jsf/core" xmlns:report="http://www.adfwithejb.blogspot.com">
      <af:panelGroupLayout layout="vertical" id="pgl2">
          <af:query id="qryId1" headerText="Service Tariff Mapping Details" disclosed="true"
                    value="#{bindings.findByTarifValidFromQuery.queryDescriptor}"
                    model="#{bindings.findByTarifValidFromQuery.queryModel}"
                    queryListener="#{reportWiseInvoiceBean.genericQueryListener}"
                    queryOperationListener="#{bindings.findByTarifValidFromQuery.processQueryOperation}"
                    resultComponentId="pc1::t2">
         <f:attribute name="queryExpression" value="bindings.findByTarifValidFromQuery.processQuery"/>
                          </af:query>
        <af:panelCollection id="pc1" styleClass="AFStretchWidth">
          <f:facet name="menus"/>
          <f:facet name="toolbar">
              <af:toolbar id="t1">
                 <af:menuBar id="pt_m1">
                <report:reportDeclarative ButtonName="ExportToExcel" ReportName="ServiceTariffMappingDetails"
                                          ReportType="PDF" TableId=":::pc1:t2" id="rd1" Pagination="true"/>
                <af:commandButton text="excel" id="cb1" binding="#{exportToExcelBean.exportID}">
                <af:setActionListener from="pt1:pgl1:pgl2:pc1:t2" to="#{viewScope['exporter.exportedId']}"/>
                <af:setActionListener from="border:1px solid #cccccc" to="#{viewScope['exporter.thStyle']}"/>
                <af:setActionListener from="border:1px solid #cccccc" to="#{viewScope['exporter.tdStyle']}"/>
                <af:fileDownloadActionListener method="#{exportToExcelBean.exportToExcel}" filename="Service TariffMapping.xls"
                                                 contentType="text/excel;chatset=UTF-8;"/>
                </af:commandButton>
                <af:commandMenuItem id="pt_cmi133" icon="/images/common/Excel-icon.png"
                                                shortDesc="ExportToExcel"
                                >
                                <af:exportCollectionActionListener exportedId="t2" type="excelHTML"
                                                                   title="Service Tariff Mapping"
                                                                   filename="Service Tariff Mapping.xls"/>
                            </af:commandMenuItem></af:menuBar>
              </af:toolbar>
          </f:facet>
          <f:facet name="statusbar"/>
          <af:table value="#{bindings.ServiceTariffMappingDtlsRVO1.collectionModel}" var="row"
                    rows="#{bindings.ServiceTariffMappingDtlsRVO1.rangeSize}"
                    emptyText="#{bindings.ServiceTariffMappingDtlsRVO1.viewable ? 'No data to display.' : 'Access Denied.'}"
                    fetchSize="#{bindings.ServiceTariffMappingDtlsRVO1.rangeSize}" rowBandingInterval="0"
                    filterModel="#{bindings.findByTarifValidFromQuery.queryDescriptor}"
                    queryListener="#{bindings.findByTarifValidFromQuery.processQuery}" filterVisible="true" varStatus="vs"
                    id="t2" columnStretching="last" binding="#{ServiceTariffMappBean.testTable}">
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NormalTariffCode.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NormalTariffCode.label}"
                       id="c1">
              <af:inputText value="#{row.bindings.NormalTariffCode.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NormalTariffCode.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NormalTariffCode.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NormalTariffCode.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NormalTariffCode.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NormalTariffCode.tooltip}" id="it1">
                <f:validator binding="#{row.bindings.NormalTariffCode.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceCode.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceCode.label}"
                       id="c2">
              <af:inputText value="#{row.bindings.ServiceCode.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceCode.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceCode.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceCode.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceCode.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceCode.tooltip}" id="it2">
                <f:validator binding="#{row.bindings.ServiceCode.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.label}" id="c3">
              <f:facet name="filter">
                <af:inputDate value="#{vs.filterCriteria.TrfVldFrm}" id="id1">
                  <af:convertDateTime pattern="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.format}"/>
                </af:inputDate>
              </f:facet>
              <af:inputDate value="#{row.bindings.TrfVldFrm.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.displayWidth}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.tooltip}" id="id2">
                <f:validator binding="#{row.bindings.TrfVldFrm.validator}"/>
                <af:convertDateTime pattern="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfVldFrm.format}"/>
              </af:inputDate>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceDesc.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceDesc.label}"
                       id="c4">
              <af:inputText value="#{row.bindings.ServiceDesc.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceDesc.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceDesc.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceDesc.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceDesc.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ServiceDesc.tooltip}" id="it3">
                <f:validator binding="#{row.bindings.ServiceDesc.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtTrfCode.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtTrfCode.label}" id="c5">
              <af:inputText value="#{row.bindings.OtTrfCode.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtTrfCode.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtTrfCode.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtTrfCode.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtTrfCode.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtTrfCode.tooltip}" id="it4">
                <f:validator binding="#{row.bindings.OtTrfCode.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtUnitRate.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtUnitRate.label}" id="c6">
              <af:inputText value="#{row.bindings.OtUnitRate.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtUnitRate.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtUnitRate.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtUnitRate.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtUnitRate.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.OtUnitRate.tooltip}" id="it5">
                <f:validator binding="#{row.bindings.OtUnitRate.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NtUnitRate.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NtUnitRate.label}" id="c7">
              <af:inputText value="#{row.bindings.NtUnitRate.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NtUnitRate.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NtUnitRate.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NtUnitRate.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NtUnitRate.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.NtUnitRate.tooltip}" id="it6">
                <f:validator binding="#{row.bindings.NtUnitRate.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfGrt.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfGrt.label}" id="c8">
              <af:inputText value="#{row.bindings.TrfGrt.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfGrt.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfGrt.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfGrt.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfGrt.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.TrfGrt.tooltip}" id="it7">
                <f:validator binding="#{row.bindings.TrfGrt.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ChargePartyCode.name}" filterable="true"
                       sortable="true" headerText="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ChargePartyCode.label}"
                       id="c9">
              <af:inputText value="#{row.bindings.ChargePartyCode.inputValue}"
                            label="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ChargePartyCode.label}"
                            required="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ChargePartyCode.mandatory}"
                            columns="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ChargePartyCode.displayWidth}"
                            maximumLength="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ChargePartyCode.precision}"
                            shortDesc="#{bindings.ServiceTariffMappingDtlsRVO1.hints.ChargePartyCode.tooltip}" id="it8">
                <f:validator binding="#{row.bindings.ChargePartyCode.validator}"/>
              </af:inputText>
            </af:column>
          </af:table>
        </af:panelCollection>
      </af:panelGroupLayout>
    </jsp:root>

  • How to download internal table data into xml file?

    Hi,
    Experts,
    I have downloaded internal table data into XLS format using GUI_DOWNLOAD Function module, But i didn't Know how to download internal table data into XML format please post some ideas/inputs on this issue.
    Thank you,
    Shabeer ahmed.

    check this
    data : gd_repid type sy-repid.
    GD_REPID = SY-REPID.
    DATA : L_DOM TYPE REF TO IF_IXML_ELEMENT,
           M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
           G_IXML TYPE REF TO IF_IXML,
           W_STRING TYPE XSTRING,
           W_SIZE TYPE I,
           W_RESULT TYPE I,
           W_LINE TYPE STRING,
           IT_XML TYPE DCXMLLINES,
           S_XML LIKE LINE OF IT_XML,
           W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
          BEGIN OF XML_TAB OCCURS 0,
          D LIKE LINE OF XML,
          END OF XML_TAB.
    data : l_element           type ref to if_ixml_element,
           xml_ns_prefix_sf     type string,
           xml_ns_uri_sf        type string.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
       NAME = 'REPAIRDATA'
       DATAOBJECT = IT_FINAL_LAST1[]
    IMPORTING
       DATA_AS_DOM = L_DOM
    CHANGING
       DOCUMENT = M_DOCUMENT
    EXCEPTIONS
       ILLEGAL_NAME = 1
       OTHERS = 2.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    *Start of code for Header
    * namespace
    t_mnr = sy-datum+4(2).
    CALL FUNCTION 'IDWT_READ_MONTH_TEXT'
      EXPORTING
        LANGU         = 'E'
        MONTH         = t_mnr
    IMPORTING
       T247          = wa_t247
    concatenate sy-datum+6(2)
                wa_t247-ktx
                sy-datum(4) into t_var1.
    concatenate sy-uzeit(2)
                sy-uzeit+2(2)
                sy-uzeit+4(2) into t_var2.
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    l_element  = m_document->get_root_element( ).
    xml_ns_prefix_sf = 'TIMESTAMP'.
    concatenate t_var1 t_var2 into xml_ns_uri_sf separated by space.
    clear : t_var1,
            t_var2,
            t_mnr,
            wa_t247.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'FILECREATOR'.
    xml_ns_uri_sf    =   'SAP'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMGROUP'.
    xml_ns_uri_sf    = '1'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMTYPES'.
    xml_ns_uri_sf    = 'W'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    *End of Code for Header
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
      DOCUMENT = M_DOCUMENT
    IMPORTING
      XML_AS_STRING = W_STRING
      SIZE = W_SIZE
    TABLES
      XML_AS_TABLE = IT_XML
    EXCEPTIONS
      NO_DOCUMENT = 1
      OTHERS = 2.
    LOOP AT IT_XML INTO XML_TAB-D.
    APPEND XML_TAB.
    ENDLOOP.
    *Start of Code for File name
    concatenate p_file
                '\R'
                '000_119481'
                sy-datum+6(2) sy-datum+4(2) sy-datum+2(2)
                sy-uzeit(2)   sy-uzeit+2(2) sy-uzeit(2) '.xml' into p_file.
    *End of Code for File name
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE = W_SIZE
      FILENAME = p_file
      FILETYPE = 'BIN'
    TABLES
      DATA_TAB = XML_TAB
    EXCEPTIONS
      OTHERS = 10.
    IF SY-SUBRC  = 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • How to export bulk data in text file

    Dear,
    We have an requirement to get data from GL CONTAINING below tables, but it's taking lot of time, could you share the best way to get data in text file as quick as possiable.
    from gl_je_headers_v,gl_je_lines,GL_JE_CATEGORIES
    ,gl_code_combinations_v
    where gl_je_headers_v.je_header_id = gl_je_lines.je_header_id
    AND GL_JE_CATEGORIES.je_category_name = gl_je_headers_v.je_category
    and gl_code_combinations_v.CODE_COMBINATION_ID =
    gl_je_lines.code_combination_id
    and gl_code_combinations_v.CHART_OF_ACCOUNTS_ID = 50349
    AND gl_je_headers_v.PERIOD_NAME = 'SEP-2012'

    it's based on formatting data in text file
    you can use utl_file but it's row by row process your data
    you can try spool
    as example
    spool c:\tmp\myfile.txt
    select *
    from emp;
    spool off;or try export for example in sql developer

  • Exporting data into text file

    Hi!
    I use this process in apex to export data from table into txt files with fixed length, so without any delimeter
    >
    declare
    v_file_name VARCHAR2 (2000) := 'test.txt';
    id varchar2(9);
    worker varchar2(30);
    address varchar2(26);
    begin
    OWA_UTIL.mime_header ('application/txt', FALSE);
    htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
    OWA_UTIL.http_header_close;
    FOR x in (select id id from workers where col00 like '1000')
    LOOP
    select col01,col02,col03 into id, worker, addressfrom un_web_prenosi where id = x.id;
    htp.p(id||worker||address);
    END LOOP;
    apex_application.g_unrecoverable_error:=true;
    exception when others then
    null;
    end;
    and I have problem, because if I open file with notepad is everything in one line, but if I open file in notepad++ or I copy content of file in word then I see contents just like it should be (each record in one line). Do you know how can I solve this problem?

    I solved my problem. I forget to put chr(13) into htp.p(id||worker||address); so this line must be like htp.p(id||worker||address||chr(13));

  • How to Convert internal table data into text output and send mail in ABAP

    Hi All,
    Good Morning.
    Taking a glance at a code that converts internal table data to an Excel file in ABAP. also checked how to send this excel to mailing list as attachment.
    But thought of doing it without excel.
    I mean, I have an internal table which contains fields of all types (character,integer,date,time). Since it is only around 4 to 5 rows in it (output),why to convert it to excel. not required!!.  Instead I  want to send this output to User's mails as Normal mail body with No attachments.
    Could anybody please suggest me a way as to how to send internal table data as a mail ( not as an excel or PDF etc).
    as of now my findings are, it is quite complex to convert internal table data to email (Text) format. but i believe if there is some way of doing it.
    Best Regards
    Dileep VT

    here's something I have used in the past where we send out information about failed precalculation settings (which are stored in internal table gt_fail)
    notice we use gt_text as "mail body"
    TRY.
    *     -------- create persistent send request ------------------------
           gv_send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document -------------------------------
    *     create text to be sent
           wa_line = text-001.
           APPEND wa_line TO gt_text.
           CLEAR wa_line.
           APPEND wa_line TO gt_text.
           LOOP AT gt_fail ASSIGNING <fs_fail>.
             MOVE <fs_fail>-retry_count TO gv_count.
             CONCATENATE text-002
                         <fs_fail>-setting_id
                         text-003
                         gv_count
                         INTO wa_line SEPARATED BY space.
             APPEND wa_line TO gt_text.
             CLEAR wa_line.
           ENDLOOP.
           APPEND wa_line TO gt_text.
           wa_line = text-007.
           APPEND wa_line TO gt_text.
    *     create actual document
           gv_document = cl_document_bcs=>create_document(
                           i_type    = 'RAW'
                           i_text    = gt_text
                           i_length  = '12'
                           i_subject = 'Failed Precalculation Settings!' ).
    *     add document to send request
           CALL METHOD gv_send_request->set_document( gv_document ).
    *     --------- set sender -------------------------------------------
           gv_sender = cl_sapuser_bcs=>create( sy-uname ).
           CALL METHOD gv_send_request->set_sender
             EXPORTING
               i_sender = gv_sender.
    *     --------- add recipient (e-mail address) -----------------------
           LOOP AT s_email INTO wa_email.
             MOVE wa_email-low TO gv_email.
             gv_recipient = cl_cam_address_bcs=>create_internet_address(
                                               gv_email ).
             CALL METHOD gv_send_request->add_recipient
               EXPORTING
                 i_recipient = gv_recipient
                 i_express   = 'X'.
           ENDLOOP.
    *     ---------- set to send immediately -----------------------------
           CALL METHOD gv_send_request->set_send_immediately( 'X' ).
    *     ---------- send document ---------------------------------------
           CALL METHOD gv_send_request->send(
             EXPORTING
               i_with_error_screen = 'X'
             RECEIVING
               result              = gv_sent_to_all ).
           IF gv_sent_to_all = 'X'.
             WRITE text-004.
           ENDIF.
           COMMIT WORK.
    *   exception handling
         CATCH cx_bcs INTO gv_bcs_exception.
           WRITE: text-005.
           WRITE: text-006, gv_bcs_exception->error_type.
           EXIT.
       ENDTRY.
    with the following declarations
    * TABLES                                                               *
    TABLES:
       adr6,
       rsr_prec_sett.
    * INTERNAL TABLES & WORK AREAS                                         *
    DATA:
       gt_fail          TYPE SORTED TABLE OF rsr_prec_sett
                             WITH UNIQUE KEY setting_id run_date,
       gt_text          TYPE bcsy_text,
       wa_fail          LIKE LINE OF gt_fail,
       wa_line(90)      TYPE c.
    FIELD-SYMBOLS:
       <fs_fail>        LIKE LINE OF gt_fail.
    * VARIABLES                                                            *
    DATA:
       gv_count(4)      TYPE n,
       gv_send_request  TYPE REF TO cl_bcs,
       gv_document      TYPE REF TO cl_document_bcs,
       gv_sender        TYPE REF TO cl_sapuser_bcs,
       gv_recipient     TYPE REF TO if_recipient_bcs,
       gv_email         TYPE adr6-smtp_addr,
       gv_bcs_exception TYPE REF TO cx_bcs,
       gv_sent_to_all   TYPE os_boolean.
    * SELECTION-SCREEN                                                     *
    SELECT-OPTIONS:
       s_email          FOR adr6-smtp_addr NO INTERVALS MODIF ID sel.
    DATA:
       wa_email         LIKE LINE OF s_email.

  • Export table data to txt file

    Hi,
    I have to dump the BKPF table data(some selected columns) into a txt file. It has around 30 lakh records.
    I am planning to select the data from se16 for different date ranges and export into different txt files.
    Is there any way that i can dump the whole data into a txt file for some selected columns.
    Thanks,

    Hi,
    goto se16> select the records as per requirement> goto change layout> select the number of column you required> click on the export option> select radio button unconverted> save the file in txt format.
    you will get only select columns in the text file.

Maybe you are looking for

  • Adobe Story Script integration with Premiere Pro Doesnt allow me to embed the script

    Goal:  Embed an Adobe Story Script into Premiere Pro. (mac) Method:  I have a video with a verbatim transcript. I inport the transcript into Adobe Story and save it in the proper Adobe Story File extension (.astx) I save it to the Adobe cloud and I h

  • Changing *typeface* in Mail's Fonts & Colors preference pane?

    I want to change the font for my message list and mailboxes, but the Fonts & Colors preference pane only allows me to select the font family (e. g., Gill Sans) and not the font typeface (e. g., Book) that falls under it. If I go to Format > Show Font

  • Using iDVD project file after deleting original iMovieHD

    I've been using iMovieHD and iDVD to convert my home movies from miniDV tapes to DVDs. I've been putting two one-hour tapes together into one iMovie and then creating an iDVD project with themes, chapters, etc. Each two-hour iMovie file takes up >20

  • Convert 'chr' php function in jsp

    Hello everybody I'll try to convert this php code in jsp but i've got several errors when using the "replaceAll" java function. I aim to have an html editor to insert it in my website forum. Can somebody help to solve this problem, otherwise, can any

  • Ipad no conecta a wifi

    hola tengo el ipad air ,y no se puede conectar a wifi