TCODE TO DOWNLOAD IDOC INTO A FLAT FILE

Hi All,
   Please let me know if there is any tcode to download IDOC into a flat file..
Regards,
Kaveri

try with we60 where you should have links to download the idoc type.
Please check this:
1. How to Download a Hierarchy to a Flat File
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
2. How To Convert an IDoc-XML structure to a flat file and vice versa in XI 3.0 Version 1.10
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
run the report RSEOUT00 with the idoc number, flat xml file will be generated at the location user/sap/XI/SYS/global/idoc_file
Please rewrds if found help ful

Similar Messages

  • Download report into a flat file format

    Hi Friends,
    I would like to know your thoughts on what is the best practice most of you using to download a report into a flat file(NOT csv).
    In my application business users want a report to be downloaded into their local desktop (just like a .csv) but into a flat file and they have their byte specific format.
    My concerns :
    1) Is there any straight method to download a report into a flatfile (like it is now for CSV) from Apex 3.1.2 ?
    2) If I write my own code using UTL_FILE, can I let the user to save them to their desired directory on their desktop ?
    Your thoughts would definitely help me in delivering a right solution to the users in this regard.
    Thanks a lot.
    Raj.

    Raj:
    You could create a 'Before Header' page process to create this 'flat file'. The code for the page process will be something similar to declare
    v_file_name   VARCHAR2 (2000) := 'fixedFieldsFile.txt';
    --- Client Record Format
    f1 char(20);
    f2 char(20);
    f3 char(20);
    ---- End format
    begin
    OWA_UTIL.mime_header ('application/txt', FALSE);
    htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
    OWA_UTIL.http_header_close;
    for c1 in (select * from emp) loop                           ----- The report query
    f1:= c1.empno;f2:=c1.ename;f3:=c1.sal;
    htp.p(f1||f2||f3);
    end loop;
    apex_application.g_unrecoverable_error:=true;
    exception when others then
    null;
    end; Varad

  • DOWNLOAD CHEQUE FORMAT INTO A FLAT FILE

    hi,
       i have a requirement to download cheque format into  a flat file.
    as shown below. can any one guide me in this.
                                    Check No.   Date      Payment Amt
                                     1200175681  16/05/07           229.26  CAD
      Pay     TWO HUNDRED TWENTY NINE & 26/100*************************** CANADIAN D
      To The  MINISTER OF FINANCE
      Order   BARRIE SMALL CLAIMS COURT
      Of      114 WORSLEY STREET
              BARRIE ON L4M 1M1                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      BARRIESMCC                     1200175681   16/05/07
      Payee
      MINISTER OF FINANCE
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 BARRIESMCC02MAY                          0.00 CAD           229.26
                                                                                    Check No.   Date      Payment Amt
                                     1200175682  16/05/07           149.96  CAD
      Pay     ONE HUNDRED FORTY NINE & 96/100**************************** CANADIAN D
      To The  BELLEVILLE ONTARIO HRDC
      Order   REMITTANCES
      Of      PO BOX 6767
              MATANE QC G4W 4T1                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      BELLEVONHR                     1200175682   16/05/07
      Payee
      BELLEVILLE ONTARIO HRDC
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 HRDCQC09MAY07                            0.00 CAD           149.96
                                                                                    Check No.   Date      Payment Amt
                                     1200175683  16/05/07         1,590.00  CAD
      Pay     ONE THOUSAND FIVE HUNDRED NINETY & 00/100****************** CANADIAN D
      To The  CANADIAN ENERGY EFFICIENCY
      Order   ALLIANCE
      Of      2800 SKYMARK AVENUE
              MISSISSAUGA ON L4W 5A6             ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      CANENERGEF   02                1200175683   16/05/07
      Payee
      CANADIAN ENERGY EFFICIENCY
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      11/05/07 2117                                     0.00 CAD         1,590.00
                                                                                    Check No.   Date      Payment Amt
                                     1200175684  16/05/07         8,701.83  CAD
      Pay     EIGHT THOUSAND SEVEN HUNDRED ONE & 83/100****************** CANADIAN D
      To The  CITY OF HAMILTON
      Order   ACCOUNTS RECEIVABLE
      Of      120 KING ST WEST
              SUITE 900, STANDARD LIFE BLDG      ______________________________
              HAMILTON ON L8P 4V2
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      CITYHAMIL    01                1200175684   16/05/07
      Payee
      CITY OF HAMILTON
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      12/04/07 112949                                   0.00 CAD         8,701.83
                                                                                    Check No.   Date      Payment Amt
                                     1200175685  16/05/07        23,104.38  CAD
      Pay     TWENTY THREE THOUSAND ONE HUNDRED FOUR & 38/100************ CANADIAN D
      To The  MINISTRY OF COMMUNITY AND
      Order   SOCIAL SERVICES,  DIRECTOR
      Of      FAMILY RESPONSIBILITY OFFICE
              PO BOX 2204  STATION P             ______________________________
              TORONTO ON M5S 3E9
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      FAMILYREOF                     1200175685   16/05/07
      Payee
      MINISTRY OF COMMUNITY AND
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 FRO02MAY07                               0.00 CAD        23,104.38
                                                                                    Check No.   Date      Payment Amt
                                     1200175686  16/05/07           553.85  CAD
      Pay     FIVE HUNDRED FIFTY THREE & 85/100************************** CANADIAN D
      To The  HAROLD MCQUAKER ENTERPRISES
      Order   LTD
      Of      BOX 538
              EMO ON P0W 1E0                     ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      HAROLDMCEN                     1200175686   16/05/07
      Payee
      HAROLD MCQUAKER ENTERPRISES
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      17/03/07 121                                      0.00 CAD           553.85
                                                                                    Check No.   Date      Payment Amt
                                     1200175687  16/05/07       428,684.44  CAD
      Pay     **********428,684.44************************************* CANADIAN D
      To The  MERIDIAN CREDIT UNION
      Order   STE 160 S
      Of      483 BAY ST
              TORONTO ON M5G 2E1                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      HEPCOEDRUN   12                1200175687   16/05/07
      Payee
      MERIDIAN CREDIT UNION
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 MERIDIEN02MAY07                          0.00 CAD       428,684.44
                                                                                    Check No.   Date      Payment Amt
                                     1200175688  16/05/07         7,319.15  CAD
      Pay     SEVEN THOUSAND THREE HUNDRED NINETEEN & 15/100************* CANADIAN D
      To The  HYDRO ONE EMPLOYEES AND
      Order   PENSIONERS CHARITY TRUST
      Of      483 BAY STREET 14TH FL
              NORTH TOWER                        ______________________________
              TORONTO ON M5G 2P5
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      HYDROONEEP                     1200175688   16/05/07
      Payee
      HYDRO ONE EMPLOYEES AND
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 CHARITY02MAY07                           0.00 CAD         7,319.15
                                                                                    Check No.   Date      Payment Amt
                                     1200175689  16/05/07           357.97  CAD
      Pay     THREE HUNDRED FIFTY SEVEN & 97/100************************* CANADIAN D
      To The  MINISTER OF FINANCE
      Order   KENORA SMALL CLAIMS COURT
      Of      216 WATER STREET
              KENORA ON P9N 1S4                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      KENORASMCC                     1200175689   16/05/07
      Payee
      MINISTER OF FINANCE
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 KENORASMCC09MAY                          0.00 CAD           357.97
                                                                                    Check No.   Date      Payment Amt
                                     1200175690  16/05/07           692.41  CAD
      Pay     SIX HUNDRED NINETY TWO & 41/100**************************** CANADIAN D
      To The  MURRAY, WALTER
      Order   .
      Of      1721 CEDAR LANE
              BRACEBRIDGE ON P1L 1W9             ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      MURRAYWALT                     1200175690   16/05/07
      Payee
      MURRAY, WALTER
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      09/05/07 EXS2007710                               0.00 CAD           692.41
                                                                                    Check No.   Date      Payment Amt
                                     1200175691  16/05/07         2,437.44  CAD
      Pay     TWO THOUSAND FOUR HUNDRED THIRTY SEVEN & 44/100************ CANADIAN D
      To The  PACE, ROBERT
      Order   .
      Of      5121 SACKVILLE ST, 7TH FLOOR
              HALIFAX NS B3J 1K1                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      PACEROBERT                     1200175691   16/05/07
      Payee
      PACE, ROBERT
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      09/05/07 EXS200711                                0.00 CAD         2,437.44
                                                                                    Check No.   Date      Payment Amt
                                     1200175692  16/05/07         2,718.35  CAD
      Pay     TWO THOUSAND SEVEN HUNDRED EIGHTEEN & 35/100*************** CANADIAN D
      To The  RECEIVER GENERAL FOR CANADA
      Order   CANADA CUSTOMS REVENUE AGENCY
      Of      875 HERON RD
              OTTAWA ON K1A 1B1                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      RECEIVEGEN                     1200175692   16/05/07
      Payee
      RECEIVER GENERAL FOR CANADA
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 CRABNW02MAY07                            0.00 CAD         2,718.35
                                                                                    Check No.   Date      Payment Amt
                                     1200175693  16/05/07         7,688.00  CAD
      Pay     SEVEN THOUSAND SIX HUNDRED EIGHTY EIGHT & 00/100*********** CANADIAN D
      To The  RECEIVER GENERAL FOR CANADA
      Order   INDIAN & NORTHERN AFFAIRS
      Of      100 ANEMKI DRIVE
              RR #4                              ______________________________
              THUNDER BAY ON P7J 1A5
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      RECEIVGECA   77                1200175693   16/05/07
      Payee
      RECEIVER GENERAL FOR CANADA
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 P2107132007                              0.00 CAD         7,688.00
                                                                                    Check No.   Date      Payment Amt
                                     1200175694  16/05/07         4,155.20  CAD
      Pay     FOUR THOUSAND ONE HUNDRED FIFTY FIVE & 20/100************** CANADIAN D
      To The  REUTERS CANADA LIMITED
      Order   CANADA
      Of      PO BOX 1519, STATION A
              TORONTO ON M5W 3N9                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      REUTERINSV                     1200175694   16/05/07
      Payee
      REUTERS CANADA LIMITED
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      01/04/07 ICA807040667                             0.00 CAD         4,155.20
                                                                                    Check No.   Date      Payment Amt
                                     1200175695  16/05/07         4,155.20  CAD
      Pay     FOUR THOUSAND ONE HUNDRED FIFTY FIVE & 20/100************** CANADIAN D
      To The  REUTERS CANADA LIMITED
      Order   CANADA
      Of      PO BOX 1519, STATION A
              TORONTO ON M5W 3N9                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      REUTERINSV                     1200175695   16/05/07
      Payee
      REUTERS CANADA LIMITED
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      01/05/07 ICA807050645                             0.00 CAD         4,155.20
                                                                                    Check No.   Date      Payment Amt
                                     1200175696  16/05/07        10,000.00  CAD
      Pay     TEN THOUSAND & 00/100************************************** CANADIAN D
      To The  WATERLOO REGIONAL CHILDRENS
      Order   MUSEUM
      Of      10 KING ST W
              KITCHENER ON N2G 1A3               ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      WATERLRECM                     1200175696   16/05/07
      Payee
      WATERLOO REGIONAL CHILDRENS
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      29/11/06 2006050034                               0.00 CAD        10,000.00

    Raj:
    You could create a 'Before Header' page process to create this 'flat file'. The code for the page process will be something similar to declare
    v_file_name   VARCHAR2 (2000) := 'fixedFieldsFile.txt';
    --- Client Record Format
    f1 char(20);
    f2 char(20);
    f3 char(20);
    ---- End format
    begin
    OWA_UTIL.mime_header ('application/txt', FALSE);
    htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
    OWA_UTIL.http_header_close;
    for c1 in (select * from emp) loop                           ----- The report query
    f1:= c1.empno;f2:=c1.ename;f3:=c1.sal;
    htp.p(f1||f2||f3);
    end loop;
    apex_application.g_unrecoverable_error:=true;
    exception when others then
    null;
    end; Varad

  • XML data (Output) into a flat file

    I need to convert XML data into a flat file, which is having "|" as delimiter and ftp the same to a server. The XML data is an output of BPEL activity. The XML data is employee records. Each employee records should come as one line in the flat file.
    Is it possible to do this? if so, what will be the steps
    Thanks

    Hi,
    You need to use file adapter to write your XML payload as a flat file.
    Following are the steps to write XML payload into a flat file:
    1. Create a sample flat file and add few rows in which fields should be delimited with pipe symbol. See the record sample given below:
    Name|Age|Address|City|State|Zip
    Sam|32|2788 Viking Dr|Green Bay|WI|54304
    Here first row is the header row, you can remove the header row if it is not required.
    2. Create a file adapter service using adapter configuration wizard. Give file name and folder location where you want to write flat file. On step 5 of the adapter configuration wizard you have to define or select message schema. Click on Define Schema for Native Format button, then Native Format Builder Wizard will be opened, here you can define message schema for your flat file.
    2.1 Here you need to select Delimited for file type.
    2.2 Give details about your flat file, select your sample flat file here, which you have created in step 1 above.
    2.3 Click Next button twice and go to step 4, here give namespace and element names you want and click on Next.
    2.4 In step 5 you need to specify delimiters. Wizard doesn’t shows *|* as a delimiter so you need to enter *|* in the Delimited By combo box and click on Next button.
    2.5 Complete remaining steps and click on Finish in the wizard.
    3. Finish "Adapter Creation Wizard". Add BPEL activities (assign, invoke) to pass XML payload to file adapter and file adapter will generate *|* delimited flat file and write it to the given folder.
    See the following article for more details on Native Format Builder Wizard:
    http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/nfb.htm#CCHCIGCA
    Regards,
    Dharmendra
    http://soa-howto.blogspot.com

  • Facing Problem in IDOC to EDI FLAT File Scenario

    Hi,
    I am working on a scenario IDOC to EDI FLAT File. For this I have used ABAP mapping.
    The problem i am facing is that the EDI FILE contains the segment name as E1EDK01 for eg. while I need the name as per the latest segment definiton released. I have also tried this using File port and it gives the required segment names in file.  But we dont have to use File ports. Please suggest me if something is missing in PI Abap stack ?? Why I am not getting the segments name as per latest segment definition mainatined in R3.
    Thanks
    Neha

    Hi Neha,
                   Please check the segment name in sxmb_moni. Is this showing new value or the old value?
    If SXMB_MONI shows old value then the source SAP (R/3) system which is sending the idoc may not have released the segment after changing the name. You need to ensure that the idoc segment has been released properly. Then re-import the iodc into PI server again. Finally delete entry of the iodc structure in idx2 transaction, no need to re-import the idoc structute again in idx2, since once you run the scenario the metadata automatically gets imported.
    regards
    Anupam

  • IDoc as a flat file...

    I want to read a flat file that is an IDoc and post it as a XML after necessary conversion...So i wanted to know what are the feasible ways to read the flat file thats an IDoc?

    Your flat file is of fixed lenght format or tab delimited I believe. Get the flat file data into an internal table. Study the IDOC structure in transaction WE30. & according populate the idoc segemnts from the internal table value..
    For ABAP to XML conversion..Create XSLT & the extraction program..
    Create XSLT:
    In transaction SE80 browse menu Workbench -> Edit Object. In the popup window enter XSLT Program name (e.g. ZXSLT) and click on create button.
    Enter the following code into the editor..
    <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    <!xsl:output encoding="utf-8" indent="yes"/>
    <xsl:template match="D2CXML">
    <PurchaseOrders>
    <xsl:apply-templates/>
    </PurchaseOrders>
    </xsl:template>
    <xsl:template match="item">
    <PONO>
    <xsl:attribute name="no">
    <xsl:value-of select="EBELN"/>
    </xsl:attribute>
    <PORDNO>
    <xsl:apply-templates select="EBELN"/>
    </PORDNO>
    <Vendor>
    <xsl:apply-templates select="LIFNR"/>
    </Vendor>
    <PurchaseOrg>
    <xsl:apply-templates select="EKORG"/>
    </PurchaseOrg>
    <PurchaseGrp>
    <xsl:apply-templates select="EKGRP"/>
    </PurchaseGrp>
    <xsl:apply-templates select="X-MLSTRUCT"/>
    </PONO>
    </xsl:template>
    <xsl:template match="X-MLSTRUCT">
    <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="X-MLSTRUCT/item">
    <Product>
    <ItemNo>
    <xsl:apply-templates select="EBELP"/>
    </ItemNo>
    <Material>
    <xsl:apply-templates select="MATNR"/>

  • What are the advantages of idoc compare to flat file. how data is secure

    what are the advantages of idoc compare to flat file. how data is secure in idocs compare to flat file

    Hi Ramana,
    In simple words, Main advantage with idoc over flat file is security....
    I will explain you some scenario here U got a flat file with all the data...Now u r having the flat file if you want u can modify the data in it, or somehow any one can modify the data in it  if they were able to access this file. That means u maintained the file in the presentation server
    One level of higher security to the above level is maintaining the flat file in application server, at point also even though lot of people r not having the access to that file, super user who is  having  the access may modify the data or delete the data from it rite....
    so in both of those levels u don't have 100% security...
    So there come to the picture of idocs, Idocs simply data carriers, those r generated by a program but not manually...data will be divided into number of segments based upon ur program. So manually its not so easy to modify the data in these idocs. If any changes to be made in the data then u have to modify the data in the application and then u have to update the idoc or you have to generate the new idoc with that corresponding data. so in this case not even super user can manipulate the data directly in the idoc....
    I think u got my point what I mean to say.....
    If you find it useful mark the points
    ~~Guduri

  • Is there any standard ptogram/tcode to download idoc contents with fields.

    Hello All,
    Is there any standard ptogram/tcode to download idoc contents with fields?
    Thanks,
    Devaraj.

    Hi Patil,
    I dont think there is standard program or t-code.
    But u can down load the IDOC with field contents by following way
    Goto t-code WE62- give the basic idoc name- press display button  then it shows all filed contents with description.
    Now select 'SYSTEM' LISTSAVE--LOCAL FILE from menu bar .
    Here select the file type ie spread sheet,html, etc and give the file name and directory where u need to place it.
    <b>Rewards with points if helpful.</b>
    Regards,
    Vijay.

  • Error Loading Data into a flat file

    I am recieving the following error when loading data into a flat file from a flat file. SQL 2005 is my back end DB. If I cut the file iin half approx 500K rows my ODI interface works fine. Not sure what to look at.. I rebuit the interface which before was just dying giving no error and now I am getting this.
    Thanks
    java.lang.Exception
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)

    Figured it out, found similar post that stated changing the HEAP size
    Increase the page size in odiparams.bat in the bin folder and restart Designer.
    For eg:
    set ODI_INIT_HEAP=128m
    set ODI_MAX_HEAP=1024m

  • Idoc data in flat file structure

    Dear Experts,
             We have  idoc data in flat file structure. We need to fetch it using ftp and map it to an idoc.
    please tell me how to proceed .
    Thanks,
    Aju

    Hi,
    For flat file you need to use the File content conversion parameters.
    Refer the blog,
    SAP Network Blog: How to process flat files with multiple documents like POs, SOs etc. in a File to IDoc scenario
    How to process flat files with multiple documents like POs, SOs etc. in a File to IDoc scenario
    Thanks
    Swarup

  • What is the best way to export the data out of BW into a flat file on the S

    Hi All,
    We are BW 7.01 (EHP 1, Service Pack Level 7).
    As part of our BW project scope for our current release, we will be developing certain reports in BW, and for certain reports, the existing legacy reporting system based out of MS Access and the old version of Business Objects Release 2 would be used, with the needed data supplied from the BW system.
    What is the best way to export the data out of BW into a flat file on the Server on regular intervals using a process chain?
    Thanks in advance,
    - Shashi

    Hello Shashi,
    some comments:
    1) An "open hub license" is required for all processes that extract data from BW to a non-SAP system (including APD). Please check with your SAP Account Executive for details.
    2) The limitation of 16 key fields is only valid when using open hub for extracting to a DB table. There's no such limitation when writing files.
    3) Open hub is the recommended solution since it's the easiest to implement, no programming is required, and you don't have to worry much about scaling with higher data volumes (APD and CRM BAPI are quite different in all of these aspects).
    For completeness, here's the most recent documentation which also lists other options:
    http://help.sap.com/saphelp_nw73/helpdata/en/0a/0212b4335542a5ae2ecf9a51fbfc96/frameset.htm
    Regards,
    Marc
    SAP Customer Solution Adoption (CSA)

  • Export records into a flat file

    Hi...
    I have to export some tables into a flat file. The output must be like this:
    insert into table (col1, col2.....) value (one, two......)
    insert into table (col1, col2.....) value (one, two......)
    insert into table (col1, col2.....) value (one, two......)
    how can I do that.......with PLSQL code?
    Thanks
    Message was edited by:
    marckcos

    I got this package : and I got the follwing error:
    4:35:19 PM Execution failed: ORA-20011: GENERATE_STMT Error in populating file. Message: ORA-00904: "CHANGE_DATATYPE": invalid identifier
    What can I do?
    CREATE OR REPLACE PACKAGE BODY UTILITY
    IS
    -- VARIABLES USED by PROCEDURE generate_stmt
    -- File Related PACKAGE Variable
    cmn_file_handle UTL_FILE.file_type;
    PROCEDURE close_file
    IS
    BEGIN
    UTL_FILE.FCLOSE (cmn_file_handle);
    EXCEPTION
    WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    RAISE_APPLICATION_ERROR(-20003, 'File handle was invalid');
    WHEN UTL_FILE.INVALID_PATH THEN
    RAISE_APPLICATION_ERROR(-20004, 'Invalid path for file');
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20005, 'CLOSE_FILE Error in creating file. Message: ' || SQLERRM);
    END close_file;
    PROCEDURE open_file (
    prm_output_folder IN VARCHAR2,
    prm_output_file IN VARCHAR2)
    IS
    BEGIN
    cmn_file_handle := UTL_FILE.FOPEN (prm_output_folder, prm_output_file, 'a', 32767);
    EXCEPTION
    WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    close_file;
    RAISE_APPLICATION_ERROR(-20000, 'File handle was invalid');
    WHEN UTL_FILE.INVALID_PATH THEN
    close_file;
    RAISE_APPLICATION_ERROR(-20001, 'Invalid path for file');
    WHEN OTHERS THEN
    close_file;
    RAISE_APPLICATION_ERROR(-20002, 'OPEN_FILE Error in creating file. Message: ' || SQLERRM);
    END open_file;
    FUNCTION change_datatype (
    prm_value IN VARCHAR2,
    prm_data_type IN VARCHAR2)
    RETURN VARCHAR2
    IS
    BEGIN
    IF prm_value IS NULL THEN
    RETURN ('NULL');
    END IF;
    IF prm_data_type = 'C' THEN
    IF INSTR(prm_value, CHR(10)) > 0 THEN
    RETURN ('REPLACE(' || '''' || REPLACE (prm_value, CHR(10), CHR(977)) || '''' || ', CHR(977), CHR(10))');
    END IF;
    ELSIF prm_data_type = 'D' THEN
    RETURN ('TO_DATE(' || '''' || prm_value || '''' || ', ' || '''' || 'DD-MON-YYYY HH24:MI:SS' || '''' || ')');
    ELSIF prm_data_type = 'N' THEN
    RETURN (prm_value);
    END IF;
    RETURN ('''' || prm_value || '''');
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20002, 'CHANGE_DATATYPE Error in Converting DataType. Message: ' || SQLERRM);
    END change_datatype;
    PROCEDURE generate_stmt (
    prm_table_name IN VARCHAR2,
    prm_where_clause IN VARCHAR2,
    prm_output_folder IN VARCHAR2,
    prm_output_file IN VARCHAR2)
    IS
    TYPE ref_cols IS REF CURSOR;
    mmy_ref_cols ref_cols;
    mmy_column_name VARCHAR2(100);
    mmy_column_data_type VARCHAR2(1);
    mmy_col_string VARCHAR2(32767);
    mmy_query_col_string VARCHAR2(32767);
    BEGIN
    IF prm_table_name IS NULL OR
    prm_output_folder IS NULL OR
    prm_output_file IS NULL THEN
    RAISE_APPLICATION_ERROR(-20012, 'Invalid Argument Passed');
    END IF;
    OPEN mmy_ref_cols
    FOR SELECT LOWER(column_name) column_name,
    DECODE (data_type, 'VARCHAR2', 'C', 'CHAR', 'C', 'LONG', 'C', 'NUMBER', 'N', 'DATE', 'D') data_type
    FROM user_tab_columns
    WHERE table_name = UPPER(prm_table_name)
    ORDER BY column_id;
    LOOP
    FETCH mmy_ref_cols INTO mmy_column_name, mmy_column_data_type;
    EXIT WHEN mmy_ref_cols%NOTFOUND;
    mmy_col_string := mmy_col_string || mmy_column_name || ', ';
    IF mmy_column_data_type = 'D' THEN
    mmy_query_col_string := mmy_query_col_string || 'change_datatype(' || 'TO_CHAR(' || mmy_column_name || ', ' || '''' || 'DD-MON-YYYY HH24:MI:SS' || '''' || ')' || ', ' || '''' || mmy_column_data_type || '''' || ') || ' || '''' || ', ' || '''' || ' || ';
    ELSIF mmy_column_data_type IN ('N', 'C') THEN
    mmy_query_col_string := mmy_query_col_string || 'change_datatype(' || mmy_column_name || ', ' || '''' || mmy_column_data_type || '''' || ') || ' || '''' || ', ' || '''' || ' || ';
    END IF;
    END LOOP;
    CLOSE mmy_ref_cols;
    IF mmy_col_string IS NOT NULL AND
    mmy_query_col_string IS NOT NULL THEN
    IF NOT UTL_FILE.IS_OPEN(cmn_file_handle) THEN
    open_file(prm_output_folder, prm_output_file);
    END IF;
    mmy_col_string := 'INSERT INTO ' || LOWER(prm_table_name) || ' (' || CHR(10) || CHR(9) || CHR(9) || mmy_col_string;
    mmy_col_string := RTRIM (mmy_col_string, ', ');
    mmy_col_string := mmy_col_string || ')' || CHR(10) || 'VALUES ( ' || CHR(9);
    mmy_query_col_string := RTRIM (mmy_query_col_string, ' || ' ||'''' || ',' || '''' || ' || ') || ' one_pare';
    OPEN mmy_ref_cols
    FOR ' SELECT ' || mmy_query_col_string ||
    ' FROM ' || prm_table_name ||
    ' ' || prm_where_clause;
    LOOP
    FETCH mmy_ref_cols INTO mmy_query_col_string;
    EXIT WHEN mmy_ref_cols%NOTFOUND;
    mmy_query_col_string := mmy_query_col_string || ');';
    UTL_FILE.put (cmn_file_handle, mmy_col_string);
    UTL_FILE.put_line (cmn_file_handle, mmy_query_col_string);
    END LOOP;
    CLOSE mmy_ref_cols;
    If UTL_FILE.IS_OPEN(cmn_file_handle) THEN
    close_file;
    END IF;
    END IF;
    EXCEPTION
    WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    IF mmy_ref_cols%ISOPEN THEN
    CLOSE mmy_ref_cols;
    END IF;
    close_file;
    RAISE_APPLICATION_ERROR(-20009, 'File handle was invalid');
    WHEN UTL_FILE.INVALID_PATH THEN
    IF mmy_ref_cols%ISOPEN THEN
    CLOSE mmy_ref_cols;
    END IF;
    close_file;
    RAISE_APPLICATION_ERROR(-20010, 'Invalid path for file');
    WHEN OTHERS THEN
    IF mmy_ref_cols%ISOPEN THEN
    CLOSE mmy_ref_cols;
    END IF;
    close_file;
    RAISE_APPLICATION_ERROR(-20011, 'GENERATE_STMT Error in populating file. Message: ' || SQLERRM);
    END generate_stmt;
    END utility;
    ############################################################

  • How to split column wise into separate flat files in ssis

    IN SSIS...
    1.---->I have a sales table country wise regions  like (india, usa, srilanka) ....
    india usa
    srilanka
    a b
    c
    d e
    f
    so i want output like in
    flat file1.txt has india               flat file2.txt has usa             flat file3.txt has srilanka
         a b
    c
         d e
    f
    2.----->i dont know how many regions in my table....dynamically split into separate flat files ....
     pls help me.....thank u

    I think what you can do is this
    1. Do a query based on UNPIVOT to get the data as rows instead of columns
    For that you can use a query like this
    IF OBJECT_ID('temp') IS NOT NULL DROP TABLE temp
    CREATE TABLE temp
    Country varchar(100),
    Val decimal(25,5)
    DECLARE @CountryList varchar(3000),@SQL varchar(max)
    SELECT @CountryList = STUFF((SELECT ',[' + Column_Name + ']' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '<SalesTableNameHere>' FOR XML PATH('')),1,1,'')
    SET @SQL= 'SELECT * FROM <SalesTableNameHere> t UNPIVOT (Val FOR Country IN (' + @CountryList + '))p'
    INSERT temp
    EXEC (@SQL)
    Once this is done you'll get data unpivoted to table
    Then you can use a execute sql task with query like above
    SELECT DISTINCT Country FROM Temp
    Use resultset option as full resultset and store the result to an object variable
    Then add a ForEach loop container with ADO enumerator and map to the object variable created above. Have variables inside loop to get inidvidual country values out.
    Inside loop place a data flow task. Use a variable to store source query , make EvaluateAsExpression true for it and set Expression as below
    "SELECT Val FROM Temp WHERE Country = " + @[User::LoopVariable]
    Where LoopVariable is variable created inside loop for getting iterated values
    Inside data flow task place a oledb source, choose option as  SQL command from variable and map to the above query variable.
    Link this to flat file destination create a flat file connection manager. Set a dynamic flat file connection using expression builder. Make it based on a variable and set variable to increment based on loop iteration
    The core logic looks similar to this
    http://visakhm.blogspot.ae/2013/09/exporting-sqlserver-data-to-multiple.html
    dynamic file naming can be seen here
    http://jahaines.blogspot.ae/2009/07/ssis-dynamically-naming-destination.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Export multiple tables into one flat file

    I have data in multiple tables on a processing database that I need to move up to a production database. I want to export the data into a flat file, ftp it to the production server and have another job pick up the file and process it. I am looking for
    design suggestions on how to get multiple tables into one flat file using SSIS?
    Thank You.

    Hey,
    Without a bit more detail, as per Russels response, its difficult to give an exact recommendation.
    Essentially, you would first add a data flow task to your control flow.  Create a source per table, then direct the output of each into an union all task.  The output from the union all task would then be directed to a flat file destination.
    Within the union all task you can map the various input columns into the appropriate outputs.
    If the sources are different, it would probably be easiest to add a derived column task in-between the source and the union all, adding columns as appropriate and setting a default value that can be easily identified later (again depending on your requirements).
    Hope that helps,
    Jamie

  • Download dynpro fields to flat file

    Hi,
    I have a requirement to capture the value of fields like customer, job name and functional location from a service notification (IW51-create/ IW52- change/ IW53 - display) and download them to a flat file.
    As it is a common requirement for create, change and display of service notification, placing the user exit for reading the required data, upon save, will not be the best option.
    Can someone suggest a better way to do this?
    Thanks,
    Rugmani.

    Hi,
    You can use dynp_values_read fn module to get all values during runtime.
    DATA : l_progname TYPE sy-repid,
          l_dynnum TYPE sy-dynnr.
    DATA : dynpread_tab LIKE STANDARD TABLE OF dynpread WITH HEADER LINE.
      l_progname = sy-repid.
      l_dynnum = sy-dynnr.
      CLEAR dynpread_tab.
      REFRESH dynpread_tab.
      dynpread_tab-fieldname = 'fieldname'.
      APPEND dynpread_tab. " apped all the fields in this table for which u want to get all the values at runtime.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = l_progname
          dynumb               = l_dynnum
        TABLES
          dynpfields           = dynpread_tab
        EXCEPTIONS
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          OTHERS               = 11.
      IF sy-subrc <> 0.
      ENDIF.
    dynpread_tab-fieldvalue will get the value of the field.
    Once you get all the values - use GUI_Download fn module to download them to a flat file.
    Award me points if it helps.
    Thanks,
    Sheel

Maybe you are looking for

  • CS5 for Mac or PC (Specs for both included)

    I have both a Macbook and a Dell laptop, and I'm trying to figure out which machine would run most CS5 programs better, with an emphasis on Photoshop, Illustrator, and Dreamweaver. Dell OS: Win XP 32bit (cannot upgrade because of work) 2.80 ghz Core

  • MB Pro won't install os x mavericks after re-formatting

    Hi guys, Basically, my macbook pro dec 2011 won't install mavericks os after I have formatted my mb. What happens: with DU I checked the HD and no issues found, I formatted the macbook by using DU and erasing the HD (took about 4 hours - 3 times eras

  • What is the best way to connect a Korg Trinity-Pro to logic.

    And use the Sounds from the Korg to record Midi. Not to use the Korg to play Midi in Logic, using Logic-Sounds, but the sounds from the Korg to record Midi. Fr.BlayZay.

  • Errors in IDocs

    Hello Every one Lets Say there are 10 different errors in an IDoc. When we go to Status records we will see "Status 51" 10 times with different errors. I have to click 51 many times to see what error is there. Is there any way i can look all the erro

  • Which case in LV Oper. Intf. will do "Run Selected Steps using single pass" for me?

    I added a button to simulate "Run Selected Steps", but I really want a button that will "Run Selected Steps Using Single Pass". Which case in the Complex Labview Operator Interface does this for me? What I really want is the report to be generated wh