Talk:Scripts
From Oracle FAQ
API ERROR
Deer All
I Get this error when run API
Error
1. ORA-30678: too many open connections ORA-06512: at "SYS.UTL_TCP", line 28 ORA-06512: at "SYS.UTL_TCP", line 257 ORA-06512: at "SYS.UTL_SMTP", line 116 ORA-06512: at "SYS.UTL_SMTP", line 139 ORA-06512: at "APPS.SEND_MAIL", line 12 ORA-06512: in Package EAM
API scriprt
DECLARE
g_return_status VARCHAR2 (1 BYTE);
g_msg_count NUMBER;
g_msg_data VARCHAR2 (2000 BYTE);
g_object_id NUMBER;
--------
v_org_id number := 696 ;
v_loc_id number;
v_item_id number;
v_dep_id number;
msg varchar2(32000);
CURSOR ASSET_CUR IS
SELECT *
FROM xx_ASSET_num
WHERE SEQ BETWEEN 3 AND 50 ;
begin
fnd_global.apps_initialize ( user_id => 5120,
resp_id => 23118,
resp_appl_id => 426 );
for I in ASSET_CUR
loop
msg:=null;
begin
SELECT msi.INVENTORY_ITEM_ID into v_item_id
FROM mtl_system_items_b msi
WHERE msi.segment1 =I.ITEM_SEG1
and msi.ORGANIZATION_ID = v_org_id ;
exception when others then
msg:=msg||' Item Not Found ';
end ;
begin
select bd.DEPARTMENT_ID into v_dep_id
from bom_departments bd
where bd.DEPARTMENT_CODE = I.OWNING_DEPARTMENT_CODE
and ORGANIZATION_ID= v_org_id;
exception when others then
msg:=msg||' Owning Department Not Found ';
end;
if msg is null then
EAM_ASSETNUMBER_PUB .INSERT_ASSET_NUMBER
(
p_api_version => 1.0,
p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_false,
p_validation_level => fnd_api.g_valid_level_full,
x_return_status => g_return_status,
x_msg_count => g_msg_count,
x_msg_data => g_msg_data,
x_object_id => g_object_id,
p_INVENTORY_ITEM_ID => v_item_id ,
p_SERIAL_NUMBER => I.Asset_Number ,
p_CURRENT_STATUS => 3 ,
p_DESCRIPTIVE_TEXT => I.DESCRIPTIVE_TEXT,
p_CURRENT_ORGANIZATION_ID => 696,
p_ATTRIBUTE4 => 'YES' ,
p_WIP_ACCOUNTING_CLASS_CODE => 'UFMCO' ,
p_MAINTAINABLE_FLAG => 'Y',
p_OWNING_DEPARTMENT_ID => v_dep_id ,
p_EAM_LOCATION_ID => I.EAM_LOCATION_ID
);
DBMS_OUTPUT.put_line ('Asset Number Status' || ' ' || g_return_status);
DBMS_OUTPUT.put_line ('Error Message' || g_msg_data);
DBMS_OUTPUT.put_line ('Message' || g_msg_count);
IF g_msg_count >0 THEN
FOR I IN 1..g_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded =>FND_API.G_FALSE ), 1, 255));
END LOOP;
end if;
end if ;
end loop ;
--------------------------- update source table ----------------------------
--update xx_ASSET_num AST
-- set AST.FLAG = 'Y'
-- where AST.ASSET_NUMBER = I.ASSET_NUMBER ;
end ;
/
-- This procedure is used to insert records in ----- inv.MTL_SERIAL_NUMBERS ----- table -- EAM_ASSETNUMBER_PUB
thanks
- -------------------
- Wiki is not the place to post a question but new page or comment on page.
- Try to post it on Forum: http://www.orafaq.com/forum/i/102589/ without forget to before read OraFAQ Forum Guide (http://www.orafaq.com/forum/t/88153/0/) and "How to use [code] tags" topic (http://www.orafaq.com/forum/t/171557/102589/) and make your code easier to read.
- Michel Cadot (talk) 17:39, 21 May 2013 (CEST)
