Thursday, September 27, 2018

PL/SQL Oracle Report

How to Create the PL/SQL Oracle Report :-

Report Name               :- Wipro Supplier Data Report.
Shore Name                 :- XXPCL_VENDOR_DETAILS_PROC
Procedure Name           :-  XXPCL_VENDOR_DETAILS_PROC

Benefit of PL/SQL REPORT:-
 No required Report builder tool
 No required RDF.
 No Required WINSCP Tool.

Follow Step By Step :- 
Firstly open the Oracle Toad Tool then write the Procedure given below :-

-----------------------code start --------------------------------------

CREATE OR REPLACE PROCEDURE APPS.XXPCL_VENDOR_DETAILS_PROC1(
RETCODE OUT VARCHAR2,
ERRBUF OUT VARCHAR2,
P_ORG_ID                      IN VARCHAR2,
P_VENDOR_ID         IN VARCHAR2
)
AS
P_V_COUNT  NUMBER;

--*==================================================+
--| PACKAGE XXPCL_VENDOR_DETAILS_PROC
--+--------------------------------------------------------------------------+
--| DESCRIPTION This package is used to designed for xml for L trial
--|           
--+--------------------------------------------------------------------------+
--| HISTORY
--| Author              | Date              | DESCRIPTION
--+--------------------------------------------------------------------------+
--| Creaede by | 13-AUG-2018| 1.0
-- technical.israr@gmail.com

--+==================================================*/

CURSOR C1 IS 

SELECT DISTINCT APS.VENDOR_ID,
                  ASSA.VENDOR_SITE_ID,
                  APS.VENDOR_NAME,
                  HR.NAME ORG_NAME,
                  APS.SEGMENT1 VENDOR_NUM,
                  APS.VENDOR_TYPE_LOOKUP_CODE VENDOR_TYPE,
                  ASSA.VENDOR_SITE_CODE VENDOR_SITE,
                  ASSA.ATTRIBUTE13 GST_STATUS,
                  ASSA.ATTRIBUTE12 GST_NO,
                  PAN_NO,
                  ASSA.ADDRESS_LINE1,
                  ASSA.ADDRESS_LINE2,
                  ASSA.ADDRESS_LINE3,
                  ASSA.CITY,
                  ASSA.STATE,
                  ASSA.ZIP,
                  ASSA.EMAIL_ADDRESS,
                  ASSA.PHONE PHONE_NO,
                  IEBA.BANK_NAME,
                  IEBA.BANK_ACCOUNT_NUMBER,
                  IEBA.BRANCH_NUMBER,
                  IEBA.BANK_NUMBER,
                  IEBA.DESCRIPTION,
                  IEBA.BANK_BRANCH_NAME
    FROM APPS.AP_SUPPLIERS APS,
         APPS.AP_SUPPLIER_SITES_ALL ASSA,
         APPS.IBY_PAYEE_ASSIGNED_BANKACCT_V IPAB,
         APPS.IBY_ACCOUNT_OWNERS IAO,
         APPS.IBY_EXT_BANK_ACCOUNTS_V IEBA,
         APPS.HR_OPERATING_UNITS HR,
         APPS.JAI_AP_TDS_VENDOR_HDRS JAI
   WHERE     1 = 1
         AND APS.VENDOR_ID = ASSA.VENDOR_ID
         AND ASSA.ORG_ID = HR.ORGANIZATION_ID
         --AND HR.SET_OF_BOOKS_ID = 2121
         AND ASSA.ORG_ID = NVL (P_ORG_ID, ASSA.ORG_ID)  --organiztion paramerter
          AND APS.VENDOR_ID = NVL(P_VENDOR_ID,APS.VENDOR_ID)   --vendor paramerts
--AND APS.VENDOR_ID IN (1383,376968,358955,440027,416013,358955)
         AND JAI.VENDOR_SITE_ID(+) = ASSA.VENDOR_SITE_ID
         AND ASSA.VENDOR_SITE_ID = IPAB.SUPPLIER_SITE_ID
         AND APS.PARTY_ID = ipab.party_id
         AND IPAB.EXT_BANK_ACCOUNT_ID = IEBA.EXT_BANK_ACCOUNT_ID
         AND APS.END_DATE_ACTIVE IS NULL
         AND ASSA.INACTIVE_DATE IS NULL
         AND IEBA.EXT_BANK_ACCOUNT_ID(+) = IAO.EXT_BANK_ACCOUNT_ID
         AND IAO.ACCOUNT_OWNER_PARTY_ID(+) = APS.PARTY_ID
         AND IAO.END_DATE IS NULL
         AND IEBA.END_DATE IS NULL
         AND IPAB.END_DATE IS NULL
ORDER BY 3;


