Using Oracle Bill of Material Business Object Using API (文檔 ID 136095.1)

摘自ONT:https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=161794373410060&id=136095.1&displayIndex=9&_afrWindowMode=0&_adf.ctrl-state=eunr15r2x_121#FIX

Using Oracle Bill of Material Business Object Using API (文檔 ID 136095.1) 轉到底部轉到底部

APPLIES TO:

Oracle Bills of Material - Version 11.5.10.2 and later
Information in this document applies to any platform.

GOAL

PURPOSE
-------

To explain how to enter data into Oracle Bills Of Material by
means of the Application Programming Interface (API).

SCOPE & APPLICATION
-------------------

This document gives guidance,with the help of a example, on how
to use an API, and explains also how an API is constructed and
what the various components are.

SOLUTION



CONTENT
-------

1. General Introduction
2. Application Programming Interface (API) Layout
3. What is a table of records?
4. Example

1. General Introduction
-----------------------

   The Business Object API framework is designed to provide flexible 
   usage, but with a unified programming style. Business Object APIs 
   can be called from Oracle Forms, Business Object interfaces, 
   Web-based applications, PL/SQL programs, and almost all calls that 
   support PL/SQL calls to Oracle RDBMS. They perform a complete
   transaction on a business object, and always leave the database in 
   a consistent state, regardless of the outcome of the transaction.

2. Applicaton Programming Interface (API) Layout
-------------------------------------------------

   APIs are held as PL/SQL packages in the database, and are delivered
   by SQL scripts which are held on the server in the admin/sql 
   directories under each product, or patch/115/sql if patched after 
   the base install. The scripts come as separate header and body files. 
   For a description of the API including a list of the parameters, 
   you can refer to the header. 
  
   Example of an API
 
        PROCEDURE Process_Bom
        (  p_bo_identifier           IN  VARCHAR2 := 'BOM'
         , p_api_version_number      IN  NUMBER := 1.0
         , p_init_msg_list           IN  BOOLEAN := FALSE
         , p_bom_header_rec          IN  Bom_Bo_Pub.Bom_Head_Rec_Type :=
                                         Bom_Bo_Pub.G_MISS_BOM_HEADER_REC
         , p_bom_revision_tbl        IN  Bom_Bo_Pub.Bom_Revision_Tbl_Type :=
                                         Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL
         , p_bom_component_tbl       IN  Bom_Bo_Pub.Bom_Comps_Tbl_Type :=
                                         Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL
         , p_bom_ref_designator_tbl  IN  Bom_Bo_Pub.Bom_Ref_Designator_Tbl_type
                                      := Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL
         , p_bom_sub_component_tbl   IN  Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
                                      := Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL
         , x_bom_header_rec          OUT Bom_Bo_Pub.bom_Head_Rec_Type
         , x_bom_revision_tbl        OUT Bom_Bo_Pub.Bom_Revision_Tbl_Type
         , x_bom_component_tbl       OUT Bom_Bo_pub.Bom_Comps_Tbl_Type
         , x_bom_ref_designator_tbl  OUT Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
         , x_bom_sub_component_tbl   OUT Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
         , x_return_status           OUT VARCHAR2
         , x_msg_count               OUT NUMBER
         , p_debug                   IN  VARCHAR2 := 'N'
         , p_output_dir              IN  VARCHAR2 := USERENV('APPLPTMP')
         , p_debug_filename          IN  VARCHAR2 := 'BOM_BO_debug.log'
         );

     As can be seen above, each API has several parameters. Some are 
     control parameters which affect the processing logic, but most  
     map onto a database column and are either passed to the API as an 
     IN parameter, or automatically generated as an OUT parameter

3. What is a table of records?
------------------------------

    A table of records is a new feature added in PL/SQL v2.3.  It is 
    the equivalent of a database table in memory.  If you structure 
    the PL/SQL table of records with a primary key (an index) you can 
    have array-like access to the rows.  Table of records differ from 
    arrays in that they are not bound by a fixed lower or higher limit.  
    Nor do they require consecutive index numbers as arrays do. Consult 
    a PL/SQL reference manual (version 2.3 or higher) for further 
    explanation.  There are three steps involved in creating a table of 
    records.  
    The are:

       1. Declare a record type that the table is going to contain.

          TYPE Bom_Sub_Component_Rec_Type IS RECORD
          (   Organization_Code             VARCHAR2(3)  := FND_API.G_MISS_CHAR
           ,   Assembly_Item_Name            VARCHAR2(81) := FND_API.G_MISS_CHAR
          ,   Start_Effective_Date          DATE         := FND_API.G_MISS_DATE
          ,   Operation_Sequence_Number     NUMBER       := FND_API.G_MISS_NUM
          ,   Component_Item_Name           VARCHAR2(81) := FND_API.G_MISS_CHAR
          ,   Alternate_BOM_Code            VARCHAR2(10) := FND_API.G_MISS_CHAR
          ,   Substitute_Component_Name     VARCHAR2(81) := FND_API.G_MISS_CHAR
          ,   Substitute_Item_Quantity      NUMBER       := FND_API.G_MISS_NUM
          ,   Attribute_category            VARCHAR2(30) := FND_API.G_MISS_CHAR
          ,   Attribute1                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute2                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute4                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute5                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute6                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute8                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute9                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute10                   VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute12                   VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute13                   VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute14                   VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute15                   VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   program_id                    NUMBER       := FND_API.G_MISS_NUM
          ,   Attribute3                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute7                    VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Attribute11                   VARCHAR2(150):= FND_API.G_MISS_CHAR
          ,   Original_System_Reference     VARCHAR2(50) := FND_API.G_MISS_CHAR
          ,   Return_Status                 VARCHAR2(1)  := FND_API.G_MISS_CHAR
          ,   Transaction_Type              VARCHAR2(30) := FND_API.G_MISS_CHAR
          );

       2. Declare a new type for the table of record.

          TYPE Bom_Sub_Component_Tbl_Type  IS TABLE OF Bom_Sub_Component_Rec_Type
              INDEX BY BINARY_INTEGER;

       3. Finally, declare a  variable using the new type.


          l_bom_sub_component_tbl    Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type

4. Example
----------

  Please refer to Note 136099.1 for an example.

 

REFERENCES

NOTE:136099.1 - How To Use Bill Of Material Business Object API - An Example

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章