Hello Lidia,
On table ITEM_SF, a single PAYMENT_ID_NBR value may appear on several rows for any unique combination of BUSINESS_UNIT, COMMON_ID, and SA_ID_TYPE. This is based on how a payment is split.
Table ITEM_LINE_SF is a child record of ITEM_SF. I generally think of ITEM_LINE_SF as a series of individual events that aggregate up to ITEM_SF. Those events include payment reversals but also include other adjustments.
If you want to exclude payments that no longer have a dollar amount on ITEM_SF, then add criteria: ITEM_SF.ITEM_AMT <> 0
If you want to exclude payments that were reversed, then join PAYMENT_TBL (on BUSINESS_UNIT, COMMON_ID, SA_ID_TYPE, and PAYMENT_ID_NBR) and add criteria: SF_REVERSAL_IND <> 'Y'. Note: You could also use a DOES NOT EXIST.
Primary keys for
- ITEM_SF: BUSINESS_UNIT, COMMON_ID, SA_ID_TYPE, ITEM_NBR
- ITEM_LINE_SF: BUSINESS_UNIT, COMMON_ID, SA_ID_TYPE, ITEM_NBR, LINE_SEQ_NBR
- PAYMENT_TBL: BUSINESS_UNIT, COMMON_ID, SA_ID_TYPE, PAYMENT_ID_NBR
------------------------------
Jared Jakeman
App Development and Integrations
Central Washington University
------------------------------