/* Formatted on 30-01-2015 20:40:51 (QP5 v5.114.809.3010) */
SELECT ood.OPERATING_UNIT,
hou.name OU_NAME,
ood.ORGANIZATION_CODE,
ood.ORGANIZATION_NAME,
msi.segment1 ITEM_NUMBER,
msi.ITEM_TYPE,
msi.INVENTORY_ITEM_STATUS_CODE,
--COST_OF_SALES_ACCOUNT,
gcc.segment1
|| '.'
|| gcc.segment2
|| '.'
|| gcc.segment3
|| '.'
|| gcc.segment4
|| '.'
|| gcc.segment5
|| '.'
|| gcc.segment6
|| '.'
|| gcc.segment7
|| '.'
|| gcc.segment8
"COST_ACCOUNT",
gcc_exp.segment1
|| '.'
|| gcc_exp.segment2
|| '.'
|| gcc_exp.segment3
|| '.'
|| gcc_exp.segment4
|| '.'
|| gcc_exp.segment5
|| '.'
|| gcc_exp.segment6
|| '.'
|| gcc_exp.segment7
|| '.'
|| gcc_exp.segment8
"EXPENSE_ACCOUNT",
gcc_s.segment1
|| '.'
|| gcc_s.segment2
|| '.'
|| gcc_s.segment3
|| '.'
|| gcc_s.segment4
|| '.'
|| gcc_s.segment5
|| '.'
|| gcc_s.segment6
|| '.'
|| gcc_s.segment7
|| '.'
|| gcc_s.segment8
"SALES_ACCOUNT"
FROM MTL_SYSTEM_ITEMS_FVL msi,
gl_code_combinations gcc,
gl_code_combinations gcc_exp,
gl_code_combinations gcc_s,
org_organization_definitions ood,
hr_operating_units hou
WHERE msi.ORGANIZATION_ID = ood.ORGANIZATION_ID
AND ood.OPERATING_UNIT = hou.ORGANIZATION_ID
AND msi.COST_OF_SALES_ACCOUNT = gcc.CODE_COMBINATION_ID(+)
AND msi.EXPENSE_ACCOUNT = gcc_exp.CODE_COMBINATION_ID(+)
AND msi.SALES_ACCOUNT = gcc_s.CODE_COMBINATION_ID(+)
AND msi.INVENTORY_ITEM_STATUS_CODE = 'Active'
-- and msi.segment1 ='08661137'--INVENTORY_ITEM_ID ='22143'
ORDER BY ood.OPERATING_UNIT, ood.ORGANIZATION_CODE, msi.segment1
No comments:
Post a Comment