89:
90: UPDATE GL_INTERFACE gl
91: SET gl.ussgl_transaction_code =
92: ( SELECT ussgl_transaction_code
93: FROM ar_cash_receipts cr
94: WHERE cr.cash_receipt_id = TO_NUMBER(SUBSTR(gl.reference22, 1, INSTR(gl.reference22, 'C')-1)))
95: WHERE gl.user_je_source_name = 'Receivables'
96: AND gl.set_of_books_id = l_sob_id
97: AND gl.group_id = l_group_id
98: AND gl.reference29 = 'TRADE_UNAPP'
99: AND gl.reference30 = 'AR_RECEIVABLE_APPLICATIONS'
100: AND EXISTS
101: ( SELECT 'Cash Receipt Unapplied'
102: FROM ar_cash_receipts ar
103: WHERE ar.cash_receipt_id = TO_NUMBER(SUBSTR(gl.reference22, 1, INSTR(gl.reference22, 'C')-1))
104: AND status = 'UNAPP' );
105:
106: -- ========================= FND LOG ===========================
116:
117: UPDATE GL_INTERFACE gl
118: SET gl.ussgl_transaction_code =
119: ( SELECT ussgl_transaction_code
120: FROM ar_cash_receipts cr
121: WHERE cr.cash_receipt_id = TO_NUMBER(SUBSTR(gl.reference22, 1, INSTR(gl.reference22, 'C')-1)))
122: WHERE gl.user_je_source_name = 'Receivables'
123: AND gl.set_of_books_id = l_sob_id
124: AND gl.group_id = l_group_id
125: AND gl.reference29 = 'TRADE_UNAPP'
126: AND gl.reference30 = 'AR_RECEIVABLE_APPLICATIONS'
127: AND NOT EXISTS
128: ( SELECT 'Cash Receipt Unapplied'
129: FROM ar_cash_receipts ar
130: WHERE ar.cash_receipt_id = TO_NUMBER(SUBSTR(gl.reference22, 1, INSTR(gl.reference22, 'C')-1))
131: AND status = 'UNAPP' )
132: AND NOT EXISTS
133: ( SELECT 'Receipt Applied In This Posting Run'