Introduction:
hr_organization_api.create_organization is an API to create inventory organization in oracle apps r12 along with assigning organization classification with subsequent API “hr_organization_api.create_organization” and hr_organization_api.create_org_classification to assign appropriate organization classification.
reading more: Query to list all key flexfields in oracle apps
Goal:
Create new inventory organization and assign inventory organization classification.
reading more : Create move order using API in oracle apps R12
Forms Or Pages:
Prerequisites:
No prerequisites to use API
Example:
API to Create inventory organization in oracle apps r12
API IN/OUT Parameters :
— IN
— p_validate IN NUMBER Optional Default FALSE
— p_effective_date IN DATE Required
— p_language_code IN VARCHAR2 Optional DEFAULT hr_api.userenv_lang
— p_business_group_id IN NUMBER Required
— p_name IN NUMBER Required
— p_date_from IN DATE Optional
— OUT x_return_status OUT VARCHAR2(1)
— p_organization_id OUT NOCOPY NUMBER
— p_object_version_number OUT NOCOPY NUMBER
— p_duplicate_org_warning OUT NOCOPY BOOLEAN
reading more: API to update EAM Asset Numbers
API Parameters clarifications:
- @param p_validate If true, then validation alone will be performed and the database will remain unchanged. If false and all validation checks pass, then the database will be modified.
- @param p_effective_date Reference date for validating lookup values are applicable during the start to end active date range. This date does not determine when the changes take effect.
- @param p_business_group_id Uniquely identifies the business group associated with the organization the process creates.
- @param p_assignment_id Identifies the assignment record to be modified.
- @param p_name The name of the organization the process creates.
- @param p_date_from Date the organization takes effect.
- @param p_language_code Specifies to which language the translation values apply. You can set to the base or any installed language. The default value of hr_api.userenv_lang is equivalent to the RDBMS userenv(‘LANG’) function value.
- @param p_location_id Uniquely identifies the location of the organization.
- @param p_internal_external_flag Flag specifying if the organization is an internal or external organization.
- @param p_type The organization type associated with the organization the process creates. Valid values are determined by the ORG_TYPE lookup type.
- @param p_object_version_number If p_validate is false, then set to the version number of the organization created. If p_validate is true, then set to null.
- @param p_organization_id If p_validate is false, then this uniquely identifies the organization created. If p_validate is true, then set to null.
- @param p_org_information_id If p_validate is false, then this uniquely identifies the classification created. If p_validate is true, then set to null.
- @param p_duplicate_org_warning The value is ‘true’ if an organization already exists with the same name in a different business group. (If the duplicate is in the same business group, the process raises an error.
reading more: Form registration in oracle apps R12
API Calling example:
DECLARE
l_location_id NUMBER;
l_org_type VARCHAR2 (100);
l_org_classif_code VARCHAR (30);
o_org_information_id NUMBER;
o_organization_id NUMBER;
o_duplicate_org_warning BOOLEAN;
o_object_version_number NUMBER;
l_err_msg VARCHAR2 (1000);
BEGIN
-- Get Location ID
BEGIN
SELECT hl.location_id
INTO l_location_id
FROM hr_locations hl
WHERE location_code = 'E London';
EXCEPTION
WHEN OTHERS THEN
l_location_id := NULL;
END;
-- Get Organization Type
BEGIN
SELECT hl.lookup_code
INTO l_org_type
FROM hr_lookups hl
WHERE hl.lookup_type = 'ORG_TYPE'
AND hl.meaning = 'Department';
EXCEPTION
WHEN OTHERS THEN
l_org_type := NULL;
END;
-- Get Organization Classification Code
BEGIN
SELECT h.lookup_code
INTO l_org_classif_code
FROM hr_lookups h
WHERE lookup_type = 'ORG_CLASS'
AND description = 'Inventory Organization';
EXCEPTION
WHEN OTHERS THEN
l_org_classif_code := NULL;
END;
--Create Organization
hr_organization_api.create_organization (p_validate => FALSE
,p_effective_date => sysdate
,p_business_group_id => 202
,p_name => 'Oraask_INV_ORG'
,p_date_from => sysdate
,p_language_code => hr_api.userenv_lang
,p_location_id => l_location_id
,p_internal_external_flag => 'INT'
,p_type => l_org_type
,p_object_version_number => o_object_version_number
,p_organization_id => o_organization_id
,p_duplicate_org_warning => o_duplicate_org_warning);
--Create Classification
IF (o_organization_id IS NOT NULL) THEN
hr_organization_api.create_org_classification (p_validate => FALSE
,p_effective_date => sysdate
,p_organization_id => o_organization_id
,p_org_classif_code => l_org_classif_code
,p_org_information_id => o_org_information_id
,p_object_version_number => o_object_version_number);
END IF;
dbms_output.put_line ('***************************');
dbms_output.put_line ('New Inventory Organization has been created with ID: ' || o_organization_id);
dbms_output.put_line ('o_object_version_number' || o_object_version_number);
dbms_output.put_line ('o_org_information_id' || o_org_information_id);
dbms_output.put_line ('***************************');
COMMIT;
EXCEPTION
WHEN OTHERS THEN
l_err_msg := substr (sqlerrm, 0, 1000);
dbms_output.put_line ('***************************');
dbms_output.put_line ('There is an exception has been raised from API with error message: ' || l_err_msg);
dbms_output.put_line ('***************************');
END;
Final Result:
In this article, we have demonstrate how to create inventory organization using API in oracle apps r12 .
Hopefully, it was clear and concise.
reading more: RICE , RICEW And FRICE components in oracle apps
Hello there, I found your site by the use of Google whilst looking for a similar subject,
your web site came up, it appears good. I’ve bookmarked it in my google bookmarks.
Hi there, just turned into alert to your weblog via
Google, and found that it’s truly informative. I am gonna watch out for
brussels. I will appreciate if you happen to proceed
this in future. Many other folks can be benefited
out of your writing. Cheers!