December 21, 2010

CREATING XML REPORT USING PROCEDURES

we are not using RDF file to generate XML file. We can use the Procedure for this Purpose.
  1. First Declare the utlfile.
  2. Next give the path to save the .xml file name. This can be stored in the selected directories only. This can be found out using the query
SELECT *
  FROM all_directories
Procedure:

CODING
CREATE OR REPLACE PROCEDURE xmlproc (errbuf VARCHAR2, retcode NUMBER)
IS
   myutlfile   UTL_FILE.file_type;
BEGIN
   myutlfile := UTL_FILE.fopen ('c:\temp', 'xinv.xml', 'W');
   UTL_FILE.put_line (myutlfile, '');
   UTL_FILE.put_line (myutlfile, '');
CREATE OR REPLACE PROCEDURE xmloutproc (errbuf VARCHAR2, retcode NUMBER)
IS
BEGIN
   fnd_file.put_line (fnd_file.output, '');
   fnd_file.put_line (fnd_file.output, '');

   FOR i IN (SELECT inventory_item_id, segment1, description, creation_date
               FROM mtl_system_items_b
              WHERE creation_date > TO_DATE ('01-JAN-2008')
                AND organization_id = 204)
   LOOP
      fnd_file.put_line (fnd_file.output, '');
      fnd_file.put_line (fnd_file.output,
                            ''
                         || i.inventory_item_id
                         || ''
                        );
      fnd_file.put_line (fnd_file.output,
                         '' || i.segment1 || ''
                        );
      fnd_file.put_line (fnd_file.output,
                         '' || i.description || ''
                        );
      fnd_file.put_line (fnd_file.output,
                            ''
                         || i.creation_date
                         || ''
                        );
      fnd_file.put_line (fnd_file.output, '');
   END LOOP;

   fnd_file.put_line (fnd_file.output, '');
END;

Compile the Procedure
BEGIN
   xmloutproc ('a', 1);
END;

Now create a executable ans program as the same u do for all other reports.

No comments:

Post a Comment

Thanks for your comments submitted.,will review and Post soon! by admin.

COALESCE-SQL

Coalesce- return the null values from the expression. It works similar to a case statement where if expression 1 is false then goes to expr...