The following lines contain the word 'select', 'insert', 'update' or 'delete':
| Name: update_numbers |
| Purpose: It looks in ra_interface_lines table for the lines inserted for |
| this run of Receivables Interface and updates them with an |
| Invoice Number based on the delivery name |
+===========================================================================*/
FUNCTION update_invoice_numbers(x_del_id NUMBER, x_del_name VARCHAR2,
err_msg IN OUT VARCHAR2) Return NUMBER IS
inv_num_index Number;
Select nvl((max(index_number)+1), 0)
Into inv_num_index
From wsh_invoice_numbers
Where delivery_id = x_del_id;
Insert Into Wsh_Invoice_Numbers
(INVOICE_NUMBER_ID, DELIVERY_ID, INDEX_NUMBER, LAST_UPDATE_DATE,
LAST_UPDATED_BY, CREATION_DATE, CREATED_BY)
VALUES
(wsh_invoice_numbers_s.nextval, x_del_id, inv_num_index, SYSDATE,
fnd_global.user_id, SYSDATE, fnd_global.user_id);
err_msg := 'Error in wsh_invoice_utilities.update_invoice_numbers:\n '||
SQLERRM;
PROCEDURE update_numbers(x_org_id NUMBER ,
x_request_id NUMBER,
err_msg IN OUT VARCHAR2 ) IS
group_col_clause varchar2(10000) := '';
select_col varchar2(10000) := '';
Select upper(c.from_column_name), c.from_column_length
From ra_group_by_columns c
Where c.column_type = 'M';
Select delivery_id
From wsh_deliveries
Where name = x_del_name;
select_col := col_name;
select_col := select_col || '||' || '''~'''|| '||'|| col_name;
grp_stmt := 'Select ' || select_col || ' group_cols,' ||
' l.interface_line_attribute3, ROWID ' ||
' From RA_INTERFACE_LINES_ALL L' ||
' Where trx_number is NULL' ||
' And request_id = ' || to_char(x_request_id)||
' Order by ' || group_col_clause ||
' , l.interface_line_attribute3, l.org_id' ;
if ( update_invoice_numbers ( this_del_id, this_del_name,
err_msg ) < 0 ) Then
return;
if ( update_invoice_numbers ( this_del_id, this_del_name,
err_msg ) < 0 ) Then
return;
Update RA_INTERFACE_LINES_ALL
set trx_number = inv_num
where rowid = chartorowid(this_rowid);
err_msg := 'Error in wsh_invoice_utilities.update_numbers:\n '|| SQLERRM;