DBA Data[Home] [Help]

PACKAGE BODY: APPS.MISC_TRANSACTIONS_UTIL

Source


1 PACKAGE BODY MISC_TRANSACTIONS_UTIL AS
2 /* $Header: INVTXUTB.pls 120.1 2005/06/17 17:52:40 appldev  $*/
3 
4 --  Global constant holding the package name
5 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'MISC_TRANSACTIONS_UTIL';
6 g_debug_init                  BOOLEAN := FALSE;
7 g_fd                          utl_file.file_type;
8 g_trace_on                    NUMBER := 0;          -- Log ON state
9 
10 
11 PROCEDURE init_misc_transaction_values(
12       p_organization_id IN NUMBER,
13       p_account_segments IN VARCHAR2 DEFAULT NULL,
14       x_is_negative_quantity_allowed OUT NOCOPY VARCHAR2,
15       x_is_wms_purchased OUT NOCOPY VARCHAR2,
16       x_is_wms_installed OUT NOCOPY VARCHAR2,
17       x_transaction_header_id OUT NOCOPY NUMBER,
18       x_account_disposition_id OUT NOCOPY NUMBER,
19       x_stock_locator_control_code OUT NOCOPY NUMBER,
20       x_primary_cost_method OUT NOCOPY NUMBER
21       )
22   IS
23    l_tmp_num NUMBER;
24    l_tmp_vc VARCHAR2(100);
25    l_return_status VARCHAR2(100);
26 
27 BEGIN
28 
29    -- get stock locator, primary_cost_method, negative qty allowed --
30    BEGIN
31    SELECT Nvl(stock_locator_control_code, -1), primary_cost_method, Nvl(NEGATIVE_INV_RECEIPT_CODE, -1)
32     INTO x_stock_locator_control_code, x_primary_cost_method, l_tmp_num
33     FROM mtl_parameters
34     WHERE organization_id = p_organization_id;
35    IF (l_tmp_num = 1) THEN
36     x_is_negative_quantity_allowed := 'TRUE';
37    ELSE
38     x_is_negative_quantity_allowed := 'FALSE';
39    END IF;
40    EXCEPTION
41      WHEN OTHERS THEN
42       x_stock_locator_control_code := -1;
43       x_primary_cost_method := -1;
44       x_is_negative_quantity_allowed := 'FALSE';
45    END;
46 
47    -- get account disposition id --
48    IF (p_account_segments IS NOT NULL) THEN
49      BEGIN
50      SELECT Nvl(disposition_id, -1)
51       INTO x_account_disposition_id
52       FROM mtl_generic_dispositions_kfv
53       WHERE concatenated_segments = p_account_segments
54        AND organization_id = p_organization_id;
55      EXCEPTION
56       WHEN OTHERS THEN
57        x_account_disposition_id := -1;
58      END;
59    ELSE
60      x_account_disposition_id := -1;
61    END IF;
62 
63    -- get wms install info --
64    -- passed out status, out msg_count, out msg_data, in org
65    BEGIN
66    IF wms_install.check_install(l_return_status, l_tmp_num, l_tmp_vc, p_organization_id) THEN
67      x_is_wms_installed := 'TRUE';
68    ELSE
69      x_is_wms_installed := 'FALSE';
70    END IF;
71    EXCEPTION
72     WHEN OTHERS THEN
73      x_is_wms_installed := 'FALSE';
74    END;
75 
76 
77    -- get wms purchased info --
78    -- passed out status, out msg_count, out msg_data, in org
79    BEGIN
80    IF wms_install.check_install(l_return_status, l_tmp_num, l_tmp_vc, NULL) THEN
81      x_is_wms_purchased := 'TRUE';
82    ELSE
83      x_is_wms_purchased := 'FALSE';
84    END IF;
85    EXCEPTION
86     WHEN OTHERS THEN
87      x_is_wms_purchased := 'FALSE';
88    END;
89 
90 
91    -- get transaction_header_id --
92    BEGIN
93    SELECT mtl_material_transactions_s.nextval
94     INTO x_transaction_header_id
95     FROM DUAL;
96    EXCEPTION
97     WHEN OTHERS THEN
98      x_transaction_header_id := -1;
99    END;
100 
101 
102 END init_misc_transaction_values;
103 END MISC_TRANSACTIONS_UTIL;