Create a file in fixed format through procedure

Hi Gurus !!,
Your help is greatly appreciated .
I know to create a procedure  to genrate  the file in a .csv format 
But ,I have to create a procedure  to  generate a file in fixed format , So each field will have the length as per the length defied in the tables and with the page headers, etc
please help me here
beloW is the  table structure of statae .
state :
NAME               Not null     VARCHAR2 (40 Byte)      
STATE_CODE        Not null    VARCHAR2 (2 Byte)       
CONTINENTAL_US_FLAG     null     VARCHAR2 (1 Byte)     
sample data :
STATE_CODE
NAME
CONTINENTAL_US_FLAG
AI
ANGUILLA
AG
ANTIGUA AND BARBUDA
AW
ARUBA
N
BQ
BONAIRE,ST.EUSASIUS AND SABA
CW
CURACAO
Y
Data for the log and out files in the PROCESS_REFERENCE table
PROCESS_ID
PROCESS_NAME
FILE_IDENTIFIER
PATH_NAME
PROCESS_FILE_NAME
DATE_FORMAT_FOR_FILE_NAME
DEBUG_FLAG
369
FILE_STATE
LOG
/home/devtest/log/
<DATE>.FILE_STATE.LOG
YYYYMMDD
Y
340
FILE_STATE
OUT
/home/devtest/rpts/
<DATE>.FILE_STATE.OUT
YYYYMMDD
Y
This is the proc i created to generate .csv fiel which needs to be modidfied with fixed length formate as said above.
CREATE OR REPLACE PROCEDURE SAMPLE_FILE 
AS
   fLOG_FILE               UTL_FILE.FILE_TYPE;
   fRPT_FILE               UTL_FILE.FILE_TYPE;  
   vLOGFILE_PATH           PROD.PROCESS_REFERENCE.PATH_NAME%TYPE := NULL;
   vLOGFILE_NAME           PROD.PROCESS_REFERENCE.PROCESS_FILE_NAME%TYPE := NULL;
   nLOGFILE_PROCESS_ID     PROD.PROCESS_REFERENCE.PROCESS_ID%TYPE := NULL;
   vRPTFILE_PATH           PROD.PROCESS_REFERENCE.PATH_NAME%TYPE := NULL;
   vRPTFILE_NAME           PROD.PROCESS_REFERENCE.PROCESS_FILE_NAME%TYPE := NULL;
   nRPTFILE_PROCESS_ID     PROD.PROCESS_REFERENCE.PROCESS_ID%TYPE := NULL;
   vDEBUG_FLAG             PROD.PROCESS_REFERENCE.DEBUG_FLAG%TYPE := NULL;
   nWRITE_COUNT            NUMBER :=0;
   vSYS_TIME               VARCHAR2 ( 30 ):= NULL;
   bLOG                    BOOLEAN :=FALSE;
PROCEDURE PROC_LOG ( LINE_IN IN VARCHAR2 )
IS
BEGIN
    IF bLOG
      THEN
          vSYS_TIME :=TO_CHAR(SYSDATE, 'YYYYMMDD - HH24:MI:SS' );
          UTL_FILE.PUT_LINE ( fLOG_FILE, 'Process Started on ' ||vSys_Time || ' - ' || LINE_IN );
          UTL_FILE.FFLUSH ( fLOG_FILE );
           bLOG :=TRUE;
    END IF;
EXCEPTION
  WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('ERROR IN LOG  : ' || SUBSTR(SQLERRM,1,225));
         RAISE;
