ERP Import API Functions
Package: EW_IF_API
These functions can be referred to as ew_if_api."Function Name"
Load Data Using Application Import
Using this API, the Application Import gets executed, and the retrieved file is used as the source to run the ERP Import.
For example, if user wants to load data using DataBricks Agent. In this case, DataBricks SQL can be registered as an application and called using this API to retrieve data in the ERP Import logic script.
-- Load Interface data using App Import process
PROCEDURE load_data_using_app_import
(p_user_id IN NUMBER
,p_name IN VARCHAR2 -- ERP Import Name
,p_app_name IN VARCHAR2
,x_status OUT VARCHAR2 -- S or E
,x_message OUT VARCHAR2
);
Process Delta Only
Using this API, Interface lines which have Edit Action can be checked and those lines where there is no change in any of the property values can be deleted OR marked as Ignored.
-- Detect interface records with Edit action (OR Create or Edit action
-- with member already exists) where no property is changed
-- and remove them if not changed.
PROCEDURE process_delta_only(p_name IN VARCHAR2 -- ERP Import Name
,p_option IN VARCHAR2 -- Delete or Ignore
,p_chk_no_props IN VARCHAR2 DEFAULT 'N'
,x_status OUT VARCHAR2 -- S or E
,x_message OUT VARCHAR2
);
Get List of Unique Prop values
This API gives list of Unique Property Values from the interface table for passed ERP Import Configuration and Property Label.
/*
Input Parameters
- ERP Import Configuration Name
- Property Label
Output Parameter
- List of Unique Values provided in the current ERP Import Execution from the Interface table
*/
PROCEDURE get_unique_prop_values (p_name IN VARCHAR2
,p_prop_label IN VARCHAR2
,x_prop_values OUT ew_global.g_char_tbl
);
Example:
Requirement : when a dimension is processed using ERP Import module and if it has an Attribute properties then new Attributes should be created in an independent request so that current import process does not fail.
Main ERP Import Dimension : Employee
Property : Department
Property Department is an attribute dimension and hence if new Department Value is passed then New member for this department should be created in the “Department” dimension. Then only Employee dimension changes will be successfully processed as it refers new Department property.
To implement this solution this API will help fetch unique values from the interface table.
Example SQL Code snippet (to be used in the PRE ERP Import Logic Script)
PROCEDURE create_attributes (p_prop_label IN VARCHAR2)
IS
l_values ew_global.g_char_tbl;
BEGIN
log('Check if New Attributes if exists for : '||p_prop_label);
ew_if_api.get_unique_prop_values (c_if_config_name,p_prop_label ,l_values);
FOR i IN 1..l_values.COUNT
LOOP
log('Attribute : '||l_values(i));
-- Check if this attribute exists or not
IF ew_hierarchy.chk_member_exists(p_app_name => ew_lb_api.g_app_name
,p_dim_name => p_prop_label – Same as Property Label (could be different)
,p_member_name => l_values(i)
,p_case_match => 'N'
) = 'N'
THEN
log('Create new member.. ..');
END IF;
END LOOP;
END create_attributes;