Below mentioned is the sample script for Unit of Measure Conversion.
DECLARE
x_row_id VARCHAR2(100) :=NULL;
x_unit_of_measure VARCHAR2(100) :='TESTUOM1';
x_unit_of_measure_tl VARCHAR2(100) :='TESTUOM1';
x_attribute_category VARCHAR2(100) :=NULL;
x_attribute1 VARCHAR2(100) :=NULL;
x_attribute2 VARCHAR2(100) :=NULL;
x_attribute3 VARCHAR2(100) :=NULL;
x_attribute4 VARCHAR2(100) :=NULL;
x_attribute5 VARCHAR2(100) :=NULL;
x_attribute6 VARCHAR2(100) :=NULL;
x_attribute7 VARCHAR2(100) :=NULL;
x_attribute8 VARCHAR2(100) :=NULL;
x_attribute9 VARCHAR2(100) :=NULL;
x_attribute10 VARCHAR2(100) :=NULL;
x_attribute11 VARCHAR2(100) :=NULL;
x_attribute12 VARCHAR2(100) :=NULL;
x_attribute13 VARCHAR2(100) :=NULL;
x_attribute14 VARCHAR2(100) :=NULL;
x_attribute15 VARCHAR2(100) :=NULL;
x_request_id NUMBER :=1;
x_disable_date DATE :=NULL;
x_base_uom_flag VARCHAR2(100) :='N';
x_uom_code VARCHAR2(100) :='TUM';
x_uom_class VARCHAR2(100) :='MASS';
x_description VARCHAR2(100) :='MASS';
x_creation_date DATE := SYSDATE;
x_last_update_date DATE := SYSDATE;
x_last_update_login NUMBER;
x_program_application_id NUMBER :=1;
x_program_id NUMBER := 1;
x_program_update_date DATE :=sysdate;
l_user_id NUMBER :=1318;
BEGIN
apps.mo_global.init ('PO');
apps.mo_global.set_policy_context ('S', 204);
apps.fnd_global.apps_initialize ( user_id => 1318, resp_id => 50578, resp_appl_id => 201 );
BEGIN
apps.mtl_units_of_measure_tl_pkg.insert_row( x_row_id ,
x_unit_of_measure ,
x_unit_of_measure_tl ,
x_attribute_category ,
x_attribute1 ,
x_attribute2 ,
x_attribute3 ,
x_attribute4 ,
x_attribute5 ,
x_attribute6 ,
x_attribute7 ,
x_attribute8 ,
x_attribute9 ,
x_attribute10 ,
x_attribute11 ,
x_attribute12 ,
x_attribute13 ,
x_attribute14 ,
x_attribute15 ,
x_request_id ,
x_disable_date ,
x_base_uom_flag ,
x_uom_code ,
x_uom_class ,
x_description ,
x_creation_date ,
l_user_id ,
x_last_update_date ,
l_user_id ,
x_last_update_login ,
x_program_application_id ,
x_program_id ,
x_program_update_date );
IF(x_row_id IS NOT NULL ) THEN
dbms_output.put_line('UOM CREATED SUCCESSFULLY');
dbms_output.put_line(' ROW ID : '||x_row_id);
BEGIN
INSERT
INTO apps.mtl_uom_conversions
(
inventory_item_id,
unit_of_measure,
uom_code,
uom_class,
last_update_date,
last_updated_by,
creation_date,
created_by,
last_update_login,
conversion_rate,
default_conversion_flag
)
VALUES
(
0,
x_unit_of_measure,
x_uom_code,
x_uom_class,
SYSDATE,
1318,
SYSDATE,
1318,
-1,
1.10,
'N'
);
END;
commit;
END IF;
dbms_output.put_line('Unit of Measure created succesfully with UOM CODE '||'TESTUOM1');
END;
dbms_session.reset_package() ;
END;
Execute the below script for confirmation that UOM has been created.
SELECT * FROM apps.mtl_units_of_measure WHERE uom_code='TUM';
DECLARE
x_row_id VARCHAR2(100) :=NULL;
x_unit_of_measure VARCHAR2(100) :='TESTUOM1';
x_unit_of_measure_tl VARCHAR2(100) :='TESTUOM1';
x_attribute_category VARCHAR2(100) :=NULL;
x_attribute1 VARCHAR2(100) :=NULL;
x_attribute2 VARCHAR2(100) :=NULL;
x_attribute3 VARCHAR2(100) :=NULL;
x_attribute4 VARCHAR2(100) :=NULL;
x_attribute5 VARCHAR2(100) :=NULL;
x_attribute6 VARCHAR2(100) :=NULL;
x_attribute7 VARCHAR2(100) :=NULL;
x_attribute8 VARCHAR2(100) :=NULL;
x_attribute9 VARCHAR2(100) :=NULL;
x_attribute10 VARCHAR2(100) :=NULL;
x_attribute11 VARCHAR2(100) :=NULL;
x_attribute12 VARCHAR2(100) :=NULL;
x_attribute13 VARCHAR2(100) :=NULL;
x_attribute14 VARCHAR2(100) :=NULL;
x_attribute15 VARCHAR2(100) :=NULL;
x_request_id NUMBER :=1;
x_disable_date DATE :=NULL;
x_base_uom_flag VARCHAR2(100) :='N';
x_uom_code VARCHAR2(100) :='TUM';
x_uom_class VARCHAR2(100) :='MASS';
x_description VARCHAR2(100) :='MASS';
x_creation_date DATE := SYSDATE;
x_last_update_date DATE := SYSDATE;
x_last_update_login NUMBER;
x_program_application_id NUMBER :=1;
x_program_id NUMBER := 1;
x_program_update_date DATE :=sysdate;
l_user_id NUMBER :=1318;
BEGIN
apps.mo_global.init ('PO');
apps.mo_global.set_policy_context ('S', 204);
apps.fnd_global.apps_initialize ( user_id => 1318, resp_id => 50578, resp_appl_id => 201 );
BEGIN
apps.mtl_units_of_measure_tl_pkg.insert_row( x_row_id ,
x_unit_of_measure ,
x_unit_of_measure_tl ,
x_attribute_category ,
x_attribute1 ,
x_attribute2 ,
x_attribute3 ,
x_attribute4 ,
x_attribute5 ,
x_attribute6 ,
x_attribute7 ,
x_attribute8 ,
x_attribute9 ,
x_attribute10 ,
x_attribute11 ,
x_attribute12 ,
x_attribute13 ,
x_attribute14 ,
x_attribute15 ,
x_request_id ,
x_disable_date ,
x_base_uom_flag ,
x_uom_code ,
x_uom_class ,
x_description ,
x_creation_date ,
l_user_id ,
x_last_update_date ,
l_user_id ,
x_last_update_login ,
x_program_application_id ,
x_program_id ,
x_program_update_date );
IF(x_row_id IS NOT NULL ) THEN
dbms_output.put_line('UOM CREATED SUCCESSFULLY');
dbms_output.put_line(' ROW ID : '||x_row_id);
BEGIN
INSERT
INTO apps.mtl_uom_conversions
(
inventory_item_id,
unit_of_measure,
uom_code,
uom_class,
last_update_date,
last_updated_by,
creation_date,
created_by,
last_update_login,
conversion_rate,
default_conversion_flag
)
VALUES
(
0,
x_unit_of_measure,
x_uom_code,
x_uom_class,
SYSDATE,
1318,
SYSDATE,
1318,
-1,
1.10,
'N'
);
END;
commit;
END IF;
dbms_output.put_line('Unit of Measure created succesfully with UOM CODE '||'TESTUOM1');
END;
dbms_session.reset_package() ;
END;
Execute the below script for confirmation that UOM has been created.
SELECT * FROM apps.mtl_units_of_measure WHERE uom_code='TUM';
No comments:
Post a Comment