Wednesday, October 26, 2011

Contract line -> Inventory Item

Useful query which will fetch your inventory items from contract lines.

Service Products:
SELECT kl.line_number,
       ks.name,
       itm.segment1,
       itm.segment2
FROM okc_k_headers_v kh,
     okc_k_lines_v kl,
     okc_k_items ki,
     okc_line_styles_v ks,
     mtl_system_items_b itm
WHERE kh.contract_number = 'contract number'
AND   kh.contract_number_modifier IS NULL
AND   kh.id = kl.dnz_chr_id
AND   kh.id = ki.dnz_chr_id
AND   kl.id = ki.cle_id
AND   kl.lse_id = ks.id
AND   ki.jtot_object1_code IN ('OKX_SERVICE')
AND   kh.inv_organization_id = itm.organization_id
AND   ki.object1_id2 = itm.organization_id
AND   ki.object1_id1 = itm.inventory_item_id
ORDER BY kl.line_number;
Covered Products:
SELECT kl.line_number,
       ks.NAME,
       i.segment1,
       i.segment2
FROM okc_k_headers_b kh,
     okc_k_lines_b kl,
     okc_k_items ki,
     okc_line_styles_v ks,
     csi_item_instances c,
     mtl_system_items_b i
WHERE kh.contract_number = 'contract number'
AND   kh.contract_number_modifier IS NULL
AND   kh.id = kl.dnz_chr_id
AND   kh.id = ki.dnz_chr_id
AND   kl.id = ki.cle_id
AND   kl.lse_id = ks.id
AND   ki.jtot_object1_code IN ('OKX_CUSTPROD')
AND   c.last_vld_organization_id = i.organization_id
AND   ki.object1_id1 = c.instance_id
AND   c.inventory_item_id = i.inventory_item_id
ORDER BY kl.line_number;
References
  • Note 467334.1: 11i: How to Query the Service Contracts Tables for Header, Line, Subline and Billing Information in 11.5.10+ 
  • OTN Forum

No comments:

Post a Comment

javascript:void(0)