You are on page 1of 3

9/14/2014 TCA Create Location API | ALL ORACLE APPS

http://alloracleapps.com/oracle_apps/tca-create-location-api/ 1/3
ALL ORACLE APPS
All Oracle Apps
TCA Create Location API
Create Location API
Name of the API : CREATE LOCATION API
Base Tables Aected : HZ_LOCATIONS
PL/SQL Procedure used : CREATE_LOCATION
Package Used : HZ_LOCATION_V2PUB
Mandatory Parameters :
Parameter Name Parameter Type Data Type
p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE
p_location_rec IN LOCATION_REC_TYPE
x_location_id OUT NUMBER
x_return_status OUT VARCHAR2
x_msg_count OUT NUMBER
x_msg_data OUT VARCHAR2
Procedure:
General Tips for Running the Create Location API:
a) Save the API in a script le and then run the script from the SQL Prompt (Example : RUN createloc.sql)
1
2
3
4
5
6
7
8
PROCEDURE create_location (
p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
p_location_rec IN LOCATION_REC_TYPE ,
x_location_id OUT NUMBER ,
x_return_status OUT VARCHAR2 ,
x_msg_count OUT NUMBER ,
x_msg_data OUT VARCHAR2
);
PgSQL
9/14/2014 TCA Create Location API | ALL ORACLE APPS
http://alloracleapps.com/oracle_apps/tca-create-location-api/ 2/3
b) Enter the values for the Parameters from inside the script le itself unless it is required to Enter some
value from the SQL Prompt
c) Set the organization id before running the script as :
EXEC fnd_client_info.set_org_context(<orgid>); for 11i
OR For R12
EXEC mo_global.init (AR);
EXEC mo_global.set_org_context(<org_id>, NULL, AR);
EXEC fnd_global.set_nls_context(AMERICAN);
EXEC mo_global.set_policy_context(S, <org_id>);
d) Ensure that the Prole Option Default Country is Set to <Country Name>
Example For Running a Create Location API:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
DECLARE
P_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
X_location_id NUMBER;
X_return_status VARCHAR2(2000);
X_msg_count NUMBER;
X_msg_data VARCHAR2(2000);
BEGIN
p_location_rec.country := 'US';
p_location_rec.address1 := '1229';
p_location_rec.address2 := 'South Harlem Ave';
p_location_rec.city := 'Berwyn';
p_location_rec.postal_code := '60169';
p_location_rec.state := 'IL';
p_location_rec.created_by_module := 'TCA_V2_API';
hz_location_v2pub.create_location(
p_init_msg_list => 'T' ,
p_location_rec => p_location_rec ,
x_location_id => x_location_id ,
x_return_status => x_return_status ,
x_msg_count => x_msg_count ,
x_msg_data => x_msg_data
);
dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255));
dbms_output.put_line('x_msg_count = ' ||TO_CHAR(x_msg_count));
dbms_output.put_line('Location Id = ' ||TO_CHAR(x_location_id));
dbms_output.put_line('Country = ' || SUBSTR(p_location_rec.country,1,255));
dbms_output.put_line('Address1 = ' || SUBSTR(p_location_rec.Address1,1,255));
dbms_output.put_line('State = ' || SUBSTR(p_location_rec.state,1,255));
dbms_output.put_line('Created By = ' || SUBSTR(p_location_rec.created_by_module,1,255));
dbms_output.put_line('x_msg_data = ' || SUBSTR(x_msg_data,1,255));
dbms_output.put_line('x_location_id = '||x_location_id );
IF x_msg_count > 1
THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'.'||SUBSTR( FND_MSG_PUB.Get(
p_encoded => FND_API.G_FALSE
PgSQL
9/14/2014 TCA Create Location API | ALL ORACLE APPS
http://alloracleapps.com/oracle_apps/tca-create-location-api/ 3/3
Party Site Use API FNDLOAD
Commands
Create Contact
Point API
Create Class
Category API
Update Customer
Prole API
Script To Verify whether the Create Location API is successful:
SELECT address1,
address2,
county ,
object_version_number
FROM hz_locations
WHERE location_id = 29266;
+96

Related posts:
This entry was posted in API's/Interfaces, Apps Technical, Oracle Apps, Scripts on April 10, 2013
[http://alloracleapps.com/oracle_apps/tca-create-location-api/] by All Oracle Apps.
38
39
40
41
42
43
44
45
46
47
48
,1, 255
)
);
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('Error: '||SQLERRM);

END;
0 Like