END PROC_LOG;
BEGIN
         SELECT  PROCESS_ID, PATH_NAME, REPLACE(PROCESS_FILE_NAME,'<DATE>',
           TO_CHAR(SYSDATE,DATE_FORMAT_FOR_FILE_NAME)) FILE_NAME, NVL(DEBUG_FLAG,'N') DEBUG_FLAG
          INTO  nLOGFILE_PROCESS_ID, vLOGFILE_PATH , vLOGFILE_NAME, vDEBUG_FLAG
          FROM  PROD.PROCESS_REFERENCE
          WHERE PROCESS_NAME = 'FILE_STATE'
          AND FILE_IDENTIFIER ='LOG' ;
           IF  vDEBUG_FLAG = 'Y' THEN
                BEGIN
                  fLOG_FILE :=UTL_FILE.FOPEN(vLOGFILE_PATH,vLOGFILE_NAME,'W',32767);
                   bLOG := TRUE;
                EXCEPTION
                  WHEN OTHERS THEN
                       bLOG := FALSE;
                   RAISE;
                END;
          END IF;
        BEGIN
                SELECT PROCESS_ID,PATH_NAME,
                     REPLACE(PROCESS_FILE_NAME,'<DATE>', TO_CHAR(SYSDATE,DATE_FORMAT_FOR_FILE_NAME)) FILE_NAME
                INTO nRPTFILE_PROCESS_ID, vRPTFILE_PATH, vRPTFILE_NAME
                FROM PROD.PROCESS_REFERENCE
                WHERE PROCESS_NAME = 'FILE_STATE'
                AND FILE_IDENTIFIER ='OUT' ;
                PROC_LOG ('Opening File : '||vRPTFILE_NAME);
                fRPT_FILE := UTL_FILE.FOPEN(vRPTFILE_PATH, vRPTFILE_NAME, 'W');
                UTL_FILE.PUT_LINE(fRPT_FILE,'STATE CODE' || ','
                                            || 'NAME' || ','                                       
                                            || 'CONTINENTAL_US_FLAG' );                         
        EXCEPTION
                WHEN NO_DATA_FOUND THEN
                    UTL_FILE.PUT_LINE(fLog_File,'ERROR in FILE OPEN : ' || SUBSTR(SQLERRM,1,1000));
                    RAISE;
        END;
         FOR CUR IN ( select state_code ,name, CONTINENTAL_US_FLAG from  state ,COUNTRY
                       WHERE ALPHA_CODE =STATE_CODE)
         LOOP
                UTL_FILE.PUT_LINE(fRPT_FILE ,CUR.state_code || ' ,'
                                  || '''' ||CUR.CONTINENTAL_US_FLAG||''','
                                  ||'"'||CUR.name||'"'); 
                                  nWRITE_COUNT :=nWRITE_COUNT+1;                                    
         END LOOP;
         IF UTL_FILE.is_open (fRPT_FILE)
           THEN
            UTL_FILE.fclose (fRPT_FILE);
         END IF;
         PROC_LOG('---- PROCESS COMPLETED ---> ');
         PROC_LOG('---TOTAL RECORDS WRITTEN ARE ---- : '|| nWRITE_COUNT );
         IF UTL_FILE.IS_OPEN (fLOG_FILE)
          THEN
            UTL_FILE.FCLOSE (fLOG_FILE);
            bLOG   := FALSE;
         END IF;
EXCEPTION
   WHEN OTHERS
      THEN
          IF UTL_FILE.is_open (fLOG_FILE) THEN
             PROC_LOG('ERROR IN MAIN !!' || SUBSTR(SQLERRM,1,250));
             UTL_FILE.fclose (fLOG_FILE);
                bLOG   := FALSE;
         ELSE
            DBMS_OUTPUT.PUT_LINE('ERROR IN MAIN !!' || SUBSTR(SQLERRM,1,250));
        END IF;
END SAMPLE_FILE  ;

