Automatically process the task single Operation move Interface table program

Source: Internet
Author: User

This program, according to the input parameters can be automatically processed wip_move_txn_interface table.

Although it is generally a "WIP move transaction manager" on a regular basis, but personally think this kind of processing still has a certain lag. Users want to complete the operation immediately see the effect, but the old to wait a few minutes.

So the program is specially developed for this automatic processing. is quite practical.

Logic is also very simple, that is, automatically submit a "WIP Mobile transaction processing Workflow" processing corresponding group_id data.

The code also shares it:

-----------------------------
--Handle interface table, optional processing method
-----------------------------
PROCEDURE Process_move_txn_interface (
P_process_type VARCHAR2---Processing mode, currently only submit request Submit_request want to post immediately process_online
, p_group_id number---the group ID processed
, x_request_id out number--Request ID for output
, x_retcode out number---0: success is not 0: failed (or: 0: Success 1: Warning 2: Error----NOTE: What to do when determining a warning)
, x_errbuf out VARCHAR2---specific error message
)
Is
L_process_phase number; --Identify the progress of the program
---
L_REQUEST_ID number;
---
BEGIN
X_retcode: = 0;
X_errbuf: = Null;

L_process_phase: = 0;

---First step is to check for parameters that cannot be empty
IF p_process_type is null OR p_group_id is null
THEN
X_errbuf: = ' When calling Process_move_txn_interface, the necessary parameters do not exist, please check the parameters! '
X_retcode: = 2;
return;
End IF;

L_process_phase: = 1;

------------Start------------
IF p_process_type = ' submit_request ' THEN
---Automatically submit a posting request
---WIP Move transaction processing workflow
-----WIP Move Transaction Worker
L_REQUEST_ID: =
Fnd_request. Submit_request (' WIP ',--application
' Wictws ',--Program
Null
NULL,--start_time (optional)
FALSE,--sub_request
To_char (p_group_id),--GROUP ID to process
' 1 ',--seemingly all give 1, do not know what circumstances give 2, need to verify.
' 2400 ',--looks like it's all for 2400.
' 1 ',--looks like it's all for 1.
Chr (0)
);
L_process_phase: = 2;
Dbms_output. Put_Line (' automatically generated request ID: ' | | L_REQUEST_ID);
IF l_request_id = 0 THEN
X_errbuf: = ' autocommit request failed! '
X_retcode: = 2;
return;
ELSE
X_errbuf: = x_errbuf| | ' Autocommit request succeeded! Request ID: ' | | l_request_id;
End IF;
x_request_id: = l_request_id;
L_process_phase: = 3;
elsif p_process_type = ' Process_online ' THEN
X_errbuf: = ' Current program does not support processing mode: (' | | p_process_type| | ')! Please check the parameters! ';
X_retcode: = 2;
return;
L_process_phase: = 5;
ELSE
X_errbuf: = ' parameter P_process_type (' | | p_process_type| | ') Invalid, please check the parameters! ';
X_retcode: = 2;
return;
End IF;
------------End--------------

L_process_phase: = 6;

EXCEPTION
When others
THEN
X_retcode: = 2;
X_errbuf: =
' P_process_type: '
|| P_process_type
|| ' p_group_id: '
|| p_group_id
|| ' There are abnormal errors in the processing of mobile transactions! '
|| CHR (10)
|| ' Error message: '
|| To_char (SQLCODE)
|| '-'
|| Sqlerrm
|| CHR (10)
|| ' Program Progress: '
|| L_process_phase;
----can be properly written: If the error, also need to deal with the SQL
---because if there is a update/insert/delete action in front of it, although it jumps to an exception, this action is not automatically rolled back.
End;

--------------------------Test section:

DECLARE
L_retcode number;
L_ERRBUF VARCHAR2 (4000);
---
L_GROUP_ID number;
L_REQUEST_ID number;
---
BEGIN
Fnd_client_info.set_org_context (104);
Fnd_global. Apps_initialize (user_id=>5954, resp_id=>52054, resp_appl_id =>20003);
L_GROUP_ID: = 9999;
---posted immediately.
Xyg_pub_wip_pkg. Process_move_txn_interface (' Submit_request ', l_group_id,l_request_id,l_retcode,l_errbuf);
Dbms_output. Put_Line (L_retcode | | '-' || L_ERRBUF);
IF l_retcode = 0 THEN
Dbms_output. Put_Line (' Successfully generated request ID: ' | | L_REQUEST_ID);
COMMIT;
ELSE
Dbms_output. Put_Line (' Posting an unusual problem occurred! ') L_ERRBUF);
ROLLBACK;
End IF;
End;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.