Home » Applications » Oracle Fusion Apps & E-Business Suite » Using Update API in oracle forms
Using Update API in oracle forms [message #673965] Thu, 20 December 2018 01:06 Go to next message
faizanbutt
Messages: 10
Registered: December 2018
Junior Member
Hi All,
I want to use API in oracle forms. I have an API that updates inventory attribute columns that works fine for me in Toad.

Can someone guide me how to use API in oracle form? How to receive and reuse API response?
This is the API :

DECLARE
l_item_table EGO_Item_PUB.Item_Tbl_Type;
x_item_table EGO_Item_PUB.Item_Tbl_Type;
x_return_status VARCHAR2(1);
x_msg_count NUMBER(10);
x_msg_data VARCHAR2(1000);
x_message_list Error_Handler.Error_Tbl_Type;
BEGIN

--Apps Initialization

FND_GLOBAL.APPS_INITIALIZE(USER_ID=>15016,RESP_ID=>61194,RESP_APPL_ID=>401);

--FIRST Item definition
l_item_table(1).Transaction_Type := 'UPDATE'; -- Replace this with 'UPDATE' for update transaction.
--l_item_table(1).Segment1 := 'TESTAPEXITEM';
l_item_table (1).inventory_item_id := 3688264;
l_item_table(1).ATTRIBUTE_CATEGORY := 'SFML 02';
l_item_table(1).ATTRIBUTE2 := 'HJGHGJHGJ54332';
--l_item_table(1).Organization_Code := 'IMO'; --masterorg
l_item_table(1).Organization_id := 87;
--l_item_table(1).Template_Name := 'BPI FINISHED GOOD-MAKE'; --template

DBMS_OUTPUT.PUT_LINE('Calling API to Create Item');

EGO_ITEM_PUB.Process_Items(
p_api_version => 1.0
,p_init_msg_list => FND_API.g_TRUE
,p_commit => FND_API.g_TRUE
,p_Item_Tbl => l_item_table
,x_Item_Tbl => x_item_table
,x_return_status => x_return_status
,x_msg_count => x_msg_count);

DBMS_OUTPUT.PUT_LINE('Sucess:');
DBMS_OUTPUT.PUT_LINE('Return Status ==>' ||x_return_status);

IF (x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
FOR i IN 1..x_item_table.COUNT LOOP
DBMS_OUTPUT.PUT_LINE('Inventory Item Id Created:'||to_char(x_item_table(i).Inventory_Item_Id));
DBMS_OUTPUT.PUT_LINE('Organization Id :'||to_char(x_item_table(i).Organization_Id));
END LOOP;
ELSE
DBMS_OUTPUT.PUT_LINE('Error Messages :');
Error_Handler.GET_MESSAGE_LIST(x_message_list=>x_message_list);
FOR i IN 1..x_message_list.COUNT LOOP
DBMS_OUTPUT.PUT_LINE(x_message_list(i).message_text);
END LOOP;
END IF;

EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error has Occured and error is '||SUBSTR(SQLERRM,1,200));
END;
Re: Using Update API in oracle forms [message #673968 is a reply to message #673965] Thu, 20 December 2018 01:13 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Also always post your Oracle version, with 4 decimals, as solution depends on it.

Re: Using Update API in oracle forms [message #673969 is a reply to message #673968] Thu, 20 December 2018 03:14 Go to previous messageGo to next message
faizanbutt
Messages: 10
Registered: December 2018
Junior Member
I am using Oracle Applications : 12.1.3. Please tell how to use the API in oracle forms. The code is below :

DECLARE
   l_item_table      EGO_Item_PUB.Item_Tbl_Type;
   x_item_table      EGO_Item_PUB.Item_Tbl_Type;
   x_return_status   VARCHAR2 (1);
   x_msg_count       NUMBER (10);
   x_msg_data        VARCHAR2 (1000);
   x_message_list    Error_Handler.Error_Tbl_Type;
BEGIN
   --Apps Initialization

   FND_GLOBAL.APPS_INITIALIZE (USER_ID        => 15016,
                               RESP_ID        => 61194,
                               RESP_APPL_ID   => 401);

   --FIRST Item definition
   l_item_table (1).Transaction_Type := 'UPDATE'; -- Replace this with 'UPDATE' for update transaction.
   --l_item_table(1).Segment1 := 'TESTAPEXITEM';
   l_item_table (1).inventory_item_id := 3688264;
   l_item_table (1).ATTRIBUTE_CATEGORY := 'SFML 02';
   l_item_table (1).ATTRIBUTE2 := 'HJGHGJHGJ54332';
   --l_item_table(1).Organization_Code := 'IMO'; --masterorg
   l_item_table (1).Organization_id := 87;
   --l_item_table(1).Template_Name := 'BPI FINISHED GOOD-MAKE'; --template

   DBMS_OUTPUT.PUT_LINE ('Calling API to Create Item');

   EGO_ITEM_PUB.Process_Items (p_api_version     => 1.0,
                               p_init_msg_list   => FND_API.g_TRUE,
                               p_commit          => FND_API.g_TRUE,
                               p_Item_Tbl        => l_item_table,
                               x_Item_Tbl        => x_item_table,
                               x_return_status   => x_return_status,
                               x_msg_count       => x_msg_count);

   DBMS_OUTPUT.PUT_LINE ('Sucess:');
   DBMS_OUTPUT.PUT_LINE ('Return Status ==>' || x_return_status);

   IF (x_return_status = FND_API.G_RET_STS_SUCCESS)
   THEN
      FOR i IN 1 .. x_item_table.COUNT
      LOOP
         DBMS_OUTPUT.PUT_LINE (
               'Inventory Item Id Created:'
            || TO_CHAR (x_item_table (i).Inventory_Item_Id));
         DBMS_OUTPUT.PUT_LINE (
            'Organization Id :' || TO_CHAR (x_item_table (i).Organization_Id));
      END LOOP;
   ELSE
      DBMS_OUTPUT.PUT_LINE ('Error Messages :');
      Error_Handler.GET_MESSAGE_LIST (x_message_list => x_message_list);

      FOR i IN 1 .. x_message_list.COUNT
      LOOP
         DBMS_OUTPUT.PUT_LINE (x_message_list (i).MESSAGE_TEXT);
      END LOOP;
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.PUT_LINE (
         'Error has Occured and error is ' || SUBSTR (SQLERRM, 1, 200));
END;
Re: Using Update API in oracle forms [message #673974 is a reply to message #673969] Thu, 20 December 2018 05:24 Go to previous messageGo to next message
cookiemonster
Messages: 13958
Registered: September 2008
Location: Rainy Manchester
Senior Member
Most of us here don't use Oracle Applications so have no idea what this API does, what parameters it accepts and what it returns.

Nor do we know what exact problem you are encountering.

If you want any chance of help from us you'll need to tell us those things, however you may be better off in an actual oracle apps forum
Re: Using Update API in oracle forms [message #673975 is a reply to message #673974] Thu, 20 December 2018 06:05 Go to previous message
faizanbutt
Messages: 10
Registered: December 2018
Junior Member
Thanks for replying.
Previous Topic: PO_NOTES replacement in R12.1.3
Next Topic: FNDLOAD for MENU Downloading all the Menus
Goto Forum:
  


Current Time: Thu Nov 21 08:56:25 CST 2024