Introduction
When we define our work structure in HRMS, we often need to assign a manager to the organization. We can assign the organization manager from the front end through the application. However, imagine that we have numerous organizations, and we need to assign a manager for each one. In this case, the HRMS API that Oracle provides takes its place to solve that issue.
This article will give an API code example to create an organization manager from the backend. or in other words, API to assign a manager to an organization.
Goal
Create an organization manager using API in Oracle APPS.
Standard API name: “HR_ORGANIZATION_API.CREATE_ORG_MANAGER“.
Forms Or Pages
API Parameters Description
This API creates cost center manager information. This API creates an existing organization’s new cost center manager information type. Information types are stored in the table HR_ORGANIZATION_INFORMATION
API OUT Parameters :
Parameter Name | Type | Data Type |
---|---|---|
p_org_information_id | OUT | NUMBER |
p_object_version_number | OUT | NUMBER |
p_warning | OUT | BOOLEAN |
API Parameters Clarifications:
- param: p_validate If valid, validation alone will be performed, and the database will remain unchanged. The database will be modified if false and all validation checks pass.
- 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_organization_id Uniquely identifies the organization associated with the organization manager relationship the process creates.
- param: p_org_info_type_code The organization information type code – ‘Organization Name Alias’.
- param: p_org_information1 Segment1 for p_org_info_type_code.
- param: p_org_information2 Uniquely identifies the person associated with the cost center manager information.
- param: p_org_information3 The date the organization manager relationship takes effect.
- param: p_org_information4 The date the organization manager relationship is no longer in effect.
- param: p_org_information5 Segment5 for p_org_info_type_code.
- param: p_org_information6 Segment6 for p_org_info_type_code.
- param: p_org_information7 Segment7 for p_org_info_type_code.
- param: p_org_information8 Segment8 for p_org_info_type_code.
- param: p_org_information9 Segment9 for p_org_info_type_code.
- param: p_org_information10 Segment10 for p_org_info_type_code.
- param: p_org_information11 Segment11 for p_org_info_type_code.
- param: p_org_information12 Segment12 for p_org_info_type_code.
- param: p_org_information13 Segment13 for p_org_info_type_code.
- param: p_org_information14 Segment14 for p_org_info_type_code.
- param: p_org_information15 Segment15 for p_org_info_type_code.
- param: p_org_information16 Segment16 for p_org_info_type_code.
- param: p_org_information17 Segment17 for p_org_info_type_code.
- param: p_org_information18 Segment18 for p_org_info_type_code.
- param: p_org_information19 Segment19 for p_org_info_type_code.
- param: p_org_information20 Segment20 for p_org_info_type_code.
- param: p_attribute_category This context value determines which flexfield structure to use with the descriptive flexfield segments.
- param: p_attribute1 Descriptive flexfield segment.
- param: p_attribute2 Descriptive flexfield segment.
- param: p_attribute3 Descriptive flexfield segment.
- param: p_attribute4 Descriptive flexfield segment.
- param: p_attribute5 Descriptive flexfield segment.
- param: p_attribute6 Descriptive flexfield segment.
- param: p_attribute7 Descriptive flexfield segment.
- param: p_attribute8 Descriptive flexfield segment.
- param: p_attribute9 Descriptive flexfield segment.
- param: p_attribute10 Descriptive flexfield segment.
- param: p_attribute11 Descriptive flexfield segment.
- param: p_attribute12 Descriptive flexfield segment.
- param: p_attribute13 Descriptive flexfield segment.
- param: p_attribute14 Descriptive flexfield segment.
- param: p_attribute15 Descriptive flexfield segment.
- param: p_attribute16 Descriptive flexfield segment.
- param: p_attribute17 Descriptive flexfield segment.
- param: p_attribute18 Descriptive flexfield segment.
- param: p_attribute19 Descriptive flexfield segment.
- param: p_attribute20 Descriptive flexfield segment.
- param: p_org_information_id If p_validate is false, then this uniquely identifies the information type created. If p_validate is true, then set to null.
- param: p_object_version_number If p_validate is false, then it is set to the version number of the created organization manager relationship. If p_validate is true, then the value will be null.
- param: p_warning Set if there is an overlap in the organization manager relationship.
API Code Example
------------------------------------------
-- Description: API to define organization manager in oracle EBS R12
-- Created By: Hassan @ Oraask.com
-- Creation Date: 27-SEP-2022
------------------------------------------
DECLARE
L_SESSION_CNT NUMBER;
L_ORG_INFORMATION_ID NUMBER;
L_OBJECT_VERSION_NUMBER NUMBER;
L_WARNING BOOLEAN;
FUNCTION BOOL2CHAR (BOOL IN BOOLEAN)
RETURN VARCHAR2
IS
BEGIN
IF BOOL THEN
RETURN 'TRUE';
ELSIF NOT BOOL THEN
RETURN 'FALSE';
ELSE
RETURN 'NULL';
END IF;
END;
BEGIN
SELECT COUNT (*)
INTO L_SESSION_CNT
FROM FND_SESSIONS
WHERE SESSION_ID = USERENV ('SESSIONID');
IF (L_SESSION_CNT = 0) THEN
HR_UTILITY.FND_INSERT (SYSDATE);
END IF;
HR_ORGANIZATION_API.CREATE_ORG_MANAGER (P_VALIDATE => FALSE
,P_EFFECTIVE_DATE => TRUNC (SYSDATE)
,P_ORGANIZATION_ID => 204
,P_ORG_INFO_TYPE_CODE => 'Organization Name Alias'
,P_ORG_INFORMATION2 => 6513 -- Person ID
,P_ORG_INFORMATION3 => TO_CHAR (TRUNC (SYSDATE), 'YYYY/MM/DD') -- START_DATE
,P_ORG_INFORMATION4 => '4712/12/31 00:00:00' -- END_DATE
,P_ORG_INFORMATION_ID => L_ORG_INFORMATION_ID
,P_OBJECT_VERSION_NUMBER => L_OBJECT_VERSION_NUMBER
,P_WARNING => L_WARNING);
DBMS_OUTPUT.PUT_LINE ('********************************');
DBMS_OUTPUT.PUT_LINE ('Organization Manager Created Successfully');
DBMS_OUTPUT.PUT_LINE ('L_ORG_INFORMATION_ID = ' || L_ORG_INFORMATION_ID);
DBMS_OUTPUT.PUT_LINE ('L_OBJECT_VERSION_NUMBER = ' || L_OBJECT_VERSION_NUMBER);
DBMS_OUTPUT.PUT_LINE ('L_WARNING = ' || BOOL2CHAR (L_WARNING));
DBMS_OUTPUT.PUT_LINE ('********************************');
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE ('********************************');
DBMS_OUTPUT.PUT_LINE ('The API HR_ORGANIZATION_API.CREATE_ORG_MANAGER Ended with Error : ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE ('********************************');
END
/
Output
Organization Manager Created Successfully
L_ORG_INFORMATION_ID = 197200
L_OBJECT_VERSION_NUMBER = 1
L_WARNING = FALSE
Final Result
Conclusion
This article gives an example of creating an organization manager in Oracle EBS using API from the backend.
Please don’t use this code directly on production environment, instead test it on test environment first to make sure that API working correctly as per your requirements.
Hopefully, it was clear and concise. Share to Spread Knowledge.