Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
131 views4 pages

SR Create API - Example

The document provides a working example of how to use the CS_SERVICEREQUEST_PUB.CREATE_SERVICEREQUEST API in Oracle Applications 11i to create a new service request. The example demonstrates initializing a service request record, populating its fields, and calling the API to create the request.

Uploaded by

ameetdey
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)
131 views4 pages

SR Create API - Example

The document provides a working example of how to use the CS_SERVICEREQUEST_PUB.CREATE_SERVICEREQUEST API in Oracle Applications 11i to create a new service request. The example demonstrates initializing a service request record, populating its fields, and calling the API to create the request.

Uploaded by

ameetdey
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
You are on page 1/ 4

Copyright (c) 2021, Oracle. All rights reserved. Oracle Confidential.

Working Example Of CS_SERVICEREQUEST_PUB.CREATE_SERVICEREQUEST API for 11i (Doc ID


220594.1)

In this Document

Symptoms
Changes
Cause
Solution
References

APPLIES TO:

Oracle Teleservice - Version 11.5.10.2 to 11.5.10.2 [Release 11.5]


Information in this document applies to any platform.

SYMPTOMS

You are attempting to use the Service Request API (11i) to create a new service request.

CHANGES

CAUSE

Require a working example of the API.

SOLUTION

Note: For the below to work with Service Security, FND_GLOBAL.APPS_INITIALIZE should be used to set the
context correctly. Note 209185.1 illustrates how to use FND_GLOBAL.APPS_INITIALIZE.

Example below to create a new SR via the API for 11i:


-- create a SR through the public API.


declare

lx_msg_countNUMBER;

lx_msg_data VARCHAR2(2000);

lx_request_id NUMBER; lx_request_number VARCHAR2(50);


lx_interaction_id NUMBER;

lx_workflow_process_id NUMBER;

lx_msg_index_out NUMBER; lx_return_status VARCHAR2(1);


l_service_request_rec CS_ServiceRequest_PUB.service_request_rec_type;
l_notes_table CS_SERVICEREQUEST_PUB.notes_table;

l_contacts_tab CS_SERVICEREQUEST_PUB.contacts_table;

l_request_id NUMBER := &incidentId;


--xxxxxxx,  l_cc_number VARCHAR2(50);

begin

cs_servicerequest_pub.initialize_rec( l_service_request_rec );

--djjl_service_request_rec.type_id := 106;
--l_service_request_rec.status_id := 2;
--djjl_service_request_rec.severity_id := 4;
--djjl_service_request_rec.urgency_id := 4;--djjl_service_request_rec.urgency_id := 4; --djjl_service_request_rec.summary :=
'SR Creation from PUB for CC validations changed';
--djjl_service_request_rec.verify_cp_flag := 'T';
--djjl_service_request_rec.resource_type := 'RS_EMPLOYEE';
--djjl_service_request_rec.language := 'US';
--select resource_id from jtf_rs_resource_extns_tl where language = userenv('LANG')
--djjl_service_request_rec.owner_id := 700;

--djjl_service_request_rec.problem_code := 'HDWR';
--djjl_service_request_rec.resolution_code := 'FIXED';

--l_service_request_rec.contract_service_id := <CONTRACT_SERVICE_ID>;

--select cs_servicerequest_pub.cc_decode(credit_card_number)
--into l_cc_number --from cs_incidents_all_b
--where incident_id = <&INCIDENT_ID>;

---dbms_output.put_line('cc number = ' || l_cc_number);


--l_service_request_rec.cc_number := l_cc_number;
--l_service_request_rec.cc_number := <CREDIT_CARD_NUMBER>';--l_service_request_rec.cc_type_code := '';
--l_service_request_rec.cc_expiration_date := sysdate + 2;
--l_service_request_rec.cc_first_name := sysdate -2;
--l_service_request_rec.cc_last_name := sysdate -2;
--l_service_request_rec.cc_middle_name := sysdate -2; cs_servicerequest_pub.Update_ServiceRequest (
p_api_version => 2.0, p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_FALSE,
x_return_status => lx_return_status, x_msg_count => lx_msg_count,
x_msg_data => lx_msg_data, p_request_id => l_request_id,
p_request_number => NULL,
p_audit_comments => NULL,
p_object_version_number => 2,
p_resp_appl_id => NULL,
p_resp_id => NULL,
p_last_updated_by => NULL,
p_last_update_login => NULL,
p_last_update_date => sysdate,
p_service_request_rec => l_service_request_rec, p_notes => l_notes_table, p_contacts => l_contacts_tab,
p_called_by_workflow => FND_API.G_FALSE,
p_workflow_process_id => NULL,
x_workflow_process_id => lx_workflow_process_id,
x_interaction_id => lx_interaction_id );

