0% found this document useful (0 votes)
1 views2 pages

Oracle API Update SR Tutorial

The document provides a step-by-step guide on how to update the Service Request (SR) type using the Oracle Service Request API. It explains the concept of APIs in Oracle E-Business Suite, details the specific API for Service Requests, and outlines the necessary steps to initialize the user, prepare data, call the API, and check the output status. The guide concludes with a summary of the key steps involved in the process.

Uploaded by

govind roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

Oracle API Update SR Tutorial

The document provides a step-by-step guide on how to update the Service Request (SR) type using the Oracle Service Request API. It explains the concept of APIs in Oracle E-Business Suite, details the specific API for Service Requests, and outlines the necessary steps to initialize the user, prepare data, call the API, and check the output status. The guide concludes with a summary of the key steps involved in the process.

Uploaded by

govind roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Understanding How to Update SR Type Using

Oracle Service Request API


Perfect ■ You did the right thing by saying that — let’s slow down completely and go step-by-step,
from scratch, like a teacher explaining this to a new learner. We’ll go from the basic concept → to
what an API does → to how we use it to update an SR type.

■ Step 1: What is an API in Oracle Apps?


In Oracle E-Business Suite (EBS), an API is a ready-made program given by Oracle that performs
some business action — like creating or updating records in the system. Think of it like a remote
control: You press one button → it performs a whole task internally (like updating a Service
Request). You don’t need to write everything from scratch.

■ Step 2: The specific API for Service Requests


Oracle gives a package for Service Requests: CS_SERVICEREQUEST_PUB Inside it, there’s a
function: UPDATE_SERVICE_REQUEST That’s the one we’ll use to update things like Type,
Status, Owner, Severity, etc.

■ Step 3: What do we want to do?


We want to change SR Type of a Service Request. Example: SR Number = 'SR123456', Current
Type = 'Hardware', New Type = 'Software'.

■ Step 4: Before calling the API


We must tell Oracle who we are, because APIs work under a user + responsibility — just like how
you log into the application.
BEGIN
FND_GLOBAL.APPS_INITIALIZE(
user_id => 1234, -- your user ID
resp_id => 50679, -- responsibility ID (like 'Service Request Agent')
resp_appl_id => 660 -- Application ID for Service module
);
END;
/

■ Step 5: Prepare the data to change


DECLARE
l_sr_rec CS_SERVICEREQUEST_PUB.SERVICE_REQUEST_REC_TYPE;
BEGIN
l_sr_rec.incident_id := 12345; -- SR to update
l_sr_rec.type_id := 101; -- new SR type
END;
/

■ Step 6: Call the API


CS_SERVICEREQUEST_PUB.UPDATE_SERVICE_REQUEST(
p_api_version_number => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
p_sr_rec => l_sr_rec,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data
);

■ Step 7: Full Working Example


BEGIN
FND_GLOBAL.APPS_INITIALIZE(
user_id => 1234,
resp_id => 50679,
resp_appl_id => 660
);
END;
/
DECLARE
l_api_version NUMBER := 1.0;
l_sr_rec CS_SERVICEREQUEST_PUB.SERVICE_REQUEST_REC_TYPE;
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
BEGIN
SELECT incident_id INTO l_sr_rec.incident_id
FROM cs_incidents_all_b
WHERE incident_number = 'SR123456';

l_sr_rec.type_id := 101;

CS_SERVICEREQUEST_PUB.UPDATE_SERVICE_REQUEST(
p_api_version_number => l_api_version,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
p_sr_rec => l_sr_rec,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data
);

DBMS_OUTPUT.PUT_LINE('Return Status: ' || l_return_status);


DBMS_OUTPUT.PUT_LINE('Message: ' || l_msg_data);
END;
/

■ Step 8: Output you’ll see


If successful: Return Status: S Message: Service Request updated successfully If error: Return
Status: E Message: Invalid SR Type

■ Step 9: Summary
Step | What you do | Purpose 1 | Initialize with FND_GLOBAL.APPS_INITIALIZE | Tell Oracle who
you are 2 | Fill l_sr_rec | Put your SR details 3 | Call API UPDATE_SERVICE_REQUEST | Perform
the update 4 | Check x_return_status | See if it worked 5 | Commit | Save changes

You might also like