Wednesday, 28 October 2015

xml bursting using pl/sql stored procedure

create or replace procedure data_xml(errbuf out varchar2,retcode out number)
as
result boolean;
  --
  --Cursor to fetch the data
  --
  CURSOR data_cur
  IS
    --
    select * from emp;
  --
 -- output_row data_cur%rowtype;
BEGIN
  --
  --
  dbms_output.put_line('<?xml version="1.0" encoding="US-ASCII" standalone="no"?>');
  fnd_file.put_line(fnd_file.output,'<?xml version="1.0" encoding="US-ASCII" standalone="no"?>');
  dbms_output.put_line('<OUTPUT>');
  fnd_file.put_line(fnd_file.output,'<OUTPUT>');
  --
 for i in data_cur
 loop
    --
    if   i.Minutes > i.max_running_time then
    --
    dbms_output.put_line('<ROW>');
    fnd_file.put_line(fnd_file.output,'<ROW>');
    --
    dbms_output.put_line('<ename>'||dbms_xmlgen.CONVERT(i.job)||'</ename>');
    fnd_file.put_line(fnd_file.output,'<ename>'||dbms_xmlgen.CONVERT(i.job)||'</ename>');
    --
    dbms_output.put_line('<empno>'||dbms_xmlgen.CONVERT(i.Parent_Req_ID )||'</empno>');
    fnd_file.put_line(fnd_file.output,'<empno>'||dbms_xmlgen.CONVERT(i.job)||'</empno>');
    --
    dbms_output.put_line('<job>'||dbms_xmlgen.CONVERT(i.Req_ID )||'</job>');
    fnd_file.put_line(fnd_file.output,'<job>'||dbms_xmlgen.CONVERT(i.job)||'</job>');
    --
        --
        --
    dbms_output.put_line('</ROW>');
    fnd_file.put_line(fnd_file.output,'</ROW>');
    --
    end if;
  END LOOP;
  
  --
  dbms_output.put_line('</OUTPUT>');
  fnd_file.put_line(fnd_file.output,'</OUTPUT>');
  --
  result:=BURSTING_CP_SUB_PKG.AfterReport();
  
  exception
  when others then
  dbms_output.put_line('error program');
  fnd_file.put_line(fnd_file.output,'error program');
END;

Tuesday, 20 October 2015

Link Between PO and WIP Tables in oracle apps

SELECT DISTINCT pv.vendor_name
    FROM po.po_requisition_headers_all prha
       , po.po_requisition_lines_all prla
       , po_req_distributions_all prd
       , applsys.fnd_user fu
       , wip.wip_entities we
       , po_headers_all poh
       , po_lines_all pol
       , po_line_locations_all pll
       , po_distributions_all pod
       , po_vendors pv
   WHERE prha.requisition_header_id = prla.requisition_header_id
     AND prha.created_by = fu.user_id
     AND prla.wip_entity_id = :WIP_ENTITY_ID
     AND prha.creation_date > '25-JUL-2013'
     AND prd.requisition_line_id = prla.requisition_line_id
     AND prd.distribution_id = pod.req_distribution_id
     AND pod.po_header_id = pll.po_header_id
     AND pod.po_line_id = pll.po_line_id
     AND pod.line_location_id = pll.line_location_id
     AND pll.po_line_id = pol.po_line_id
     AND pll.po_header_id = pll.po_header_id
     AND pol.po_header_id = poh.po_header_id
     AND poh.vendor_id = pv.vendor_id;


SELECT DISTINCT poh.segment1 into V_PO
    FROM po.po_requisition_headers_all prha
       , po.po_requisition_lines_all prla
       , po_req_distributions_all prd
       , applsys.fnd_user fu
       , wip.wip_entities we
       , po_headers_all poh
       , po_lines_all pol
       , po_line_locations_all pll
       , po_distributions_all pod
       , po_vendors pv
   WHERE prha.requisition_header_id = prla.requisition_header_id
     AND prha.created_by = fu.user_id
     AND prla.wip_entity_id = :WIP_ENTITY_ID
    -- AND prha.creation_date > '25-JUL-2013'
     AND prd.requisition_line_id = prla.requisition_line_id
     AND prd.distribution_id = pod.req_distribution_id
     AND pod.po_header_id = pll.po_header_id
     AND pod.po_line_id = pll.po_line_id
     AND pod.line_location_id = pll.line_location_id
     AND pll.po_line_id = pol.po_line_id
     AND pll.po_header_id = pll.po_header_id
     AND pol.po_header_id = poh.po_header_id
     AND poh.vendor_id = pv.vendor_id;