dbms_output.put_line('Return Status : ' || lx_return_status);


dbms_output.put_line('Inserted request id : ' || lx_request_id );dbms_output.put_line('Inserted request num : ' ||
lx_request_number );

IF (lx_return_status <> FND_API.G_RET_STS_SUCCESS) then


IF (FND_MSG_PUB.Count_Msg > 1) THEN
--Display all the error messages
FOR j in 1..FND_MSG_PUB.Count_Msg LOOP FND_MSG_PUB.Get( p_msg_index => j,
p_encoded => 'F', p_data => lx_msg_data, p_msg_index_out => lx_msg_index_out);
DBMS_OUTPUT.PUT_LINE(lx_msg_data);
END LOOP;
ELSE --Only one errorFND_MSG_PUB.Get(
p_msg_index => 1, p_encoded => 'F', p_data => lx_msg_data, p_msg_index_out => lx_msg_index_out);

DBMS_OUTPUT.PUT_LINE(lx_msg_data);
DBMS_OUTPUT.PUT_LINE(lx_msg_index_out);
END IF;
END IF;

exception
when others then
dbms_output.put_line('in others main ' || sqlerrm);

end;
/-- create a SR through the public API.
declare

lx_msg_count NUMBER;
lx_msg_data VARCHAR2(2000);
lx_request_id NUMBER;
lx_request_number VARCHAR2(50);
lx_interaction_id NUMBER;
lx_workflow_process_id NUMBER;
lx_msg_index_out NUMBER;
lx_return_status VARCHAR2(1);

l_service_request_rec CS_ServiceRequest_PUB.service_request_rec_type;
l_notes_table CS_SERVICEREQUEST_PUB.notes_table;
l_contacts_tab CS_SERVICEREQUEST_PUB.contacts_table;

begin

-- Populate the SR Record type

l_service_request_rec.request_date := to_date('30-AUG-2002 16:27:34', 'dd-MON-YYYY


HH24:MI:SS');l_service_request_rec.type_id := 106;
l_service_request_rec.status_id := 1;
l_service_request_rec.severity_id := 4;
l_service_request_rec.summary := 'TEST';
l_service_request_rec.caller_type := 'ORGANIZATION';
l_service_request_rec.customer_id := <CUSTOMER_ID>;

l_contacts_tab(1).party_id := <PARTY_ID>; l_contacts_tab(1).contact_point_id :=<PARTY_ID> ;


l_contacts_tab(1).CONTACT_POINT_TYPE := 'EMAIL';
l_contacts_tab(1).PRIMARY_FLAG := 'Y';
l_contacts_tab(1).CONTACT_TYPE := 'PARTY_RELATIONSHIP';

dbms_output.put_line('before calling public sr');

cs_servicerequest_pub.Create_ServiceRequest (
p_api_version => 2.0,
p_init_msg_list => FND_API.G_TRUE, p_commit => FND_API.G_FALSE,
x_return_status => lx_return_status, x_msg_count => lx_msg_count,
x_msg_data => lx_msg_data, p_resp_appl_id => NULL,
p_resp_id=> NULL, p_user_id => <USER_ID>, p_login_id => NULL,
--p_org_id => <ORG_ID>,
p_request_id => NULL,
p_request_number => NULL, p_service_request_rec => l_service_request_rec,
p_notes => l_notes_table,
p_contacts => l_contacts_tab, x_request_id => lx_request_id, x_request_number => lx_request_number,
x_interaction_id => lx_interaction_id,
x_workflow_process_id => lx_workflow_process_id );
dbms_output.put_line('Return Status : ' || lx_return_status);
dbms_output.put_line('Inserted request id: ' || lx_request_id );
dbms_output.put_line('Inserted request num : ' || lx_request_number );

IF (lx_return_status <> FND_API.G_RET_STS_SUCCESS) then IF (FND_MSG_PUB.Count_Msg > 1) THEN


--Display all the error messages
FOR j in 1..FND_MSG_PUB.Count_Msg LOOP
FND_MSG_PUB.Get( p_msg_index => j,
p_encoded => 'F', p_data => lx_msg_data,
p_msg_index_out => lx_msg_index_out);

DBMS_OUTPUT.PUT_LINE(lx_msg_data);
END LOOP;
ELSE
--Only one error FND_MSG_PUB.Get( p_msg_index => 1,
p_encoded => 'F',
p_data => lx_msg_data,
p_msg_index_out => lx_msg_index_out);DBMS_OUTPUT.PUT_LINE(lx_msg_data);
DBMS_OUTPUT.PUT_LINE(lx_msg_index_out);
END IF;
END IF;

exception
when others thendbms_output.put_line('in others main ' || sqlerrm);

end;
/

Didn't find what you are looking for?

You might also like