Wanted to select data from the table types
I wanted to select all the approved BPAs and pick the BPA for a specific vendor ,vendor site and item combination and only pick the latest BPA if there are multiple Approved BPAs existing for that combination.
For this requirement what i have done is i have created the following sql query
SELECT po_header_id, line_num, type_lookup_code
INTO lv_document_source_id,
lv_document_s_line,
lv_source_type
FROM (SELECT pha.po_header_id,
pla.line_num,
pha.type_lookup_code
FROM po_headers_all pha, po_lines_all pla
WHERE pla.po_header_id = pha.po_header_id