BEGIN
      fnd_file.put_line (fnd_file.output, '<?xml version="1.0"?>');
      fnd_file.put_line (fnd_file.output, '<PCL_VD_DT>');
 

      FOR I IN C1 LOOP
         fnd_file.put_line (fnd_file.output, '<VD_HEADER>');
         fnd_file.put_line (fnd_file.output,'<VENDOR_ID>' || I.VENDOR_ID || '</VENDOR_ID>' );
         fnd_file.put_line (fnd_file.output,'<VENDOR_SITE_ID>' || I.VENDOR_SITE_ID || '</VENDOR_SITE_ID>' );
       
         fnd_file.put_line (fnd_file.output,'<VENDOR_NAME>' || trim(REPLACE (I.VENDOR_NAME, '&', '&' || 'amp;')) || '</VENDOR_NAME>' );
         fnd_file.put_line (fnd_file.output,'<ORG_NAME>' || trim(REPLACE (I.ORG_NAME, '&', '&' || 'amp;')) || '</ORG_NAME>' );
         fnd_file.put_line (fnd_file.output,'<VENDOR_NUM>' || I.VENDOR_NUM || '</VENDOR_NUM>' );
         fnd_file.put_line (fnd_file.output,'<VENDOR_TYPE>' ||  trim(REPLACE (I.VENDOR_TYPE, '&', '&' || 'amp;'))  || '</VENDOR_TYPE>' );
        -- fnd_file.put_line (fnd_file.output,'<VENDOR_SITE>' || I.VENDOR_SITE || '</VENDOR_SITE>' );
       
         fnd_file.put_line (fnd_file.output,'<VENDOR_SITE>' ||  trim(REPLACE (I.VENDOR_SITE, '&', '&' || 'amp;'))  || '</VENDOR_SITE>' );     
       
         fnd_file.put_line (fnd_file.output,'<PAN_NO>' || I.PAN_NO || '</PAN_NO>' );
         fnd_file.put_line (fnd_file.output,'<ADDRESS_LINE1>' ||  trim(REPLACE (I.ADDRESS_LINE1, '&', '&' || 'amp;'))  || '</ADDRESS_LINE1>' );
         fnd_file.put_line (fnd_file.output,'<ADDRESS_LINE2>' ||  trim(REPLACE (I.ADDRESS_LINE2, '&', '&' || 'amp;'))  || '</ADDRESS_LINE2>' );
         fnd_file.put_line (fnd_file.output,'<ADDRESS_LINE3>' ||  trim(REPLACE (I.ADDRESS_LINE3, '&', '&' || 'amp;'))  || '</ADDRESS_LINE3>' );
         fnd_file.put_line (fnd_file.output,'<CITY>' || I.CITY || '</CITY>' );
         fnd_file.put_line (fnd_file.output,'<STATE>' ||  trim(REPLACE (I.STATE, '&', '&' || 'amp;'))  || '</STATE>' );
                   
         fnd_file.put_line (fnd_file.output,'<EMAIL_ADDRESS>' ||  trim(REPLACE (I.EMAIL_ADDRESS, '&', '&' || 'amp;'))  || '</EMAIL_ADDRESS>' );
         fnd_file.put_line (fnd_file.output,'<PHONE_NO>' || I.PHONE_NO || '</PHONE_NO>' );
         fnd_file.put_line (fnd_file.output,'<BANK_NAME>' ||  trim(REPLACE (I.BANK_NAME, '&', '&' || 'amp;'))  || '</BANK_NAME>' );
         fnd_file.put_line (fnd_file.output,'<BANK_ACCOUNT_NUMBER>' ||  trim(REPLACE (I.BANK_ACCOUNT_NUMBER, '&', '&' || 'amp;'))  || '</BANK_ACCOUNT_NUMBER>' );
         fnd_file.put_line (fnd_file.output,'<BRANCH_NUMBER>' ||  trim(REPLACE (I.BRANCH_NUMBER, '&', '&' || 'amp;'))  || '</BRANCH_NUMBER>' );
         fnd_file.put_line (fnd_file.output,'<BANK_NUMBER>' ||  trim(REPLACE (I.BANK_NUMBER, '&', '&' || 'amp;'))  || '</BANK_NUMBER>' );
         fnd_file.put_line (fnd_file.output,'<DESCRIPTION>' || I.DESCRIPTION || '</DESCRIPTION>' );
         fnd_file.put_line (fnd_file.output,'<BANK_BRANCH_NAME>' ||  trim(REPLACE (I.BANK_BRANCH_NAME, '&', '&' || 'amp;'))  || '</BANK_BRANCH_NAME>' );
         fnd_file.put_line (fnd_file.output,'<PHONE_NO>' || I.PHONE_NO || '</PHONE_NO>' );
     P_V_COUNT:=1;
              fnd_file.put_line (fnd_file.output, '</VD_HEADER>');
      END LOOP;
      fnd_file.put_line (fnd_file.output, '</PCL_VD_DT>');
      EXCEPTION WHEN OTHERS THEN fnd_file.put_line (fnd_file.LOG, 'Entered INTO exception' || SQLCODE || SQLERRM  );

END;
/

--------------------------Code End----------------------------------------


*Create the excusable 


Register the concurrent program

Create the parameters in which defined in procedure (XXPCL_VENDOR_DETAILS_PROC1)

Parameter 1

Parameter 2

now assign the Wipro Vendor report concurrent program  in any request group
then submit request 



Both are parameters is not mandatory field, you can insert the value or not 
because in procedure handle the NVL Fuction in Parameter 




After completed the Wipro supplier data report , click the view output
Note :-  Output will be in XML Format 


No comments:

Post a Comment