doo_fulfill_lines_all SELECT RCTA.CUSTOMER_TRX_ID, MAX(CASE WHEN RCTLA.INTERFACE_LINE_ATTRIBUTE5 = RCTLA.INTERFACE_LINE_ATTRIBUTE6 THEN RCTLA.CUSTOMER_TRX_LINE_ID ELSE 0 END) AS CUSTOMER_TRX_LINE_ID, HCSA.ATTRIBUTE_CATEGORY, 'R001' AS RECORDTYPE, NVL(SUBSTR (FLV_TRX.LOOKUP_CODE,1,4),'TD02') AS DOCUMENTMESSAGETYPE, CONCAT (SUBSTR(RCTTA.NAME,7,2), RCTA.TRX_NUMBER)AS DOCUMENTNUMBER, TO_CHAR(RCTA.TRX_DATE,'yyyyMMdd') DOCUMENTDATE, NULL AS DOCUMENTTIME, --DLA.LINE_NUMBER, MAX(CASE WHEN RCTLA.INTERFACE_LINE_ATTRIBUTE5 = RCTLA.INTERFACE_LINE_ATTRIBUTE6 THEN RCTLA.LINE_NUMBER ELSE 0 END) AS LINE_NUMBER, MAX(CASE WHEN ABS(RCTLA.UNIT_SELLING_PRICE) > 0 AND RCTLA.INTERFACE_LINE_ATTRIBUTE5 <> RCTLA.INTERFACE_LINE_ATTRIBUTE6 THEN NULL ELSE 'AB' END) AS LINEFUNCTIONID, doo_fulfill_lines_all How to use it? doo_fulfill_lines_all --WHY ARE WE NOT USING RCTLA.DESCRIPTION?? SEEMS BETTER AND SURELY QUITE A LOT FASTER!!!!! MAX(CASE WHEN RCTLA.INTERFACE_LINE_ATTRIBUTE5 = RCTLA.INTERFACE_LINE_ATTRIBUTE6 THEN DECODE(EGP1.CROSS_REFERENCE, NULL, ITEM_TL1.DESCRIPTION, DECODE(NVL(EIEB1.ATTRIBUTE_CHAR2, '000'), '000', ITEM_TL1.DESCRIPTION, NVL(EGP2.CROSS_REFERENCE, ITEM_TL1.DESCRIPTION))) ELSE NULL END) AS DESCRIPTION, --DECODE((SELECT EGP.CROSS_REFERENCE), NULL,(SELECT ITEM_TL.DESCRIPTION), DECODE(NVL((SELECT ATTRIBUTE_CHAR2), '000'), '000',(SELECT ITEM_TL.DESCRIPTION), NVL((SELECT EGP.CROSS_REFERENCE),(SELECT ITEM_TL.DESCRIPTION)))) DESCRIPTION, MAX(CASE WHEN RCTLA.INTERFACE_LINE_ATTRIBUTE5 = RCTLA.INTERFACE_LINE_ATTRIBUTE6 THEN NVL(RCTLA.QUANTITY_INVOICED,RCTLA.QUANTITY_CREDITED) ELSE 0 END) AS QUANTITY_INVOICED, DECODE(UPPER(IUOM.UNIT_OF_MEASURE), 'EACH', 'EA', UPPER(IUOM.UNIT_OF_MEASURE)) AS UOM_CODE, NULL AS START_DATE, NULL AS END_DATE, ABS(SUM(RCTLA.UNIT_SELLING_PRICE)) AS UNIT_SELLING_PRICE, doo_fulfill_lines_all How to use it? doo_fulfill_lines_all ABS(SUM(RCTLA.EXTENDED_AMOUNT)) AS EXTENDED_AMOUNT, MAX(CASE WHEN RCTLA.INTERFACE_LINE_ATTRIBUTE5 = RCTLA.INTERFACE_LINE_ATTRIBUTE6 THEN CAST(FLV.TAG AS INT) ELSE 0 END) AS DEFTAXRATE, NULL AS RITENUTA, FLV.ATTRIBUTE1 AS DEFTAXTYPE, FLV.ATTRIBUTE3 AS RIFERIMENTOAMMINISTRAZIONE, MAX(CASE WHEN RCTLA.INTERFACE_LINE_ATTRIBUTE5 = RCTLA.INTERFACE_LINE_ATTRIBUTE6 THEN ELSE 0 END) AS RCTLA.TAX_CLASSIFICATION_CODE FROM RA_CUSTOMER_TRX_ALL RCTA JOIN RA_CUST_TRX_TYPES_ALL RCTTA ON RCTA.CUST_TRX_TYPE_SEQ_ID = RCTTA.CUST_TRX_TYPE_SEQ_ID JOIN HZ_CUST_ACCOUNTS HCA ON HCA.CUST_ACCOUNT_ID = RCTA.BILL_TO_CUSTOMER_ID doo_fulfill_lines_all How to get it for free? doo_fulfill_lines_all JOIN HZ_CUST_ACCT_SITES_ALL HCSA ON HCA.CUST_ACCOUNT_ID = HCSA.CUST_ACCOUNT_ID JOIN HZ_CUST_SITE_USES_ALL HCSUA ON HCSUA.CUST_ACCT_SITE_ID = HCSA.CUST_ACCT_SITE_ID AND RCTA.BILL_TO_SITE_USE_ID = HCSUA.SITE_USE_ID JOIN HZ_PARTIES HP ON HP.PARTY_ID = HCA.PARTY_ID LEFT JOIN ZX_PARTY_TAX_PROFILE ZPTP ON ZPTP.PARTY_ID = HP.PARTY_ID JOIN HR_OPERATING_UNITS HOU ON RCTA.SET_OF_BOOKS_ID = HOU.SET_OF_BOOKS_ID AND HOU.NAME = 'EMEA - Italy' JOIN RA_CUSTOMER_TRX_LINES_ALL RCTLA ON RCTA.CUSTOMER_TRX_ID = RCTLA.CUSTOMER_TRX_ID JOIN INV_UNITS_OF_MEASURE_VL IUOM ON RCTLA.UOM_CODE = IUOM.UOM_CODE JOIN DOO_FULFILL_LINES_ALL DFLA ON DFLA.FULFILL_LINE_ID = RCTLA.INTERFACE_LINE_ATTRIBUTE5 JOIN DOO_LINES_ALL DLA ON DFLA.LINE_ID = DLA.LINE_ID LEFT JOIN FND_LOOKUP_VALUES_VL FLV_TRX ON FLV_TRX.LOOKUP_TYPE = 'AMP_IT_E-INV_DOC_TYPE_MAPPING' AND FLV_TRX.DESCRIPTION = RCTTA.TYPE doo_fulfill_lines_all How to dowload it? doo_fulfill_lines_all JOIN FND_LOOKUP_VALUES_VL FLV ON FLV.LOOKUP_CODE = RCTLA.TAX_CLASSIFICATION_CODE AND FLV.LOOKUP_TYPE = 'AMP_IT_TAX_MAPPING' JOIN INV_ORG_PARAMETERS IOP1 ON IOP1.ORGANIZATION_CODE = 'IT000SHMD' JOIN INV_ORG_PARAMETERS IOP2 ON IOP2.ORGANIZATION_CODE = 'AMPL' LEFT JOIN DOO_FULFILL_LINES_EFF_B DOO1 ON DOO1.CONTEXT_CODE = 'SourceLineInfo' AND DOO1.FULFILL_LINE_ID = DFLA.FULFILL_LINE_ID LEFT JOIN EGP_ITEM_RELATIONSHIPS_B EGP1 ON EGP1.ITEM_RELATIONSHIP_TYPE = 'ITEM_XREF' AND EGP1.ORGANIZATION_ID = IOP1.ORGANIZATION_ID AND EGP1.SUB_TYPE = DOO1.ATTRIBUTE_CHAR1 AND EGP1.INVENTORY_ITEM_ID = RCTLA.INVENTORY_ITEM_ID LEFT JOIN EGP_SYSTEM_ITEMS_VL ITEM_TL1 ON ITEM_TL1.INVENTORY_ITEM_ID = RCTLA.INVENTORY_ITEM_ID AND ITEM_TL1.ORGANIZATION_ID = IOP2.ORGANIZATION_ID LEFT JOIN EGO_ITEM_EFF_B EIEB1 ON EIEB1.INVENTORY_ITEM_ID = RCTLA.INVENTORY_ITEM_ID AND EIEB1.CONTEXT_CODE = 'AMP_ALL_PRODUCT_(C01-CO3)' AND EIEB1.ORGANIZATION_ID = IOP2.ORGANIZATION_ID LEFT JOIN EGP_ITEM_RELATIONSHIPS_B EGP2 ON EGP2.ITEM_RELATIONSHIP_TYPE = 'ITEM_XREF' AND EGP2.SUB_TYPE = 'CR' AND EGP2.INVENTORY_ITEM_ID = RCTLA.INVENTORY_ITEM_ID AND EGP2.ORGANIZATION_ID = IOP1.ORGANIZATION_ID doo_fulfill_lines_all How to get it? doo_fulfill_lines_all WHERE 1 = 1 AND HCSUA.SITE_USE_CODE = 'BILL_TO' AND HCSUA.ATTRIBUTE_CATEGORY = 'E-Invoice Bill-to Code' AND RCTLA.LINE_TYPE = 'LINE' --AND RCTLA.INTERFACE_LINE_ATTRIBUTE5 = RCTLA.INTERFACE_LINE_ATTRIBUTE6 AND dfla.FULFILL_LINE_ID = rctla.INTERFACE_LINE_ATTRIBUTE5 AND RCTA.TRX_NUMBER IN ('2000009391') GROUP BY RCTA.CUSTOMER_TRX_ID, HCSA.ATTRIBUTE_CATEGORY, NVL(SUBSTR (FLV_TRX.LOOKUP_CODE,1,4),'TD02'), CONCAT(SUBSTR(RCTTA.NAME,7,2), RCTA.TRX_NUMBER), TO_CHAR(RCTA.TRX_DATE,'yyyyMMdd'), doo_fulfill_lines_all How to get it for free? doo_fulfill_lines_all DECODE(UPPER(IUOM.UNIT_OF_MEASURE), 'EACH', 'EA', UPPER(IUOM.UNIT_OF_MEASURE)), FLV.ATTRIBUTE1, FLV.ATTRIBUTE3 ORDER BY RCTLA.LINE_NUMBER doo_fulfill_lines_all