Wednesday, June 30, 2010

API Parameters


Overview


1) The Application Programming Interface or API is a PL/SQL packaged procedure which can be used as an alternative entry point into the system to the traditional online forms

2) The advantage being that the same logic used by the seeded online forms can also be used by other interfaces into the system, thus ensuring that the integrity of the data remains intact

Calling API

1) Ensure it is appropriate to allow that particular business operation

2) Validate the data passed to the API

3) Each API has a number of parameters, most of them mapped with DB column. Every parameter name starts with p_. If the parameter maps onto a database column, the remaining part of the name is usually the same as the column name

4) When calling the APIs, it is strongly recommended that you use Named Notation, instead of Positional Notation

Standard IN Parameters

1) p_api_version IN NUMBER
This must match the version number of the API. An unexpected error is returned if the calling program version number is incompatible with the current API version number

2) p_init_msg_list IN VARCHAR2
The valid values for this parameter are:
• True = FND_API.G_TRUE
• False = FND_API.G_FALSE
• Default = FND_API.G_FALSE
If set to true, then the API makes a call to fnd_msg_pub.initialize to initialize the message stack. To set to true, use the value, "T". If set to false then the calling program must initialize the message stack. This action is required to be performed only once, even in the case where more
than one API is called. To set to false, use the value, "F".

3) p_commit IN VARCHAR2
The valid values for this parameter are:
• True = FND_API.G_TRUE
• False = FND_API.G_FALSE
• Default = FND_API.G_FALSE
If set to true, then the API commits before returning to the calling program. To set to true, use the value, "T". If set to false, then it is the calling program’s responsibility to commit the transaction. To set to false, use the value, "F".

Standard OUT Parameters

1) x_return_status OUT NOCOPY VARCHAR2
Indicates the return status of the API. The values returned are one of the following:
• FND_API.G_RET_STS_SUCCESS
Success: Indicates the API call was successful
• FND_API.G_RET_STS_ERROR
Expected Error: There is a validation error, or missing data error.
• FND_API.G_RET_STS_UNEXP_ERROR
Unexpected Error: The calling program can not correct the error.

2) x_msg_count OUT NOCOPY NUMBER
Holds the number of messages in the message list.

3) x_msg_data OUT NOCOPY VARCHAR2
Holds the encoded message if x_msg_count is equal to one

6 comments:

  1. Hi Amit,

    Can you pls post more ?

    Regards,
    Raj

    ReplyDelete
  2. Hi Amit,

    Thanks for sharing your valuable knowledge to us

    Simply understand every one.

    Thanks & Regards,
    V.Anjan

    ReplyDelete
  3. Good information on overview of API and how to call API in function.Well illustrated.

    sap upgrade ecc 6.0

    ReplyDelete
  4. APK OI: Download the latest free software, apps , games for Android.
    apk

    ReplyDelete
  5. Amit how to debug further with FND_API.G_RET_STS_UNEXP_ERROR retuns_status as U. that too with seeded API calls..

    ReplyDelete
  6. Very Interesting and wonderfull information keep sharing
    wifikill apk

    ReplyDelete

Note: Only a member of this blog may post a comment.