1 PACKAGE mtl_online_transaction_pub AUTHID CURRENT_USER AS
2 /* $Header: INVTXNS.pls 120.1 2005/06/17 17:48:50 appldev $ */
3 --
4 -- FUNCTION process_online
5 --
6 -- Description:
7 --
8 -- This function process transaction records in
9 -- MTL_TRANSACTIONS_INTERFACE table with the specified
10 -- transaction header id.
11 --
12 -- This function provides a mechanism for users to process their
13 -- transactions synchronously.
14 --
15 -- Note: The current implementation prevents users from rollback
16 -- after this function is called (and returned successfully). As
17 -- a result, a user should only call this function when he/she
18 -- is ready to commit.
19 --
20 -- Input Parameters:
21 -- p_transaction_header_id header id of the records
22 -- to be processed
23 -- p_timeout maximum number of seconds
24 -- to wait before returning
25 -- from the funcation
26 -- p_error_code error code stored in
27 -- mtl_transactions_interface table
28 -- if there is some errors
29 -- p_error_explanation error description for the specified
30 -- header id
31 -- Return:
32 -- a boolean TRUE if succeed, FALSE otherwise
33 --
34 --
35 -- Usage:
36 --
37 -- To use this function, a user who wants to process a single
38 -- transaction record would go through the following steps:
39 --
40 -- 1. get the next value of the mtl_transactions_sequence and
41 -- use it as the transaction header id
42 -- 2. insert a record into mtl_transactions_interface table,
43 -- and a record into mtl_serial_numbers_interface table if
44 -- the item is under serial control, and a record into
45 -- mtl_transaction_lot_interface table if the item is under
46 -- lot control, according to the material transaction open
47 -- interface manual. The record(s) inserted should be
48 -- populated with the transaction header id obtained from step 1
49 -- 3. set the process_flag of the record(s) to 1 (ready)
50 -- 4. call this function with the transaction_header_id, and the
51 -- timeout in seconds as input parameters. timeout is the maximum time
52 -- in seconds the user would wait for the function to execute before
53 -- aborting the execution
54 -- 5. check return boolean to see whether the function is executed
55 -- successfully.
56 -- 6. check message stack using fnd_message package for warnings and/or
57 -- errors
58 --
59 -- The possible outcome of the function call can be:
60 --
61 -- a. function call returns TRUE, no error message, transaction
62 -- record process succeeded
63 -- or
64 -- b. function call returns TRUE, with warning messages, transaction
65 -- record process succeeded
66 -- or
67 -- c. function call returns FALSE, with error message as timeout, or
68 -- validation error, or other transaction errors such as onhand
69 -- quantity is not enough to transact.
70 --
71 -- If the outcome is a or b, the process_flag column in the corresponding
72 -- records in the interface tables is set to 7 (succeeded) by
73 -- the function; otherwise, the process_flag is set to 3 (error), and
74 -- the error_code column and error_explaination column are populated
75 -- accordingly. See open interface manual for more details on these flags.
76 --
77 -- User might also want to use methods in package fnd_message, such as
78 -- fnd_message.get, to retrieve error messages in the message stack.
79 -- See Oracle(R) Applications Developer's Guide Release 11 for more
80 -- details on message dictionary api.
81 --
82 -- Users can also call this method process to process multiple transaction
83 -- records by using the same transaction header id in the records.
84 --
85 -- The transaction records will not be removed from the interface
86 -- tables by this function regardless whether the records are processed
87 -- successfully or not.
88 --
89 -- Sample Code: (!!!TO BE TESTED!!!!!)
90 --
91 -- WHENEVER ERROR ROLLBACK;
92 -- DECLARE
93 --
94 -- m_txn_header_id NUMBER;
95 -- m_timeout NUMBER;
96 -- m_outcome BOOLEAN;
97 --
98 -- BEGIN
99 --
100 -- m_txn_header_id := mtl_transactions_sequence.nextval;
101 --
102 -- INSERT into mtl_transactions_interface
103 -- (..., -- to fill in columns in mtl_transactions_interface table
104 -- transaction_header_id)
105 -- VALUES
106 -- (..., -- user specify values
107 -- m_txn_header_id);
108 --
109 -- m_timeout := 100;
110 -- m_outcome := mtl_online_transaction_pub.process_online(
111 -- m_txn_header_id
112 -- , m_timeout
113 -- )
114 -- IF (m_outcome == FALSE) THEN
115 -- RAISE EXCEPTION;
116 -- END IF;
117 --
118 -- dbms_output.put_line('Transaction with header id '||
119 -- TO_CHAR(m_txn_header_id) ||
120 -- ' has been processed successfully');
121 -- EXCEPTION
122 --
123 -- dbms_output.put_line('Failed to process the transaction');
124 -- dbms_output.put_line('Error message: '||fnd_message.get);
125 --
126 -- END;
127 --
128
129 FUNCTION process_online(
130 p_transaction_header_id IN NUMBER,
131 p_timeout in number default NULL,
132 p_error_code out NOCOPY varchar2,
133 p_error_explanation out NOCOPY varchar2
134 )
135 RETURN BOOLEAN;
136 END;