Hi,
You can use RPAD to add spaces to the VARCHAR2 columns, like this:
UTL_FILE.PUT_LINE ( fRPT_FILE
                  , RPAD (CUR.state_code, 2) || ' ,'''  ||
                    CUR.CONTINENTAL_US_FLAG  || ''',"'  ||
                    RPAD (CUR.name, 40)      || '"'
Can the columns be NULL?  If so, you may need
UTL_FILE.PUT_LINE ( fRPT_FILE
                  , RPAD (NVL (CUR.state_code, ' '), 2) || ' ,'''  ||
                    NVL (CUR.CONTINENTAL_US_FLAG, ' ')  || ''',"'  ||
                    RPAD (NVL (CUR.name, ' '), 40)      || '"'
since   RPAD (str, len)   returns NULL if str is NULL.
Lose those EXCEPTION sections.  All they are doing is making it harder to find and fix errors.

Similar Messages

  • How to store xml data into file in xml format through java program?

    HI Friends,
    Please let me know
    How to store xml data into file in xml format through java program?
    thanks......
    can discuss further at messenger.....
    Avanish Kumar Singh
    Software Engineer,
    Samsung India Development Center,
    Bangalore--560001.
    [email protected]

    Hi i need to write the data from an XML file to a Microsoft SQL SErver database!
    i got a piece of code from the net which allows me to parse th file:
    import java.io.IOException;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    import org.apache.xerces.parsers.SAXParser;
    import java.lang.*;
    public class MySaxParser extends DefaultHandler
    private static int INDENT = 4;
    private static String attList = "";
    public static void main(String[] argv)
    if (argv.length != 1)
    System.out.println("Usage: java MySaxParser [URI]");
    System.exit(0);
    String uri = argv[0];
    try
    XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
    MySaxParser MySaxParserInstance = new MySaxParser();
    parser.setContentHandler(MySaxParserInstance);
    parser.parse(uri);
    catch(IOException ioe)
    ioe.printStackTrace();
    catch(SAXException saxe)
    saxe.printStackTrace();
    private int idx = 0;
    public void characters(char[] ch, int start, int length)
    throws SAXException
    String s = new String(ch, start, length);
    if (ch[0] == '\n')
    return;
    System.out.println(getIndent() + " Value: " + s);
    public void endDocument() throws SAXException
    idx -= INDENT;
    public void endElement(String uri, String localName, String qName) throws SAXException
    if (!attList.equals(""))
    System.out.println(getIndent() + " Attributes: " + attList);
    attList = "";
    System.out.println(getIndent() + "end document");
    idx -= INDENT;
    public void startDocument() throws SAXException
    idx += INDENT;
    public void startElement(String uri,
    String localName,
    String qName,
    Attributes attributes) throws SAXException
    idx += INDENT;
    System.out.println('\n' + getIndent() + "start element: " + localName);
    if (localName.compareTo("Machine") == 0)
    System.out.println("YES");
    if (attributes.getLength() > 0)
    idx += INDENT;
    for (int i = 0; i < attributes.getLength(); i++)
    attList = attList + attributes.getLocalName(i) + " = " + attributes.getValue(i);
    if (i < (attributes.getLength() - 1))
    attList = attList + ", ";
    idx-= INDENT;
    private String getIndent()
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < idx; i++)
    sb.append(" ");
    return sb.toString();
    }// END PRGM
    Now , am not a very good Java DEv. and i need to find a soln. to this prob within 1 week.
    The next step is to write the data to the DB.
    Am sending an example of my file:
    <Start>
    <Machine>
    <Hostname> IPCServer </Hostname>
    <HostID> 80c04499 </HostID>
    <MachineType> sun4u [ID 466748 kern.info] Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 360MHz) </MachineType>
    <CPU> UltraSPARC-IIi at 360 MHz </CPU>
    <Memory> RAM : 512 MB </Memory>
    <HostAdapter>
    <HA> kern.info] </HA>
    </HostAdapter>
    <Harddisks>
    <HD>
    <HD1> c0t0d0 ctrl kern.info] target 0 lun 0 </HD1>
    <HD2> ST38420A 8.2 GB </HD2>
    </HD>
    </Harddisks>
    <GraphicCard> m64B : PCI PGX 8-bit +Accel. </GraphicCard>
    <NetworkType> hme0 : Fast-Ethernet </NetworkType>
    <EthernetAddress> 09:00:30:C1:34:90 </EthernetAddress>
    <IPAddress> 149.51.23.140 </IPAddress>
    </Machine>
    </Start>
    Note that i can have more than 1 machines (meaning that i have to loop thru the file to be able to write to the DB)
    Cal u tellme what to do!
    Even better- do u have a piece of code that will help me understand and implement the database writing portion?
    I badly need help here.
    THANX

  • STORING DATA IN FILE IN XML FORMAT THROUGH JAVA ?

    HOW TO STORE DATA IN FILE IN XML FORMAT THROUGH JAVA PROGRAM?

    Have you looked into JAXB?
    That is a new way of processing XML into Java classes or visa versa.
    Otherwise, there are a lot of other XML related tools for Java in the -XML link on the left side of the page.

  • Unable to Create a file in a directory through a Job

    Hi,
    We have a anonymous block which uses utl_file package
    It created a file in an oracle directory.
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
          DECLARE
       v_definition_clob    CLOB;
       v_codes              VARCHAR2 (32767);
       v_engine_name        application.NAME%TYPE      := 'CLAIMS';
       v_knwldgebase_name   knowledge_base.NAME%TYPE   := 'CLAIMS';
       v_rule_name          VARCHAR2 (32767);
       v_msg                VARCHAR2 (200);
       fid                  UTL_FILE.file_type;
    BEGIN
       fid :=
          UTL_FILE.fopen ('MID5010_DOC1TEMP', 'Diagnosis_Report.csv', 'W', 32767);
       UTL_FILE.put_line (fid, 'Rule Name ,Associated Codes');
       FOR rule_name IN (SELECT DISTINCT rh.NAME, rh.rule_header_id
                                    FROM rule_header rh,
                                         knowledge_base kb,
                                         application app
                                   WHERE
                                         app.application_id = kb.application_id
                                     AND rh.knowledge_id = kb.knowledge_base_id
                                     AND app.NAME = 'CLAIMS'
                                     AND kb.NAME = 'CLAIMS')
       LOOP
          v_codes := NULL;
          BEGIN
             SELECT definition
               INTO v_definition_clob
               FROM rule_header
              WHERE rule_header_id = rule_name.rule_header_id;
          EXCEPTION
             WHEN NO_DATA_FOUND
             THEN
                v_definition_clob := EMPTY_CLOB ();
             WHEN TOO_MANY_ROWS
             THEN
                v_definition_clob := EMPTY_CLOB ();
          END;
          DBMS_OUTPUT.ENABLE (50000000);
          FOR code_indx IN (SELECT   d.diagnosis_code AS code
                                FROM midev.diagnosis d
                               WHERE d.diag_ctgry_lkpcd = 'D' AND ROWNUM < 10
                            ORDER BY 1 ASC)
          LOOP
             IF REGEXP_INSTR (v_definition_clob, code_indx.code) > 0
             THEN
                v_codes := v_codes || code_indx.code || '|';
             END IF;
          END LOOP;
          IF LENGTH (v_codes) > 0
          THEN
             v_codes := CHR (39) || v_codes;
          END IF;
          UTL_FILE.put_line (fid,
                                REPLACE (rule_name.NAME, ',', ' ')
                             || ','
                             || SUBSTR (v_codes, 1, LENGTH (v_codes) - 1)
       END LOOP;
       UTL_FILE.fclose (fid);
    EXCEPTION
       WHEN OTHERS
       THEN
          UTL_FILE.fclose (fid);
          v_msg := DBMS_UTILITY.format_error_backtrace ();
          DBMS_OUTPUT.put_line (v_msg || SQLCODE || ',' || SQLERRM);
    END;
             Now when i converted anonymous block into a procedure "DIAGNOSIS_REPORT_PROCEDURE" and calling it thorough a job its not creating the file. we are using the below code to create a job
                    BEGIN
       --DBMS_SCHEDULER.drop_job (job_name => 'DIAGNOSIS_TESTING_REPORT_3');
       DBMS_SCHEDULER.create_job
          (job_name             => 'DIAGNOSIS_TESTING_REPORT_3',
           job_type             => 'STORED_PROCEDURE',
           job_action           => 'DIAGNOSIS_REPORT_PROCEDURE',
           start_date           => to_Date('30-Mar-2012 16:44:03','dd-mon-yyyy hh24:mi:ss'),
           --repeat_interval      => 'freq=yearly',
           enabled              => TRUE,
           comments             => 'DIAGNOSIS_TESTING_REPORT_3'
    END;Any help would be appreciated..
    Thanks
    P Prakash.

    I got the answer.
    If we need to run a procedure through job then we must execute privilege .

  • How to create flat file with fixed lenght records

    I need help to export an Oracle table to a flat file with fixed lenght and without columns separator.
    the fixed length is the more important demand.
    My table have 50 columns with varchar, date and number .
    Date and number columns may be empty, null o with values.
    Thanks a lot for any help.
    [email protected]

    Hi,
    You can use this trick:
    SQL>desc t
    Name                                      Null?    Type
    NAME                                               VARCHAR2(20)
    SEX                                                VARCHAR2(1)
    SQL>SELECT LENGTH(LPAD(NAME,20,' ')||LPAD(SEX,1,' ')), LPAD(NAME,20,' ')||LPAD(SEX,1,' ') FROM T;
    LENGTH(LPAD(NAME,20,'')||LPAD(SEX,1,'')) LPAD(NAME,20,'')||LPA
                                          21                    aF
                                          21                    BM
                                          21                    CF
                                          21                    DM
    4 rows selected.
    SQL>SELECT *  FROM t;
    NAME                 S
    a                    F
    B                    M
    C                    F
    D                    M
    4 rows selected.Regards

  • Runtime Server Error in '/' Application and a 'create root file to fix' dunno how to do this.

    For several weeks Firefox crashes when I close it down for the day. Firefox error message box sends crash report. Today I got I think from Firefox: please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
    <!-- Web.Config Configuration File -->
    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration> Then there's a second file it says to add. Umm, where/how? The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
    <!-- Web.Config Configuration File -->
    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>
    Okay, but under ProgramFiles>Firefox there are several folders and none of them say "root" so where am I to create said file and how do I get it there? And then what? I sure don't want to crash Firefox any more than it does as it at least still works.

    jscher - wow. THANK YOU!!! Yes, pale yellow, have emptied cache. Perhaps now everything will again work glitchless. By the way, I completed about half of what all that the post on Firefox crashing said to do. I was a bit intimidated on the memtest86+ tool. But now I am again encouraged. Wouldn't you like to move to Idaho and be my close neighbor. Blessings! Thanks!

  • Creating EDI file of fixed length from B2B

    Hi Gurus,
    I want to create an edi 810 file from B2B(Outbound) for a partner which has an unusual requirement of the file length. The file length should be 80 characters long.
    The Output EDI should look something like this.
    ISA*00* *00* *01*041158668B *01*006927180 *110118*022
    0*U*00200*000011924*0*P*>~GS*IN*041158668B*006927180*20110118*0220*11924*X*00401
    0~ST*810*0001~BIG*20110118*4295914~REF*DP*Bakery~REF*IA*5169430~N1*ST*ALBERTSONS
    6002 BAKERY 2*9*06002~ITD*05*****20110128*10~DTM*011*20110118~IT1**1*CA*22.28*
    UP007829619749*VN*167~PID*F****FOCACCIA~PO4*35*12*OZ~IT1**1*CA*18.4**UP*003967
    707020*VN*12034~PID*F****BOULE SOURDOUGH~PO4*12*16*OZ~IT1**1*CA*45.33**UP*077098
    106100*VN*20894~PID*F****SCONE 2BT CRML TOFEE~PO4*24*11.25*OZ~IT1**1*CA*35.22**U
    P*004116398356*VN*22791~PID*F****DONUT PWD SGR HOLE~PO4*24*10*OZ~IT1**1*CA*16.46
    **UP*003967707000*VN*22882~PID*F****LRG BOULE SOURDGH~PO4*10*24*OZ~IT1**1*CA*17.
    5**UP*004116397450*VN*22896~PID*F****ANGEL FOOD BAR~PO4*15*10.5*OZ~IT1**1*CA*15*
    UP004116397451*VN*22897~PID*F****SHORTCAKE CUPS~PO4*30*4.5*OZ~IT1**1*CA*16.8**
    UP*004116397453*VN*22898~PID*F****ANGEL RINGS~PO4*8*16*OZ~IT1**1*CA*20.63**UP*00
    7987940430*VN*23366~PID*F****MUFFIN SF CHOCOLATE MINI~PO4*8*10*OZ~IT1**1*CA*20.9
    6**UP*007987940066*VN*23386~PID*F****LOAF SF SLICED POUND~PO4*8*14*OZ~SAC*A*F800
    ***56*******02***PROMOTION ALLOWANCE~IT1**1*CA*22.27**UP*002056910140*VN*27832~P
    ID*F****DONUT O F BUTTERMILK CAKE~PO4*96*3*OZ~IT1**1*CA*60.1**UP*077388911720*V
    N*28396~PID*F****DANISH PKT ALMOND BEARCLAW~PO4*144*3*OZ~IT1**1*CA*35.5**UP*0773
    88911729*VN*28398~PID*F****DANISH PLAIN RND TWIST~PO4*120*2.5*OZ~IT1**1*CA*20.48
    **UP*002056912011*VN*29120~PID*F****DONUT GOLDEN LONG JOHN~PO4*84*3*OZ~IT1**1*CA
    *22.27**UP*002056910101*VN*29121~PID*F****DONUT VANILLA CAKE~PO4*96*3*OZ~IT1**1*
    CA*39.78**UP*087062500522*VN*29161~PID*F****EGG CHALLAH K~PO4*20*19.75*OZ~IT
    1**1*CA*22.66**UP*002056980050*VN*29288~PID*F****DONUT RASPFILLED SHELL~PO4*84*4
    OZ~IT1*1*CA*22.66**UP*002056980060*VN*29290~PID*F****DONUT CUSTFILLED SHELL~PO
    4*84*4*OZ~IT1**1*CA*24.73**UP*002056912240*VN*29350~PID*F****DONUT GOLDN APPLE F
    RITTER~PO4*72*3*OZ~IT1**1*CA*20.02**UP*002056912030*VN*29359~TDS*61293~CAD*SR***
    ROUTE666~CTT20~SE*71*0118~GE*118*11924~IEA*1*000011924~
    Please help me on this.
    I am using B2B 10.1.2.
    Regards
    Ayush

    This is valid rule as the partner might has AS400 system for processing documents. In this case both inbound/outbound docs to/from that partner need to have this 80 char BLOCK rule applied.
    What method is partner using for file exchange. In case VAN, you might need to ask partner to check their VAN and have this 80 char BLOCK rule applied at mailbox level. This way VAN provider will automatically handle this for both inbound and outbound.
    Thanks,
    Vijay.

  • How do I create video files in M4V format just like iTunes video clips?

    Hello everyone,
    I have bought many video clips from iTunes which I like to play when I have invited guests.
    Now, as you know, some video clips are not available on iTunes. I do have some music DVDs though and would like to add some video clips from the DVDs to my iTunes library. I converted them to the M4V format. However, the format still seems to be different from the format that iTunes uses for its music video clips. Because when I add a video bought from the iTunes store AND one of my own videos in a playlist, iTunes tells me that it is not usual to mix videos and music in the same playlist.
    Does anyone have a suggestion how I can create the same format for the videos I get from my DVDs, so that I can mix them in the same playlist together?
    Thanks for your help!

    Umm... has anyone pondered a situation for a days if not weeks on end before mustering up the courage to ask for help and then found the solution minutes after asking? Yeah, this is one of those occasions. Weird.
    In my defense, the user interface seems a bit obtuse. When you click "Playlists" and then "Create Playlist" at the bottom of the screen you then must click "Dates, "Folders", or "All Videos" to search for videos. The "obtusity" is that it didn't seem intuitive to me that I then had to search in those other headings after I selected to create a playlist. I assumed that the "Create a Playlist" window that then popped up would include all videos in the watched folders. When you see a video you will find that there is a green circle with a plus sign on the upper right corner. Clicking that will add it to the playlist that you are creating. When you're satisfied with the playlist, give it a name and then save it.
    *sigh* 
    Message Edited by BetaPsi on 06-10-2009 01:35 PM

  • How to convert document file in PDf format through workflow using sharepoint designer

     Please suggest me solution it's urgent.....please.

    Hi Anil,
    If Word Automation Services is installed in your environment then that may be an option (Providing you are only interested in converting MS-Word documents). However SharePoint does not ship with an out-of-the-box workflow activity that makes use of this.
    You may want to consider some third party software that supports formats other than MS-Word as well and comes with workflow actions for SharePoint Designer (and Nintex Workflow) out of the box. Have a look at the
    Muhimbi PDF Converter for SharePoint.
    Disclaimer, I worked on this product so I am obviously biased. (It works great though :-)

  • Convert the flat file to xml format.

    hi,
    I need to write a interface program in the R/3  to pull the flat file data from the unix application server and do some manipulation and place back into the unix application server in XML format, From the unix box XML file taken by the XI server.
    pls give me some idea to convert the flat file to XML format, through any function module or any other logic is there...
    with regards,
    Thambee.

    Hi Thambe
    in addition to the above posts
    Program to convert flat file to XML file.
    please download tool from this link:
    http://www.download.com/Stylus-Studio-2008-XML-Enterprise-Suite/3000-7241_4-10399885.html?part=dl-StylusStu&subj=dl&tag=button&cdlpid=10399885
    how to use:
    http://www.stylusstudio.com/learn_convert_to_xml.html
    http://www.sap-img.com/abap/sample-xml-source-code-for-sap.htm
    Flat file to XML
    CONVERTION OF FLAT FILE TO XML : NO OUT PUT FOUND
    Converting Idoc flat file representation to XML
    how to convert flat file into IDOC-XML
    Thanks
    sandeep sharma
    PS ; if helpful kindly reward points

  • ORA-01017 error and re-create password file? seek advices.

    I used TOAD 9.5 to log in one Oracle 10g database with sys/password as sysdba. It worked fine always. However, today I tried to log in again and come across the ORA-01017 error. Invalid username/password. Then I went to windows server command line to log in as conn / as sysdba and also log in conn sys/password@sid as sysdba, I all logged in successfully. I checked the password file is in $oracle_home\database\. I logged in as normal user successfully.
    My question is: what caused this ORA-error? how to fix it? Is it necessary for me to re-create password file to fix this? Or there is other options? Thanks.

    First though is double check make sure you have no typo when inputting username/password,
    ORA-01017 is very specific error about wrong password, if you have problem with passwordfile you would likely to get ORA-01031: insufficient privileges
    You can change your sys password using alter user statement, Oracle will sync the password file.

  • Create XML File in  HIPAA 834 file structure

    Hi ,
       We have to create XML file in HIPAA 834 file format , Do we have any build in component/Adapter for this . It something like calling that build in omponent and map the XML elements to the source field and ODI should be able to create the XML file in HIPPA 834 structure format .
    As of now we are using complex file to create aXML file in this format . We are looking for some option that could reduce this manual work

    If I understand correctly, Basically you need to create the xsd for HIPAA 834 document
    This can be done by software in SOA called Document Editor- Oracle B2B
    This is around 10GB installable. in this you can create the xsd by creating the ecs file and then exporting to xsd

  • Need to create multiple files in CSV through UTL_File package

    I have to extract data from table from csv format and maximum number should be 10 each file.how to do this through UTL_File utilities.
    i am putting the code...any input would be apprecaited...
    CREATE OR REPLACE PACKAGE BODY TEST
    AS
    PROCEDURE main_test(
    errbuff OUT VARCHAR2,
    retcode OUT VARCHAR2
    IS
    -- Variables
    lv_file_handle UTL_FILE.FILE_TYPE;
    lv_file_name_txt VARCHAR2(25);
    lv_file_location_txt VARCHAR2(100) :='/dv1/gfp/ora01/dv1gfpcomn/temp';
    v_error_code NUMBER;
    v_error_text VARCHAR2(200);
    lv_cursor_rowcnt NUMBER := 0;
    lv_row_data VARCHAR2(32000);
    lv_row_tran_data VARCHAR2(32000);
    lv_transaction_number VARCHAR2(1000);
    lv_row_head_data1 VARCHAR2(32000);
    lv_row_trn_data1 VARCHAR2(32000);
    lv_row_data1 VARCHAR2(32000);
    lv_period VARCHAR2(100);
    row_cnt number := 0;
    c integer;
    max_rows number;
    -- Cursors
    CURSOR cur_period IS
    select
    user_name name,
    description description ,
    email_address email,
    start_date st_date,
    end_date end_date
    from fnd_user
    WHERE ROWNUM <51
    ORDER BY 1,4 desc;
    BEGIN
    lv_file_name_txt := 'test'||TO_CHAR (SYSDATE, 'DDMMYYYY')||'.txn';
    lv_file_handle := UTL_FILE.FOPEN(lv_file_location_txt, lv_file_name_txt, 'w');
    --code modification here
    FOR cur_rec IN cur_period
    LOOP
    lv_row_data := NULL;
    lv_cursor_rowcnt := lv_cursor_rowcnt + 1;
    lv_row_data := rpad(nvl(substr(cur_rec.name,1,10),'') ,10,' ') || '+'
    || rpad(nvl(substr(cur_rec.description,1,10),'') ,10,' ') || '+'
    || rpad(nvl(substr(cur_rec.email,1,15),'') ,15,' ') || '+'
    || rpad(nvl(substr( cur_rec.st_date,1,10),'') ,10,' ') || '+'
    || rpad(nvl(substr( cur_rec.end_date ,1,10),'') ,10,' ') ;
    END LOOP;
    IF lv_cursor_rowcnt = 0 THEN
    fnd_log.put_line ('No data found');
    END IF;
    UTL_FILE.FCLOSE(lv_file_handle);
    EXCEPTION
    WHEN OTHERS
    THEN
    v_error_code := SQLCODE;
    v_error_text := SQLERRM;
    retcode := 2;
    fnd_log.put_line ('s-Error :' || v_error_code || '- ' || v_error_text );
    fnd_log.put_line (SQLERRM);
    UTL_FILE.FCLOSE_ALL();
    END;
    END TEST;
    show err
    ---

    Hi,
    and maximum number should be 10 each file.utilities. I could not understand the above line. If you want to put 10 rows in one file , next 10 rows in another file and so on ......
    There are two approaches.
    1. Simple one is store all records in one file using UTL_FILE and then use unix
    split utility to break 10 lines for each file.
    2. Store all files name is an array ( VARRAY or Associative Arrays) .
    (i) Fetch file name form Array
    (ii) Open a File
    (iii) Store 10 rows in File
    (iv) Close file. Go to step 1.
    Regards

  • Fixed format data file output

    Does anyone know how to generate fixed format text file? I have few fields in the select which are null and hence messes up the file format, as space does not take up same amount of character width than any alphabets.
    Basically I want to generate fixed length data file which is scheduled through DBMS_JOBS. I am using UTL_FILE utility.
    Every suggestion are welcome
    Thanks in advance for help :)
    email your response at [email protected]

    hello,
    using spaces as filler is sufficient. a space takes up the same room (one character) as any other letter in the alphabet.
    if you look at the output in any word-processing tool or editor, that uses fonts like times, helvetica, arial, etc. those fonts are rendering the space-character smaller. in fact they are rendering each letter different. if you want to see what your output looks like, choose a font like courier.
    if you just generate the file and then process it further, you should be OK. don't let you be fooled by what you see in your editor.
    regards,
    philipp

  • External table: How to load data from a fixed format UTF8 external file

    Hi Experts,
    I am trying to read data from a fixed format UTF8 external file in to a external table. The file has non-ascii characters, and the presence of the non-ascii characters causes the data to be positioned incorrectly in the external table.
    The following is the content's of the file:
    20100423094529000000I1 ABÄCDE 1 000004
    20100423094529000000I2 OMS Crew 2 2 000004
    20100423094529000000I3 OMS Crew 3 3 000004
    20100423094529000000I4 OMS Crew 4 4 000004
    20100423094529000000I5 OMS Crew 5 5 000004
    20100423094529000000I6 OMS Crew 6 6 000004
    20100423094529000000I7 Mobile Crew 7 7 000004
    20100423094529000000I8 Mobile Crew 8 8 000004
    The structure of the data is as follows:
    Name Type Start End Length
    UPDATE_DTTM CHAR 1 20 20
    CHANGE_TYPE_CD CHAR 21 21 1
    CREW_CD CHAR 22 37 16
    CREW_DESCR CHAR 38 97 60
    CREW_ID CHAR 98 113 16
    UDF1_CD CHAR 114 143 30
    UDF1_DESCR CHAR 144 203 60
    UDF2_CD CHAR 204 233 30
    DATA_SOURCE_IND CHAR 294 299 6
    UDF2_DESCR CHAR 234 293 60
    I create the external table as follows:
    CREATE TABLE "D_CREW_EXT"
    "UPDATE_DTTM" CHAR(20 BYTE),
    "CHANGE_TYPE_CD" CHAR(1 BYTE),
    "CREW_CD" CHAR(16 BYTE),
    "CREW_DESCR" CHAR(60 BYTE),
    "CREW_ID" CHAR(16 BYTE),
    "UDF1_CD" CHAR(30 BYTE),
    "UDF1_DESCR" CHAR(60 BYTE),
    "UDF2_CD" CHAR(30 BYTE),
    "DATA_SOURCE_IND" CHAR(6 BYTE),
    "UDF2_DESCR" CHAR(60 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "TMP"
    ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE
    CHARACTERSET UTF8
    STRING SIZES ARE IN BYTES
    NOBADFILE NODISCARDFILE NOLOGFILE FIELDS NOTRIM
    ( "UPDATE_DTTM" POSITION (1:20) CHAR(20),
    "CHANGE_TYPE_CD" POSITION (21:21) CHAR(1),
    "CREW_CD" POSITION (22:37) CHAR(16),
    "CREW_DESCR" POSITION (38:97) CHAR(60),
    "CREW_ID" POSITION (98:113) CHAR(16),
    "UDF1_CD" POSITION (114:143) CHAR(30),
    "UDF1_DESCR" POSITION (144:203) CHAR(60),
    "UDF2_CD" POSITION (204:233) CHAR(30),
    "DATA_SOURCE_IND" POSITION (294:299) CHAR(6),
    "UDF2_DESCR" POSITION (234:293) CHAR(60) )
    ) LOCATION ( 'D_CREW_EXT.DAT' )
    REJECT LIMIT UNLIMITED;
    Check the result in database:
    select * from D_CREW_EXT;
    I found the first row is incorrect. For each non-ascii character,the fields to the right of the non-ascii character are off by 1 character,meaning that the data is moved 1 character to the right.
    Then I tried to use the option STRING SIZES ARE IN CHARACTERS instead of STRING SIZES ARE IN BYTES, it doesn't work either.
    The database version is 11.1.0.6.
    Edited by: yuan on May 21, 2010 2:43 AM

    Hi,
    I changed the BYTE in the create table part to CHAR, it still doesn't work. The result is the same. I think the problem is in ACCESS PARAMETERS.
    Any other suggestion?

Maybe you are looking for