28: cValue_stmt varchar2(32000) := 'VALUES (';
29: dummy pls_integer;
30: error_position pls_integer;
31: begin
32: if ec_debug.G_debug_level >= 2 then
33: ec_debug.push('EC_OUTBOUND.PARSE_INSERT_STATEMENT');
34: ec_debug.pl(3,'i_level',i_level);
35: end if;
36:
29: dummy pls_integer;
30: error_position pls_integer;
31: begin
32: if ec_debug.G_debug_level >= 2 then
33: ec_debug.push('EC_OUTBOUND.PARSE_INSERT_STATEMENT');
34: ec_debug.pl(3,'i_level',i_level);
35: end if;
36:
37: --- Add Mandatory Columns for the Record
30: error_position pls_integer;
31: begin
32: if ec_debug.G_debug_level >= 2 then
33: ec_debug.push('EC_OUTBOUND.PARSE_INSERT_STATEMENT');
34: ec_debug.pl(3,'i_level',i_level);
35: end if;
36:
37: --- Add Mandatory Columns for the Record
38: cInsert_stmt := cInsert_stmt||' Stage_id, Document_Id , Transaction_type , Transaction_Level ,';
58: cInsert_stmt := RTRIM(cInsert_stmt,',')||')';
59: cValue_stmt := RTRIM(cValue_stmt,',')||')';
60: cInsert_stmt := cInsert_stmt||cValue_stmt;
61:
62: if ec_Debug.G_debug_level = 3 then
63: ec_debug.pl(3,'EC','ECE_STAGE_INSERT_LEVEL','LEVEL',i_level,null);
64: ec_debug.pl(3,cInsert_stmt);
65: end if;
66:
59: cValue_stmt := RTRIM(cValue_stmt,',')||')';
60: cInsert_stmt := cInsert_stmt||cValue_stmt;
61:
62: if ec_Debug.G_debug_level = 3 then
63: ec_debug.pl(3,'EC','ECE_STAGE_INSERT_LEVEL','LEVEL',i_level,null);
64: ec_debug.pl(3,cInsert_stmt);
65: end if;
66:
67: /**
60: cInsert_stmt := cInsert_stmt||cValue_stmt;
61:
62: if ec_Debug.G_debug_level = 3 then
63: ec_debug.pl(3,'EC','ECE_STAGE_INSERT_LEVEL','LEVEL',i_level,null);
64: ec_debug.pl(3,cInsert_stmt);
65: end if;
66:
67: /**
68: Open the cursor and parse the SQL Statement. Trap any parsing error and report
69: the Error Position in the SQL Statement
70: **/
71: i_Insert_Cursor := dbms_sql.Open_Cursor;
72:
73: if ec_debug.G_debug_level = 3 then
74: ec_debug.pl(3,'i_insert_cursor',i_insert_cursor);
75: end if;
76:
77: ec_utils.g_ext_levels(i_level).cursor_handle := i_insert_cursor;
70: **/
71: i_Insert_Cursor := dbms_sql.Open_Cursor;
72:
73: if ec_debug.G_debug_level = 3 then
74: ec_debug.pl(3,'i_insert_cursor',i_insert_cursor);
75: end if;
76:
77: ec_utils.g_ext_levels(i_level).cursor_handle := i_insert_cursor;
78:
80: dbms_sql.parse(i_Insert_Cursor,cInsert_stmt,dbms_sql.native);
81: exception
82: when others then
83: error_position := dbms_sql.last_error_position;
84: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.PARSE_INSERT_STATEMENT');
85: ece_error_handling_pvt.print_parse_error (error_position,cInsert_stmt);
86: ec_utils.i_ret_code :=2;
87: raise EC_UTILS.PROGRAM_EXIT;
88: end;
85: ece_error_handling_pvt.print_parse_error (error_position,cInsert_stmt);
86: ec_utils.i_ret_code :=2;
87: raise EC_UTILS.PROGRAM_EXIT;
88: end;
89: if ec_debug.G_debug_level >= 2 then
90: ec_debug.pop('EC_OUTBOUND.PARSE_INSERT_STATEMENT');
91: end if;
92:
93: EXCEPTION
86: ec_utils.i_ret_code :=2;
87: raise EC_UTILS.PROGRAM_EXIT;
88: end;
89: if ec_debug.G_debug_level >= 2 then
90: ec_debug.pop('EC_OUTBOUND.PARSE_INSERT_STATEMENT');
91: end if;
92:
93: EXCEPTION
94: WHEN EC_UTILS.PROGRAM_EXIT then
93: EXCEPTION
94: WHEN EC_UTILS.PROGRAM_EXIT then
95: raise;
96: WHEN OTHERS THEN
97: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.PARSE_INSERT_STATEMENT');
98: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
99: ec_utils.i_ret_code :=2;
100: raise EC_UTILS.PROGRAM_EXIT;
101: END parse_insert_statement;
94: WHEN EC_UTILS.PROGRAM_EXIT then
95: raise;
96: WHEN OTHERS THEN
97: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.PARSE_INSERT_STATEMENT');
98: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
99: ec_utils.i_ret_code :=2;
100: raise EC_UTILS.PROGRAM_EXIT;
101: END parse_insert_statement;
102:
119:
120: iRow_count pls_integer := ec_utils.g_file_tbl.COUNT;
121:
122: BEGIN
123: if ec_debug.G_debug_level >= 2 then
124: EC_DEBUG.PUSH('EC_OUTBOUND.SELECT_CLAUSE');
125: EC_DEBUG.PL(3, 'i_level',i_level);
126: end if;
127:
120: iRow_count pls_integer := ec_utils.g_file_tbl.COUNT;
121:
122: BEGIN
123: if ec_debug.G_debug_level >= 2 then
124: EC_DEBUG.PUSH('EC_OUTBOUND.SELECT_CLAUSE');
125: EC_DEBUG.PL(3, 'i_level',i_level);
126: end if;
127:
128: For i in ec_utils.g_int_levels(i_level).file_start_pos..ec_utils.g_int_levels(i_level).file_end_pos
121:
122: BEGIN
123: if ec_debug.G_debug_level >= 2 then
124: EC_DEBUG.PUSH('EC_OUTBOUND.SELECT_CLAUSE');
125: EC_DEBUG.PL(3, 'i_level',i_level);
126: end if;
127:
128: For i in ec_utils.g_int_levels(i_level).file_start_pos..ec_utils.g_int_levels(i_level).file_end_pos
129: loop
155:
156: cSelect_stmt := RTRIM(cSelect_stmt, ',');
157: i_Where_string := cSelect_stmt||' '||cFrom_stmt||' '||cWhere_Stmt;
158:
159: if ec_debug.G_debug_level >= 2 then
160: ec_debug.pl(3,'i_Where_String',i_Where_String);
161: EC_DEBUG.POP('EC_OUTBOUND.SELECT_CLAUSE');
162: end if;
163:
156: cSelect_stmt := RTRIM(cSelect_stmt, ',');
157: i_Where_string := cSelect_stmt||' '||cFrom_stmt||' '||cWhere_Stmt;
158:
159: if ec_debug.G_debug_level >= 2 then
160: ec_debug.pl(3,'i_Where_String',i_Where_String);
161: EC_DEBUG.POP('EC_OUTBOUND.SELECT_CLAUSE');
162: end if;
163:
164: exception
157: i_Where_string := cSelect_stmt||' '||cFrom_stmt||' '||cWhere_Stmt;
158:
159: if ec_debug.G_debug_level >= 2 then
160: ec_debug.pl(3,'i_Where_String',i_Where_String);
161: EC_DEBUG.POP('EC_OUTBOUND.SELECT_CLAUSE');
162: end if;
163:
164: exception
165: when others then
162: end if;
163:
164: exception
165: when others then
166: EC_DEBUG.PL(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.SELECT_CLAUSE');
167: EC_DEBUG.PL(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
168: ec_utils.i_ret_code :=2;
169: raise EC_UTILS.PROGRAM_EXIT;
170: END select_clause;
163:
164: exception
165: when others then
166: EC_DEBUG.PL(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.SELECT_CLAUSE');
167: EC_DEBUG.PL(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
168: ec_utils.i_ret_code :=2;
169: raise EC_UTILS.PROGRAM_EXIT;
170: END select_clause;
171:
179: procedure load_objects
180: is
181: i_counter pls_integer :=0;
182: begin
183: if ec_debug.G_debug_level >= 2 then
184: ec_debug.push('EC_OUTBOUND.LOAD_OBJECTS');
185: end if;
186:
187: for i in 1..ec_utils.g_int_levels.COUNT
180: is
181: i_counter pls_integer :=0;
182: begin
183: if ec_debug.G_debug_level >= 2 then
184: ec_debug.push('EC_OUTBOUND.LOAD_OBJECTS');
185: end if;
186:
187: for i in 1..ec_utils.g_int_levels.COUNT
188: LOOP
200:
201:
202: -- Open Cursor For Each level and store the handles in the PL/SQL table.
203: ec_utils.g_int_levels(i).Cursor_handle := dbms_sql.open_cursor;
204: if ec_debug.G_debug_level = 3 then
205: ec_debug.pl(3,'Cursor handle',ec_utils.g_int_levels(i).Cursor_handle);
206: end if;
207:
208: -- Parse the Select Statement for Each level
201:
202: -- Open Cursor For Each level and store the handles in the PL/SQL table.
203: ec_utils.g_int_levels(i).Cursor_handle := dbms_sql.open_cursor;
204: if ec_debug.G_debug_level = 3 then
205: ec_debug.pl(3,'Cursor handle',ec_utils.g_int_levels(i).Cursor_handle);
206: end if;
207:
208: -- Parse the Select Statement for Each level
209: BEGIN
218: (
219: dbms_sql.last_error_position,
220: ec_utils.g_int_levels(i).sql_stmt
221: );
222: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.LOAD_OBJECTS');
223: ec_debug.pl(0,'EC','ECE_PARSE_VIEW_ERROR','LEVEL',i);
224: raise EC_UTILS.PROGRAM_EXIT;
225: END;
226:
219: dbms_sql.last_error_position,
220: ec_utils.g_int_levels(i).sql_stmt
221: );
222: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.LOAD_OBJECTS');
223: ec_debug.pl(0,'EC','ECE_PARSE_VIEW_ERROR','LEVEL',i);
224: raise EC_UTILS.PROGRAM_EXIT;
225: END;
226:
227: i_counter :=0;
249: (
250: i
251: );
252: end loop;
253: if ec_debug.G_debug_level >= 2 then
254: ec_debug.pop('EC_OUTBOUND.LOAD_OBJECTS');
255: end if;
256:
257: EXCEPTION
250: i
251: );
252: end loop;
253: if ec_debug.G_debug_level >= 2 then
254: ec_debug.pop('EC_OUTBOUND.LOAD_OBJECTS');
255: end if;
256:
257: EXCEPTION
258: WHEN EC_UTILS.PROGRAM_EXIT then
257: EXCEPTION
258: WHEN EC_UTILS.PROGRAM_EXIT then
259: raise;
260: WHEN OTHERS THEN
261: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.LOAD_OBJECTS');
262: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
263: ec_utils.i_ret_code :=2;
264: raise EC_UTILS.PROGRAM_EXIT;
265: end load_objects;
258: WHEN EC_UTILS.PROGRAM_EXIT then
259: raise;
260: WHEN OTHERS THEN
261: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.LOAD_OBJECTS');
262: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
263: ec_utils.i_ret_code :=2;
264: raise EC_UTILS.PROGRAM_EXIT;
265: end load_objects;
266:
278: error_position pls_integer;
279: i_status ece_stage.status%TYPE := 'NEW';
280: ins_value varchar2(32000);
281: begin
282: if ec_debug.G_debug_level >= 2 then
283: ec_debug.push('EC_OUTBOUND.BIND_INSERT_STATEMENT');
284: ec_debug.pl(3,'i_level',i_level);
285: end if;
286:
279: i_status ece_stage.status%TYPE := 'NEW';
280: ins_value varchar2(32000);
281: begin
282: if ec_debug.G_debug_level >= 2 then
283: ec_debug.push('EC_OUTBOUND.BIND_INSERT_STATEMENT');
284: ec_debug.pl(3,'i_level',i_level);
285: end if;
286:
287: begin
280: ins_value varchar2(32000);
281: begin
282: if ec_debug.G_debug_level >= 2 then
283: ec_debug.push('EC_OUTBOUND.BIND_INSERT_STATEMENT');
284: ec_debug.pl(3,'i_level',i_level);
285: end if;
286:
287: begin
288: -- Bind values for Mandatory Columns
301: dbms_sql.bind_variable (i_Insert_Cursor,'w2',fnd_global.user_id);
302: dbms_sql.bind_variable (i_Insert_Cursor,'w3',sysdate);
303: dbms_sql.bind_variable (i_Insert_Cursor,'w4',fnd_global.user_id);
304:
305: if ec_debug.G_debug_level = 3 then
306: ec_debug.pl(3,'STAGE_ID',ec_utils.g_ext_levels(i_level).Stage_Id);
307: ec_debug.pl(3,'DOCUMENT_ID',ec_utils.g_ext_levels(i_level).Document_Id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
302: dbms_sql.bind_variable (i_Insert_Cursor,'w3',sysdate);
303: dbms_sql.bind_variable (i_Insert_Cursor,'w4',fnd_global.user_id);
304:
305: if ec_debug.G_debug_level = 3 then
306: ec_debug.pl(3,'STAGE_ID',ec_utils.g_ext_levels(i_level).Stage_Id);
307: ec_debug.pl(3,'DOCUMENT_ID',ec_utils.g_ext_levels(i_level).Document_Id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
303: dbms_sql.bind_variable (i_Insert_Cursor,'w4',fnd_global.user_id);
304:
305: if ec_debug.G_debug_level = 3 then
306: ec_debug.pl(3,'STAGE_ID',ec_utils.g_ext_levels(i_level).Stage_Id);
307: ec_debug.pl(3,'DOCUMENT_ID',ec_utils.g_ext_levels(i_level).Document_Id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
304:
305: if ec_debug.G_debug_level = 3 then
306: ec_debug.pl(3,'STAGE_ID',ec_utils.g_ext_levels(i_level).Stage_Id);
307: ec_debug.pl(3,'DOCUMENT_ID',ec_utils.g_ext_levels(i_level).Document_Id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
305: if ec_debug.G_debug_level = 3 then
306: ec_debug.pl(3,'STAGE_ID',ec_utils.g_ext_levels(i_level).Stage_Id);
307: ec_debug.pl(3,'DOCUMENT_ID',ec_utils.g_ext_levels(i_level).Document_Id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
306: ec_debug.pl(3,'STAGE_ID',ec_utils.g_ext_levels(i_level).Stage_Id);
307: ec_debug.pl(3,'DOCUMENT_ID',ec_utils.g_ext_levels(i_level).Document_Id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
307: ec_debug.pl(3,'DOCUMENT_ID',ec_utils.g_ext_levels(i_level).Document_Id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
315: ec_debug.pl(3,'CREATED_BY',fnd_global.user_id);
308: ec_debug.pl(3,'TRANSACTION_TYPE',ec_utils.g_transaction_type);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
315: ec_debug.pl(3,'CREATED_BY',fnd_global.user_id);
316: ec_debug.pl(3,'LAST_UPDATE_DATE',sysdate);
309: ec_debug.pl(3,'TRANSACTION_LEVEL',i_level);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
315: ec_debug.pl(3,'CREATED_BY',fnd_global.user_id);
316: ec_debug.pl(3,'LAST_UPDATE_DATE',sysdate);
317: ec_debug.pl(3,'LAST_UPDATED_BY',fnd_global.user_id);
310: ec_debug.pl(3,'LINE_NUMBER',ec_utils.g_ext_levels(i_level).Line_Number);
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
315: ec_debug.pl(3,'CREATED_BY',fnd_global.user_id);
316: ec_debug.pl(3,'LAST_UPDATE_DATE',sysdate);
317: ec_debug.pl(3,'LAST_UPDATED_BY',fnd_global.user_id);
318: end if;
311: ec_debug.pl(3,'PARENT_STAGE_ID',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
315: ec_debug.pl(3,'CREATED_BY',fnd_global.user_id);
316: ec_debug.pl(3,'LAST_UPDATE_DATE',sysdate);
317: ec_debug.pl(3,'LAST_UPDATED_BY',fnd_global.user_id);
318: end if;
319:
312: ec_debug.pl(3,'RUN_ID',ec_utils.g_run_id);
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
315: ec_debug.pl(3,'CREATED_BY',fnd_global.user_id);
316: ec_debug.pl(3,'LAST_UPDATE_DATE',sysdate);
317: ec_debug.pl(3,'LAST_UPDATED_BY',fnd_global.user_id);
318: end if;
319:
320: -- Bind values for Staging Columns mapped to the Flat File
313: ec_debug.pl(3,'DOCUMENT_NUMBER',ec_utils.g_ext_levels(i_level).Document_Number);
314: ec_debug.pl(3,'CREATION_DATE',sysdate);
315: ec_debug.pl(3,'CREATED_BY',fnd_global.user_id);
316: ec_debug.pl(3,'LAST_UPDATE_DATE',sysdate);
317: ec_debug.pl(3,'LAST_UPDATED_BY',fnd_global.user_id);
318: end if;
319:
320: -- Bind values for Staging Columns mapped to the Flat File
321: for k in ec_utils.g_int_levels(i_level).file_start_pos..ec_utils.g_int_levels(i_level).file_end_pos
327: i_Insert_Cursor,
328: 'b'||k,ins_value,
329: 500
330: );
331: if ec_debug.G_debug_level = 3 then
332: ec_debug.pl(3,upper(ec_utils.g_file_tbl(k).staging_column)||'-'||
333: upper(ec_utils.g_file_tbl(k).interface_column_name),
334: ec_utils.g_file_tbl(k).value);
335: end if;
328: 'b'||k,ins_value,
329: 500
330: );
331: if ec_debug.G_debug_level = 3 then
332: ec_debug.pl(3,upper(ec_utils.g_file_tbl(k).staging_column)||'-'||
333: upper(ec_utils.g_file_tbl(k).interface_column_name),
334: ec_utils.g_file_tbl(k).value);
335: end if;
336: end if;
337: end loop;
338:
339: dummy := dbms_sql.execute(i_Insert_Cursor);
340: if dummy = 1 then
341: if ec_debug.G_debug_level = 3 then
342: ec_debug.pl(3,'EC','ECE_STAGE_INSERTED',null);
343: end if;
344: else
345: ec_debug.pl(0,'EC','ECE_STAGE_INSERT_FAILED','LEVEL',i_level);
338:
339: dummy := dbms_sql.execute(i_Insert_Cursor);
340: if dummy = 1 then
341: if ec_debug.G_debug_level = 3 then
342: ec_debug.pl(3,'EC','ECE_STAGE_INSERTED',null);
343: end if;
344: else
345: ec_debug.pl(0,'EC','ECE_STAGE_INSERT_FAILED','LEVEL',i_level);
346: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
341: if ec_debug.G_debug_level = 3 then
342: ec_debug.pl(3,'EC','ECE_STAGE_INSERTED',null);
343: end if;
344: else
345: ec_debug.pl(0,'EC','ECE_STAGE_INSERT_FAILED','LEVEL',i_level);
346: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
347: ec_utils.i_ret_code :=2;
348: raise EC_UTILS.PROGRAM_EXIT;
349: end if;
342: ec_debug.pl(3,'EC','ECE_STAGE_INSERTED',null);
343: end if;
344: else
345: ec_debug.pl(0,'EC','ECE_STAGE_INSERT_FAILED','LEVEL',i_level);
346: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
347: ec_utils.i_ret_code :=2;
348: raise EC_UTILS.PROGRAM_EXIT;
349: end if;
350:
349: end if;
350:
351: exception
352: when others then
353: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
354: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
355: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
356:
357: ec_utils.i_ret_code :=2;
350:
351: exception
352: when others then
353: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
354: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
355: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
356:
357: ec_utils.i_ret_code :=2;
358: raise EC_UTILS.PROGRAM_EXIT;
351: exception
352: when others then
353: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
354: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
355: ec_debug.pl(0,'EC','ECE_ERROR_SQL',null);
356:
357: ec_utils.i_ret_code :=2;
358: raise EC_UTILS.PROGRAM_EXIT;
359: end;
356:
357: ec_utils.i_ret_code :=2;
358: raise EC_UTILS.PROGRAM_EXIT;
359: end;
360: if ec_debug.G_debug_level >= 2 then
361: ec_debug.pop('EC_OUTBOUND.BIND_INSERT_STATEMENT');
362: end if;
363: EXCEPTION
364: WHEN EC_UTILS.PROGRAM_EXIT then
357: ec_utils.i_ret_code :=2;
358: raise EC_UTILS.PROGRAM_EXIT;
359: end;
360: if ec_debug.G_debug_level >= 2 then
361: ec_debug.pop('EC_OUTBOUND.BIND_INSERT_STATEMENT');
362: end if;
363: EXCEPTION
364: WHEN EC_UTILS.PROGRAM_EXIT then
365: raise;
363: EXCEPTION
364: WHEN EC_UTILS.PROGRAM_EXIT then
365: raise;
366: WHEN OTHERS THEN
367: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
368: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
369: ec_utils.i_ret_code :=2;
370: raise EC_UTILS.PROGRAM_EXIT;
371: END bind_insert_statement;
364: WHEN EC_UTILS.PROGRAM_EXIT then
365: raise;
366: WHEN OTHERS THEN
367: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.BIND_INSERT_STATEMENT');
368: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
369: ec_utils.i_ret_code :=2;
370: raise EC_UTILS.PROGRAM_EXIT;
371: END bind_insert_statement;
372:
383: i_stage_id pls_integer;
384: i_document_id pls_integer;
385: i_line_number pls_integer :=0;
386: begin
387: if ec_debug.G_debug_level >= 2 then
388: ec_debug.push('EC_OUTBOUND.INSERT_INTO_STAGE');
389: ec_debug.pl(3,'i_level',i_level);
390: end if;
391:
384: i_document_id pls_integer;
385: i_line_number pls_integer :=0;
386: begin
387: if ec_debug.G_debug_level >= 2 then
388: ec_debug.push('EC_OUTBOUND.INSERT_INTO_STAGE');
389: ec_debug.pl(3,'i_level',i_level);
390: end if;
391:
392: -- Generate Stage Id anyways
385: i_line_number pls_integer :=0;
386: begin
387: if ec_debug.G_debug_level >= 2 then
388: ec_debug.push('EC_OUTBOUND.INSERT_INTO_STAGE');
389: ec_debug.pl(3,'i_level',i_level);
390: end if;
391:
392: -- Generate Stage Id anyways
393: open seq_stage_id;
422:
423:
424: if g_key_column_pos is null
425: then
426: if ec_debug.G_debug_level >= 1 then
427: ec_debug.pl(1,'EC','ECE_DOCUMENT_ID','DOCUMENT_ID',i_document_id);
428: end if;
429: else
430: if ec_debug.G_debug_level >= 1 then
423:
424: if g_key_column_pos is null
425: then
426: if ec_debug.G_debug_level >= 1 then
427: ec_debug.pl(1,'EC','ECE_DOCUMENT_ID','DOCUMENT_ID',i_document_id);
428: end if;
429: else
430: if ec_debug.G_debug_level >= 1 then
431: ec_debug.pl(1,'EC','ECE_DOCUMENT_ID','DOCUMENT_ID',i_document_id,
426: if ec_debug.G_debug_level >= 1 then
427: ec_debug.pl(1,'EC','ECE_DOCUMENT_ID','DOCUMENT_ID',i_document_id);
428: end if;
429: else
430: if ec_debug.G_debug_level >= 1 then
431: ec_debug.pl(1,'EC','ECE_DOCUMENT_ID','DOCUMENT_ID',i_document_id,
432: 'DOCUMENT_NUMBER',ec_utils.g_file_tbl(g_key_column_pos).value);
433: end if;
434: ec_utils.g_ext_levels(1).Document_Number :=
427: ec_debug.pl(1,'EC','ECE_DOCUMENT_ID','DOCUMENT_ID',i_document_id);
428: end if;
429: else
430: if ec_debug.G_debug_level >= 1 then
431: ec_debug.pl(1,'EC','ECE_DOCUMENT_ID','DOCUMENT_ID',i_document_id,
432: 'DOCUMENT_NUMBER',ec_utils.g_file_tbl(g_key_column_pos).value);
433: end if;
434: ec_utils.g_ext_levels(1).Document_Number :=
435: ec_utils.g_file_tbl(g_key_column_pos).value;
460: ec_utils.g_ext_levels(j).parent_stage_id := null;
461: ec_utils.g_ext_levels(j).Line_Number := 0;
462: end loop;
463: end if;
464: if ec_debug.G_debug_level = 3 then
465: ec_debug.pl(3,'Stage Id',ec_utils.g_ext_levels(i_level).Stage_Id);
466: ec_debug.pl(3,'Document Id',ec_utils.g_ext_levels(i_level).Document_Id);
467: ec_debug.pl(3,'Document Number',ec_utils.g_ext_levels(i_level).Document_Number);
468: ec_debug.pl(3,'Line Number',ec_utils.g_ext_levels(i_level).Line_Number);
461: ec_utils.g_ext_levels(j).Line_Number := 0;
462: end loop;
463: end if;
464: if ec_debug.G_debug_level = 3 then
465: ec_debug.pl(3,'Stage Id',ec_utils.g_ext_levels(i_level).Stage_Id);
466: ec_debug.pl(3,'Document Id',ec_utils.g_ext_levels(i_level).Document_Id);
467: ec_debug.pl(3,'Document Number',ec_utils.g_ext_levels(i_level).Document_Number);
468: ec_debug.pl(3,'Line Number',ec_utils.g_ext_levels(i_level).Line_Number);
469: ec_debug.pl(3,'Parent Stage Id',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
462: end loop;
463: end if;
464: if ec_debug.G_debug_level = 3 then
465: ec_debug.pl(3,'Stage Id',ec_utils.g_ext_levels(i_level).Stage_Id);
466: ec_debug.pl(3,'Document Id',ec_utils.g_ext_levels(i_level).Document_Id);
467: ec_debug.pl(3,'Document Number',ec_utils.g_ext_levels(i_level).Document_Number);
468: ec_debug.pl(3,'Line Number',ec_utils.g_ext_levels(i_level).Line_Number);
469: ec_debug.pl(3,'Parent Stage Id',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
470: ec_debug.pl(3,'Transaction Level',ec_utils.g_ext_levels(i_level).external_level);
463: end if;
464: if ec_debug.G_debug_level = 3 then
465: ec_debug.pl(3,'Stage Id',ec_utils.g_ext_levels(i_level).Stage_Id);
466: ec_debug.pl(3,'Document Id',ec_utils.g_ext_levels(i_level).Document_Id);
467: ec_debug.pl(3,'Document Number',ec_utils.g_ext_levels(i_level).Document_Number);
468: ec_debug.pl(3,'Line Number',ec_utils.g_ext_levels(i_level).Line_Number);
469: ec_debug.pl(3,'Parent Stage Id',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
470: ec_debug.pl(3,'Transaction Level',ec_utils.g_ext_levels(i_level).external_level);
471: end if;
464: if ec_debug.G_debug_level = 3 then
465: ec_debug.pl(3,'Stage Id',ec_utils.g_ext_levels(i_level).Stage_Id);
466: ec_debug.pl(3,'Document Id',ec_utils.g_ext_levels(i_level).Document_Id);
467: ec_debug.pl(3,'Document Number',ec_utils.g_ext_levels(i_level).Document_Number);
468: ec_debug.pl(3,'Line Number',ec_utils.g_ext_levels(i_level).Line_Number);
469: ec_debug.pl(3,'Parent Stage Id',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
470: ec_debug.pl(3,'Transaction Level',ec_utils.g_ext_levels(i_level).external_level);
471: end if;
472:
465: ec_debug.pl(3,'Stage Id',ec_utils.g_ext_levels(i_level).Stage_Id);
466: ec_debug.pl(3,'Document Id',ec_utils.g_ext_levels(i_level).Document_Id);
467: ec_debug.pl(3,'Document Number',ec_utils.g_ext_levels(i_level).Document_Number);
468: ec_debug.pl(3,'Line Number',ec_utils.g_ext_levels(i_level).Line_Number);
469: ec_debug.pl(3,'Parent Stage Id',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
470: ec_debug.pl(3,'Transaction Level',ec_utils.g_ext_levels(i_level).external_level);
471: end if;
472:
473: bind_insert_statement
466: ec_debug.pl(3,'Document Id',ec_utils.g_ext_levels(i_level).Document_Id);
467: ec_debug.pl(3,'Document Number',ec_utils.g_ext_levels(i_level).Document_Number);
468: ec_debug.pl(3,'Line Number',ec_utils.g_ext_levels(i_level).Line_Number);
469: ec_debug.pl(3,'Parent Stage Id',ec_utils.g_ext_levels(i_level).Parent_Stage_Id);
470: ec_debug.pl(3,'Transaction Level',ec_utils.g_ext_levels(i_level).external_level);
471: end if;
472:
473: bind_insert_statement
474: (
473: bind_insert_statement
474: (
475: i_level
476: );
477: if ec_debug.G_debug_level >= 2 then
478: ec_debug.pop('EC_OUTBOUND.INSERT_INTO_STAGE');
479: end if;
480:
481: EXCEPTION
474: (
475: i_level
476: );
477: if ec_debug.G_debug_level >= 2 then
478: ec_debug.pop('EC_OUTBOUND.INSERT_INTO_STAGE');
479: end if;
480:
481: EXCEPTION
482: WHEN EC_UTILS.PROGRAM_EXIT then
481: EXCEPTION
482: WHEN EC_UTILS.PROGRAM_EXIT then
483: raise;
484: WHEN OTHERS THEN
485: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.INSERT_INTO_STAGE');
486: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
487: ec_utils.i_ret_code :=2;
488: raise EC_UTILS.PROGRAM_EXIT;
489: END insert_into_stage;
482: WHEN EC_UTILS.PROGRAM_EXIT then
483: raise;
484: WHEN OTHERS THEN
485: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.INSERT_INTO_STAGE');
486: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
487: ec_utils.i_ret_code :=2;
488: raise EC_UTILS.PROGRAM_EXIT;
489: END insert_into_stage;
490:
509: i_msg_data varchar2(2000);
510:
511:
512: BEGIN
513: if ec_debug.G_debug_level >= 2 then
514: ec_debug.push('EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
515: ec_debug.pl(3,'i_level',i_level);
516: end if;
517:
510:
511:
512: BEGIN
513: if ec_debug.G_debug_level >= 2 then
514: ec_debug.push('EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
515: ec_debug.pl(3,'i_level',i_level);
516: end if;
517:
518: for i in 1..ec_utils.g_int_levels.COUNT
511:
512: BEGIN
513: if ec_debug.G_debug_level >= 2 then
514: ec_debug.push('EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
515: ec_debug.pl(3,'i_level',i_level);
516: end if;
517:
518: for i in 1..ec_utils.g_int_levels.COUNT
519: loop
527: i
528: );
529:
530: i_rows_processed := dbms_sql.execute (ec_utils.g_int_levels(i).Cursor_Handle);
531: if ec_debug.G_debug_level = 3 then
532: ec_debug.pl(3,'Cursor Handle',ec_utils.g_int_levels(i).Cursor_handle);
533: end if;
534: while dbms_sql.fetch_rows( ec_utils.g_int_levels(i).Cursor_handle) > 0
535: LOOP
528: );
529:
530: i_rows_processed := dbms_sql.execute (ec_utils.g_int_levels(i).Cursor_Handle);
531: if ec_debug.G_debug_level = 3 then
532: ec_debug.pl(3,'Cursor Handle',ec_utils.g_int_levels(i).Cursor_handle);
533: end if;
534: while dbms_sql.fetch_rows( ec_utils.g_int_levels(i).Cursor_handle) > 0
535: LOOP
536: if ec_debug.G_debug_level = 3 then
532: ec_debug.pl(3,'Cursor Handle',ec_utils.g_int_levels(i).Cursor_handle);
533: end if;
534: while dbms_sql.fetch_rows( ec_utils.g_int_levels(i).Cursor_handle) > 0
535: LOOP
536: if ec_debug.G_debug_level = 3 then
537: ec_debug.pl(3,'Processing Row: '||dbms_sql.last_row_count||' for Level '||
538: ec_utils.g_int_levels(i).interface_level);
539: end if;
540: -- Get Values from the View
533: end if;
534: while dbms_sql.fetch_rows( ec_utils.g_int_levels(i).Cursor_handle) > 0
535: LOOP
536: if ec_debug.G_debug_level = 3 then
537: ec_debug.pl(3,'Processing Row: '||dbms_sql.last_row_count||' for Level '||
538: ec_utils.g_int_levels(i).interface_level);
539: end if;
540: -- Get Values from the View
541: -- Initialize the Column Counter
549: ec_utils.g_int_levels(i).Cursor_handle,
550: i_column_counter,
551: ec_utils.g_file_tbl(j).value
552: );
553: if ec_debug.G_debug_level = 3 then
554: if ec_utils.g_file_tbl(j).base_column_name is not null
555: then
556: ec_debug.pl(
557: 3,
552: );
553: if ec_debug.G_debug_level = 3 then
554: if ec_utils.g_file_tbl(j).base_column_name is not null
555: then
556: ec_debug.pl(
557: 3,
558: ec_utils.g_file_tbl(j).base_column_name,
559: ec_utils.g_file_tbl(j).value
560: );
606: i_return_status is NULL OR
607: i_return_status = FND_API.G_RET_STS_UNEXP_ERROR
608: )
609: THEN
610: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL',
611: 'EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
612: ec_debug.pl(0,'EC','EC_CODE_CONVERSION_FAILED','LEVEL',i);
613: ec_utils.i_ret_code := 2;
614: RAISE EC_UTILS.PROGRAM_EXIT;
608: )
609: THEN
610: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL',
611: 'EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
612: ec_debug.pl(0,'EC','EC_CODE_CONVERSION_FAILED','LEVEL',i);
613: ec_utils.i_ret_code := 2;
614: RAISE EC_UTILS.PROGRAM_EXIT;
615: END IF;
616:
658: i_return_status is NULL OR
659: i_return_status = FND_API.G_RET_STS_UNEXP_ERROR
660: )
661: THEN
662: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL',
663: 'EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
664: ec_debug.pl(0,'EC','EC_CODE_CONVERSION_FAILED','LEVEL',i);
665: ec_utils.i_ret_code := 2;
666: RAISE EC_UTILS.PROGRAM_EXIT;
660: )
661: THEN
662: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL',
663: 'EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
664: ec_debug.pl(0,'EC','EC_CODE_CONVERSION_FAILED','LEVEL',i);
665: ec_utils.i_ret_code := 2;
666: RAISE EC_UTILS.PROGRAM_EXIT;
667: END IF;
668:
705: end if;
706:
707: END IF;
708: end loop;
709: if ec_debug.G_debug_level >= 2 then
710: ec_debug.pop('EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
711: end if;
712:
713: EXCEPTION
706:
707: END IF;
708: end loop;
709: if ec_debug.G_debug_level >= 2 then
710: ec_debug.pop('EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
711: end if;
712:
713: EXCEPTION
714: WHEN EC_UTILS.PROGRAM_EXIT then
713: EXCEPTION
714: WHEN EC_UTILS.PROGRAM_EXIT then
715: raise;
716: WHEN OTHERS THEN
717: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
718: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
719: ec_utils.i_ret_code :=2;
720: raise EC_UTILS.PROGRAM_EXIT;
721: END fetch_data_from_view;
714: WHEN EC_UTILS.PROGRAM_EXIT then
715: raise;
716: WHEN OTHERS THEN
717: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.FETCH_DATA_FROM_VIEW');
718: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
719: ec_utils.i_ret_code :=2;
720: raise EC_UTILS.PROGRAM_EXIT;
721: END fetch_data_from_view;
722:
725: **/
726: procedure close_outbound
727: is
728: begin
729: if ec_debug.G_debug_level >= 2 then
730: ec_debug.push('EC_OUTBOUND.CLOSE_OUTBOUND');
731: end if;
732: /**
733: Successful execution of the transaction. Close the Cursor handles,
726: procedure close_outbound
727: is
728: begin
729: if ec_debug.G_debug_level >= 2 then
730: ec_debug.push('EC_OUTBOUND.CLOSE_OUTBOUND');
731: end if;
732: /**
733: Successful execution of the transaction. Close the Cursor handles,
734: Disbale the Debug.
757: then
758: dbms_sql.close_cursor(ec_utils.g_ext_levels(i).cursor_handle);
759: end if;
760: end loop;
761: if ec_debug.G_debug_level >= 2 then
762: ec_debug.pop('EC_OUTBOUND.CLOSE_OUTBOUND');
763: end if;
764:
765: exception
758: dbms_sql.close_cursor(ec_utils.g_ext_levels(i).cursor_handle);
759: end if;
760: end loop;
761: if ec_debug.G_debug_level >= 2 then
762: ec_debug.pop('EC_OUTBOUND.CLOSE_OUTBOUND');
763: end if;
764:
765: exception
766: WHEN OTHERS THEN
763: end if;
764:
765: exception
766: WHEN OTHERS THEN
767: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.CLOSE_OUTBOUND');
768: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
769: ec_utils.i_ret_code :=2;
770: raise EC_UTILS.PROGRAM_EXIT;
771: end close_outbound;
764:
765: exception
766: WHEN OTHERS THEN
767: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.CLOSE_OUTBOUND');
768: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
769: ec_utils.i_ret_code :=2;
770: raise EC_UTILS.PROGRAM_EXIT;
771: end close_outbound;
772:
781: )
782: is
783: i_plsql_pos pls_integer;
784: begin
785: ec_debug.pl(0,'EC','ECE_START_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
786: if ec_debug.G_debug_level >= 2 then
787: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
788: ec_debug.pl(3,'i_map_id',i_map_id);
789: ec_debug.push('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
782: is
783: i_plsql_pos pls_integer;
784: begin
785: ec_debug.pl(0,'EC','ECE_START_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
786: if ec_debug.G_debug_level >= 2 then
787: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
788: ec_debug.pl(3,'i_map_id',i_map_id);
789: ec_debug.push('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
790: end if;
783: i_plsql_pos pls_integer;
784: begin
785: ec_debug.pl(0,'EC','ECE_START_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
786: if ec_debug.G_debug_level >= 2 then
787: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
788: ec_debug.pl(3,'i_map_id',i_map_id);
789: ec_debug.push('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
790: end if;
791:
784: begin
785: ec_debug.pl(0,'EC','ECE_START_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
786: if ec_debug.G_debug_level >= 2 then
787: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
788: ec_debug.pl(3,'i_map_id',i_map_id);
789: ec_debug.push('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
790: end if;
791:
792: /** Initialize Memory Structures**/
785: ec_debug.pl(0,'EC','ECE_START_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
786: if ec_debug.G_debug_level >= 2 then
787: ec_debug.pl(3,'i_transaction_type',i_transaction_type);
788: ec_debug.pl(3,'i_map_id',i_map_id);
789: ec_debug.push('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
790: end if;
791:
792: /** Initialize Memory Structures**/
793: ec_utils.g_file_tbl.DELETE;
802: ec_utils.g_transaction_type := i_transaction_type;
803: ec_utils.g_direction := substrb(i_transaction_type,length(i_transaction_type),1);
804: ec_utils.g_map_id := i_map_id;
805:
806: if ec_debug.G_debug_level = 3 then
807: ec_debug.pl(3,'g_direction',ec_utils.g_direction);
808: end if;
809: /**
810: If the program is run from SQLplus , the Concurrent Request id is
803: ec_utils.g_direction := substrb(i_transaction_type,length(i_transaction_type),1);
804: ec_utils.g_map_id := i_map_id;
805:
806: if ec_debug.G_debug_level = 3 then
807: ec_debug.pl(3,'g_direction',ec_utils.g_direction);
808: end if;
809: /**
810: If the program is run from SQLplus , the Concurrent Request id is
811: < 0. In this case , get the run id from ECE_OUTPUT_RUNS_S.NEXTVAL.
817: into i_run_id
818: from dual;
819: end if;
820: ec_utils.g_run_id := i_run_id;
821: if ec_debug.G_debug_level = 3 then
822: ec_debug.pl(3,'Run Id for the Transaction',ec_utils.g_run_id);
823: end if;
824:
825: ec_utils.get_tran_stage_data
818: from dual;
819: end if;
820: ec_utils.g_run_id := i_run_id;
821: if ec_debug.G_debug_level = 3 then
822: ec_debug.pl(3,'Run Id for the Transaction',ec_utils.g_run_id);
823: end if;
824:
825: ec_utils.get_tran_stage_data
826: (
856:
857: load_objects;
858:
859: fetch_data_from_view (0);
860: if ec_debug.G_debug_level >= 1 then
861: for i in 1..ec_utils.g_int_levels.COUNT
862: loop
863: ec_debug.pl(1,ec_utils.g_int_levels(i).rows_processed||' row(s) processed for Level '||i);
864: end loop;
859: fetch_data_from_view (0);
860: if ec_debug.G_debug_level >= 1 then
861: for i in 1..ec_utils.g_int_levels.COUNT
862: loop
863: ec_debug.pl(1,ec_utils.g_int_levels(i).rows_processed||' row(s) processed for Level '||i);
864: end loop;
865: end if;
866: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',ec_utils.g_int_levels(1).rows_processed);
867:
862: loop
863: ec_debug.pl(1,ec_utils.g_int_levels(i).rows_processed||' row(s) processed for Level '||i);
864: end loop;
865: end if;
866: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',ec_utils.g_int_levels(1).rows_processed);
867:
868: close_outbound;
869: if ec_debug.G_debug_level >= 2 then
870: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
865: end if;
866: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',ec_utils.g_int_levels(1).rows_processed);
867:
868: close_outbound;
869: if ec_debug.G_debug_level >= 2 then
870: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
871: end if;
872: ec_debug.pl(0,'EC','ECE_FINISH_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
873: EXCEPTION
866: ec_debug.pl(0,'EC','ECE_DOCUMENTS_PROCESSED','NO_OF_DOCS',ec_utils.g_int_levels(1).rows_processed);
867:
868: close_outbound;
869: if ec_debug.G_debug_level >= 2 then
870: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
871: end if;
872: ec_debug.pl(0,'EC','ECE_FINISH_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
873: EXCEPTION
874: WHEN EC_UTILS.PROGRAM_EXIT then
868: close_outbound;
869: if ec_debug.G_debug_level >= 2 then
870: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
871: end if;
872: ec_debug.pl(0,'EC','ECE_FINISH_OUTBOUND','TRANSACTION_TYPE',i_transaction_type,'MAP_ID',i_map_id);
873: EXCEPTION
874: WHEN EC_UTILS.PROGRAM_EXIT then
875: raise;
876: WHEN OTHERS THEN
873: EXCEPTION
874: WHEN EC_UTILS.PROGRAM_EXIT then
875: raise;
876: WHEN OTHERS THEN
877: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
878: ec_debug.pl(0,'EC','ECE_ERROR_CODE','ERROR_CODE',SQLCODE);
879: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
880: close_outbound;
881: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
874: WHEN EC_UTILS.PROGRAM_EXIT then
875: raise;
876: WHEN OTHERS THEN
877: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
878: ec_debug.pl(0,'EC','ECE_ERROR_CODE','ERROR_CODE',SQLCODE);
879: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
880: close_outbound;
881: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
882: raise EC_UTILS.PROGRAM_EXIT;
875: raise;
876: WHEN OTHERS THEN
877: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
878: ec_debug.pl(0,'EC','ECE_ERROR_CODE','ERROR_CODE',SQLCODE);
879: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
880: close_outbound;
881: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
882: raise EC_UTILS.PROGRAM_EXIT;
883: end process_outbound_documents;
877: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
878: ec_debug.pl(0,'EC','ECE_ERROR_CODE','ERROR_CODE',SQLCODE);
879: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
880: close_outbound;
881: ec_debug.pop('EC_OUTBOUND.PROCESS_OUTBOUND_DOCUMENTS');
882: raise EC_UTILS.PROGRAM_EXIT;
883: end process_outbound_documents;
884:
885: /**
893: i_run_id IN number,
894: i_document_id IN number DEFAULT NULL
895: ) IS
896: BEGIN
897: if ec_debug.G_debug_level >= 2 then
898: ec_debug.push('EC_OUTBOUND.DELETE_STAGE_DATA');
899: ec_debug.pl(3,'i_run_id',i_run_id);
900: ec_debug.pl(3,'i_document_id',i_document_id);
901: end if;
894: i_document_id IN number DEFAULT NULL
895: ) IS
896: BEGIN
897: if ec_debug.G_debug_level >= 2 then
898: ec_debug.push('EC_OUTBOUND.DELETE_STAGE_DATA');
899: ec_debug.pl(3,'i_run_id',i_run_id);
900: ec_debug.pl(3,'i_document_id',i_document_id);
901: end if;
902: IF i_run_id IS NULL THEN
895: ) IS
896: BEGIN
897: if ec_debug.G_debug_level >= 2 then
898: ec_debug.push('EC_OUTBOUND.DELETE_STAGE_DATA');
899: ec_debug.pl(3,'i_run_id',i_run_id);
900: ec_debug.pl(3,'i_document_id',i_document_id);
901: end if;
902: IF i_run_id IS NULL THEN
903: ec_debug.pl(0,'EC','ECE_PARAM_MISSING','PARAMETER','I_RUN_ID', 'PROCEDURE','EC_OUTBOUND.DELETE_STAGE_DATA');
896: BEGIN
897: if ec_debug.G_debug_level >= 2 then
898: ec_debug.push('EC_OUTBOUND.DELETE_STAGE_DATA');
899: ec_debug.pl(3,'i_run_id',i_run_id);
900: ec_debug.pl(3,'i_document_id',i_document_id);
901: end if;
902: IF i_run_id IS NULL THEN
903: ec_debug.pl(0,'EC','ECE_PARAM_MISSING','PARAMETER','I_RUN_ID', 'PROCEDURE','EC_OUTBOUND.DELETE_STAGE_DATA');
904: /**
899: ec_debug.pl(3,'i_run_id',i_run_id);
900: ec_debug.pl(3,'i_document_id',i_document_id);
901: end if;
902: IF i_run_id IS NULL THEN
903: ec_debug.pl(0,'EC','ECE_PARAM_MISSING','PARAMETER','I_RUN_ID', 'PROCEDURE','EC_OUTBOUND.DELETE_STAGE_DATA');
904: /**
905: Set the FAILURE Retcode for the Concurrent Manager
906: **/
907: EC_UTILS.i_ret_code := 2;
918: IF SQL%ROWCOUNT = 0 THEN
919: /**
920: Output a warning message if no rows are deleted
921: **/
922: if ec_debug.G_debug_level >= 1 then
923: ec_debug.pl(1,'NO rows deleted from ECE_STAGE');
924: end if;
925: END IF;
926: if ec_debug.G_debug_level >= 2 then
919: /**
920: Output a warning message if no rows are deleted
921: **/
922: if ec_debug.G_debug_level >= 1 then
923: ec_debug.pl(1,'NO rows deleted from ECE_STAGE');
924: end if;
925: END IF;
926: if ec_debug.G_debug_level >= 2 then
927: ec_debug.pl(3,'Number of rows deleted from ECE_STAGE',SQL%ROWCOUNT);
922: if ec_debug.G_debug_level >= 1 then
923: ec_debug.pl(1,'NO rows deleted from ECE_STAGE');
924: end if;
925: END IF;
926: if ec_debug.G_debug_level >= 2 then
927: ec_debug.pl(3,'Number of rows deleted from ECE_STAGE',SQL%ROWCOUNT);
928:
929: ec_debug.pop('EC_OUTBOUND.DELETE_STAGE_DATA');
930: end if;
923: ec_debug.pl(1,'NO rows deleted from ECE_STAGE');
924: end if;
925: END IF;
926: if ec_debug.G_debug_level >= 2 then
927: ec_debug.pl(3,'Number of rows deleted from ECE_STAGE',SQL%ROWCOUNT);
928:
929: ec_debug.pop('EC_OUTBOUND.DELETE_STAGE_DATA');
930: end if;
931: EXCEPTION
925: END IF;
926: if ec_debug.G_debug_level >= 2 then
927: ec_debug.pl(3,'Number of rows deleted from ECE_STAGE',SQL%ROWCOUNT);
928:
929: ec_debug.pop('EC_OUTBOUND.DELETE_STAGE_DATA');
930: end if;
931: EXCEPTION
932: WHEN EC_UTILS.PROGRAM_EXIT then
933: raise;
931: EXCEPTION
932: WHEN EC_UTILS.PROGRAM_EXIT then
933: raise;
934: WHEN OTHERS THEN
935: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.DELETE_STAGE_DATA');
936: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
937: ec_utils.i_ret_code:=2;
938: raise EC_UTILS.PROGRAM_EXIT;
939: END delete_stage_data;
932: WHEN EC_UTILS.PROGRAM_EXIT then
933: raise;
934: WHEN OTHERS THEN
935: ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','EC_OUTBOUND.DELETE_STAGE_DATA');
936: ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
937: ec_utils.i_ret_code:=2;
938: raise EC_UTILS.PROGRAM_EXIT;
939: END delete_stage_data;
940: