Professional Documents
Culture Documents
Template Web Adi
Template Web Adi
1- Create Table
PROCEDURE cust_import_data_to_interface;
PROCEDURE cust_upload_data_to_staging (
p_segment1 VARCHAR2,
p_segment2 VARCHAR2,
p_organization_id VARCHAR2,
p_organization_name VARCHAR2,
p_description VARCHAR2,
p_inventory_item_status_code VARCHAR2,
p_template_name VARCHAR2,
p_template_id VARCHAR2,
p_primary_uom_code VARCHAR2,
p_attribute1 VARCHAR2
);
END SH_webadi_item_upload_pkg;
CREATE OR REPLACE PACKAGE BODY APPS.SH_webadi_item_upload_pkg
IS
PROCEDURE initialize_segment_len
AS
BEGIN
BEGIN
SELECT ffv.maximum_size
INTO l_segment1_len
FROM fnd_id_flex_segments_vl fifs, fnd_flex_value_sets ffv
WHERE 1 = 1
AND fifs.flex_value_set_id = ffv.flex_value_set_id
AND fifs.id_flex_code = 'MSTK'
AND fifs.enabled_flag = 'Y'
AND fifs.application_column_name = 'SEGMENT1';
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_segment1_len := 0;
END;
BEGIN
SELECT ffv.maximum_size
INTO l_segment2_len
FROM fnd_id_flex_segments_vl fifs, fnd_flex_value_sets ffv
WHERE 1 = 1
AND fifs.flex_value_set_id = ffv.flex_value_set_id
AND fifs.id_flex_code = 'MSTK'
AND fifs.enabled_flag = 'Y'
AND fifs.application_column_name = 'SEGMENT2';
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_segment2_len := 0;
END;
END;
PROCEDURE cust_import_data_to_interface
IS
CURSOR int_trans
IS
SELECT segment1,
segment2,
organization_id,
ORGANIZATION_CODE,
description,
inventory_item_status_code,
template_id,
TEMPLATE_NAME,
primary_uom_code,
attribute1,
transaction_type,
process_flag,
set_process_id
FROM SH_webadi_item_upload;
BEGIN
FOR r_int_trans IN int_trans
LOOP
INSERT INTO MTL_SYSTEM_ITEMS_INTERFACE (segment1,
segment2,
organization_id,
ORGANIZATION_CODE,
description,
inventory_item_status_code,
template_id,
TEMPLATE_NAME,
primary_uom_code,
attribute1,
transaction_type,
process_flag,
set_process_id)
VALUES (r_int_trans.segment1,
r_int_trans.segment2,
r_int_trans.organization_id,
r_int_trans.ORGANIZATION_CODE,
r_int_trans.description,
r_int_trans.inventory_item_status_code,
r_int_trans.template_id,
r_int_trans.TEMPLATE_NAME,
r_int_trans.primary_uom_code,
r_int_trans.attribute1,
r_int_trans.transaction_type,
r_int_trans.process_flag,
r_int_trans.set_process_id);
DELETE FROM SH_webadi_item_upload cwi
WHERE 1 = 1
AND NVL (cwi.SEGMENT1, 1) =
NVL (r_int_trans.SEGMENT1, 1)
AND NVL (cwi.SEGMENT2, 1) =
NVL (r_int_trans.SEGMENT2, 1);
END LOOP;
COMMIT;
END cust_import_data_to_interface;
PROCEDURE cust_upload_data_to_staging (
p_segment1 VARCHAR2,
p_segment2 VARCHAR2,
p_organization_id VARCHAR2,
p_organization_name VARCHAR2,
p_description VARCHAR2,
p_inventory_item_status_code VARCHAR2,
p_template_name VARCHAR2,
p_template_id VARCHAR2,
p_primary_uom_code VARCHAR2,
p_attribute1 VARCHAR2)
IS
l_error_message VARCHAR2 (3000);
l_error_code VARCHAR2 (3000);
l_organization_id NUMBER;
l_template_id NUMBER;
l_uom_validity VARCHAR2 (250);
l_flag_validation VARCHAR2 (250);
l_item_desc_len NUMBER;
BEGIN
----------------------------------------
-----Load Segment Sizes from setup------
----------------------------------------
BEGIN
initialize_segment_len;
END;
----------------------------------------
----------Select Org ID-----------------
----------------------------------------
IF p_organization_name IS NOT NULL
THEN
BEGIN
SELECT hou.ORGANIZATION_ID
INTO l_organization_id
FROM hr_organization_units hou
WHERE hou.NAME = p_organization_name;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_error_message :=
l_error_message
|| ','
|| 'Please enter correct organization';
l_error_code := 'E';
END;
END IF;
----------------------------------------
----------Select Template ID------------
----------------------------------------
IF p_template_name IS NOT NULL
THEN
BEGIN
SELECT mit.TEMPLATE_ID
INTO l_template_id
FROM MTL_ITEM_TEMPLATES mit
WHERE mit.TEMPLATE_NAME = p_template_name;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_error_message :=
l_error_message || ',' || 'Please enter correct template';
l_error_code := 'E';
END;
END IF;
----------------------------------------
------Validate Primary UOM Code---------
----------------------------------------
IF p_primary_uom_code IS NOT NULL
THEN
BEGIN
SELECT 'Valid'
INTO l_uom_validity
FROM MTL_UNITS_OF_MEASURE_VL uom
WHERE uom.UOM_CODE = p_primary_uom_code;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_error_message :=
l_error_message
|| ','
|| 'Please enter the correct Primary/Secondary UOM Code';
l_error_code := 'E';
END;
END IF;
----------------------------------------
-----Validate Description entered-------
----------------------------------------
BEGIN
SELECT LENGTH (TRIM (p_description)) INTO l_item_desc_len FROM DUAL;
----------------------------------------
--------Validate Item Segments----------
----------------------------------------
BEGIN
IF l_segment1_len > 0 AND LENGTH (P_SEGMENT1) > l_segment1_len
OR l_segment2_len > 0 AND LENGTH (P_SEGMENT2) > l_segment2_len
THEN
l_error_message :=
l_error_message
|| ','
|| 'Please ensure that all Item SEGMENT lengths are as per setup.';
l_error_code := 'E';
END IF;
END;
--------------------------------------------------------------------------------------------------------------
--------Condition to show error if any of the above validation picks up a data entry error--------------------
--------Condition to insert data into custom staging table if the data passes all above validations-----------
IF l_error_code = 'E'
THEN
raise_application_error (-20101, l_error_message);
ELSIF NVL (l_error_code, 'A') <> 'E'
THEN
INSERT INTO apps.SH_webadi_item_upload (segment1,
segment2,
organization_id,
description,
inventory_item_status_code,
template_id,
primary_uom_code,
attribute1,
process_flag,
transaction_type,
set_process_id,
summary_flag,
enabled_flag,
interface_status)
VALUES (TRIM (p_segment1),
TRIM (p_segment2),
l_organization_id,
TRIM (p_description),
TRIM (p_inventory_item_status_code),
l_template_id,
TRIM (p_primary_uom_code),
TRIM (p_attribute1),
1,
'CREATE',
1,
'N',
'Y',
'NO');
----------------------------------------------------------------------------------------------------
-----------Insert data into MTL_SYSTEM_ITEMS_INTERFACE after loading into staging table-------------
----------------------------------------------------------------------------------------------------
BEGIN
cust_import_data_to_interface;
END;
END IF;
END cust_upload_data_to_staging;
END SH_webadi_item_upload_pkg;
/
3- Create Viwe
The ‘Display in Create Document Page’ checkbox will be checked and the following functions will be added by pressing the highlighted buttons above:
1. Desktop Integration - Create Document
2. Create Document
After the entry above, press the ‘Apply’ button. The following screen will appear:
Click on the highlighted Interface select box to view the parameters of the API as follows:
Click on the ‘Next’ button. The following screen will appear:
Click on the highlighted ‘Create Content’ button to create the WebADI sheet template that will be used for data entry:
Click on ‘Create’
Provide the Layout name as follows:
Select From LOV For Both Side To Map The Template Layout And Integrator
You will now enter all the Source and Target columns on this page.
All 10 parameters of the API setup in the WebADI will be associated with the content columns of the WebADI sheet on this page .
After the completion of this step, you are now ready to upload items through WebADI.
Defining LOV For Field
Field Name Code
ORGANIZATION_ID DECLARE
BEGIN
BNE_INTEGRATOR_UTILS.CREATE_TABLE_LOV (
P_APPLICATION_ID => 401,
P_INTERFACE_CODE => 'SH_ITEM_XINTG_INTF1',
P_INTERFACE_COL_NAME => 'P_ORGANIZATION_ID',
P_ID_COL => 'ORGANIZATION_ID',
P_MEAN_COL => 'Inv_ORG_Name',
P_DESC_COL => 'MASTER_ORG_NAME',
P_TABLE => 'XX_INV_ORG_V',
P_ADDL_W_C => '1=1',
P_WINDOW_CAPTION => 'Organization List',
P_WINDOW_WIDTH => 400,
P_WINDOW_HEIGHT => 600,
P_TABLE_BLOCK_SIZE => 50,
P_TABLE_SORT_ORDER => 'Inv_ORG_Name',
P_USER_ID => 1013415,
P_POPLIST_FLAG => 'N');
COMMIT;
END;
ORGANIZATION_NAME DECLARE
BEGIN
BNE_INTEGRATOR_UTILS.CREATE_TABLE_LOV (
P_APPLICATION_ID => 401,
P_INTERFACE_CODE => 'SH_ITEM1_XINTG_INTF1',
P_INTERFACE_COL_NAME => 'P_ORGANIZATION_NAME',
P_ID_COL => 'Inv_ORG_Name',
P_MEAN_COL => 'Inv_ORG_Name',
P_DESC_COL => 'MASTER_ORG_NAME',
P_TABLE => 'XX_INV_ORG_V',
P_ADDL_W_C => 'ORGANIZATION_ID in (7872,7851)',
P_WINDOW_CAPTION => 'Organization List',
P_WINDOW_WIDTH => 400,
P_WINDOW_HEIGHT => 600,
P_TABLE_BLOCK_SIZE => 50,
P_TABLE_SORT_ORDER => 'Inv_ORG_Name',
P_USER_ID => 1013415,
P_POPLIST_FLAG => 'N');
COMMIT;
END;
TEMPLATE_NAME DECLARE
BEGIN
BNE_INTEGRATOR_UTILS.CREATE_TABLE_LOV (
P_APPLICATION_ID => 401,
P_INTERFACE_CODE => 'SH_ITEM_XINTG_INTF1',
P_INTERFACE_COL_NAME => 'P_TEMPLATE_NAME',
P_ID_COL => 'TEMPLATE_NAME',
P_MEAN_COL => 'TEMPLATE_NAME',
P_DESC_COL => 'DESCRIPTION',
P_TABLE => 'MTL_ITEM_TEMPLATES_VL',
P_ADDL_W_C => '1=1',
P_WINDOW_CAPTION => 'Template Name',
P_WINDOW_WIDTH => 400,
P_WINDOW_HEIGHT => 600,
P_TABLE_BLOCK_SIZE => 50,
P_TABLE_SORT_ORDER => 'TEMPLATE_NAME',
P_USER_ID => 1013415,
P_POPLIST_FLAG => 'N');
COMMIT;
END;
PRIMARY_UOM_CODE DECLARE
BEGIN
BNE_INTEGRATOR_UTILS.CREATE_TABLE_LOV (
P_APPLICATION_ID => 401,
P_INTERFACE_CODE => 'SH_ITEM_XINTG_INTF1', --
BNE_INTERFACE_COLS_B.INTERFACE_CODE
P_INTERFACE_COL_NAME => 'P_PRIMARY_UOM_CODE', --
BNE_INTERFACE_COLS_B.INTERFACE_COL_NAME
P_ID_COL => 'UOM_CODE',
P_MEAN_COL => 'UNIT_OF_MEASURE',
P_DESC_COL => 'UOM_CLASS',
P_TABLE => 'MTL_UNITS_OF_MEASURE_VL',
P_ADDL_W_C => 'DISABLE_DATE is null',
P_WINDOW_CAPTION => 'Primary UOM Name',
P_WINDOW_WIDTH => 400,
P_WINDOW_HEIGHT => 600,
P_TABLE_BLOCK_SIZE => 50,
P_TABLE_SORT_ORDER => 'UOM_CODE',
P_USER_ID => 1013415,
P_POPLIST_FLAG => 'N');
COMMIT;
END;
Create Function Linked To WebADI
The next step is to assign this function to a Menu of your choice: Navigation:
System Administrator Application Function
bne:page=BneCreateDoc&bne:language=US&bne:viewer=BNE:EXCEL2007&bne:reporting=N&bne:integrator=USER_NAME:SH_ITEM1&bne:norevie
w=Yes
BneApplicationService
Navigate to the responsibility where the menu is assigned:
Try to Launch the WebADI from the custom function:
My Youtube
https://www.youtube.com/c/AhmedElshayeb2002?sub_confirmation=1