laujar bevley justine

0 views
Skip to first unread message

Ronna Bordelon

unread,
Aug 4, 2024, 1:26:45 AM8/4/24
to ticksecarcia

How to Call Standard API Packages from Custom Form or Reports in Oracle EBS R12

Oracle E-Business Suite (EBS) R12 is a comprehensive enterprise resource planning (ERP) system that provides a wide range of business applications and tools. One of the features of Oracle EBS R12 is the ability to use standard API packages to perform common tasks and operations on the data stored in the database.

API packages are collections of procedures and functions that encapsulate the business logic and rules of the application modules. They provide a consistent and secure way to access and manipulate the data without having to write complex SQL statements or PL/SQL code. API packages also ensure that the data integrity and validation are maintained across the system.

In some cases, you may need to call standard API packages from your custom form or reports to perform some specific actions or calculations on the data. For example, you may want to create or update an invoice, validate a customer, or calculate a tax amount using the standard API packages provided by Oracle EBS R12.

To call standard API packages from your custom form or reports, you need to follow these steps:

    • Identify the API package that you want to use. You can find the documentation and reference of the standard API packages in the Oracle E-Business Suite Developer's Guide or in the online help of the application module.
    • Import the API package into your custom form or report. You can use the import statement in Forms Builder or Reports Builder to import the package specification into your form or report module. Alternatively, you can use the execute immediate statement in PL/SQL to dynamically execute the package specification at runtime.
    • Declare and initialize the parameters and variables that you need to pass to or receive from the API package. You can use the declare statement in PL/SQL to declare local variables and constants in your form or report module. You can also use the set_item_property or get_item_property built-in functions in Forms Builder or the bind_variable or lexical_reference built-in functions in Reports Builder to assign or retrieve values from form or report items.
    • Call the API package procedure or function using the call statement in PL/SQL. You need to specify the package name, the procedure or function name, and the parameters and variables that you want to pass to or receive from the API package. You can also use the return statement in PL/SQL to return a value from a function call.
    • Handle any exceptions or errors that may occur during the API package call. You can use the exception section in PL/SQL to catch and handle any predefined or user-defined exceptions that may be raised by the API package. You can also use the dbms_output.put_line procedure or the alert built-in function in Forms Builder or Reports Builder to display any messages or errors to the user.

    The following example shows how to call a standard API package from a custom form in Oracle EBS R12. The example uses the AHZ_INVOICE_PUB.CREATE_INVOICE procedure from the Oracle Receivables (AR) module to create an invoice for a customer.

    -- Import the AHZ_INVOICE_PUB package
    import AHZ_INVOICE_PUB;
    -- Declare and initialize parameters and variables
    declare
    v_invoice_id number;
    v_return_status varchar2(1);
    v_msg_count number;
    v_msg_data varchar2(2000);
    begin
    -- Assign values from form items
    set_item_property('customer_id', v_customer_id);
    set_item_property('invoice_number', v_invoice_number);
    set_item_property('invoice_date', v_invoice_date);
    set_item_property('invoice_amount', v_invoice_amount);
    -- Call AHZ_INVOICE_PUB.CREATE_INVOICE procedure
    call AHZ_INVOICE_PUB.CREATE_INVOICE(
    p_api_version_number => 1.0,
    p_init_msg_list => fnd_api.g_true,
    p_commit => fnd_api.g_false,
    x_return_status => v_return_status,
    x_msg_count => v_msg_count,
    x_msg_data => v_msg_data,
    x_invoice_id => v_invoice_id,
    p_customer_id => v_customer 51082c0ec5
    Reply all
    Reply to author
    Forward
    0 new messages