Learn ABAP BAPI basics


Before you program a BAPI you should clearly define the processes and situations the BAPI will be used for.To define the scenario the BAPI is to be used for, consider the following issues:

• Which scenario is to be implemented?

Every BAPI should be based on a model of a scenario in which it can be usefully employed. You can describe the scenario in the form of a process model.

• Which SAP Business Objects are involved?

From the scenario definition and with the help of the process model you can get information about the SAP Business Objects relevant to the BAPI scenario.

In the scenario to be implemented, a BAPI is required to read data about a creditor. First of all, a list of creditors is to be displayed from which a specific creditor can be selected. Then, using another BAPI, specific details about this creditor are to be displayed.

The relevant SAP Business Object for this scenario is Creditor.

• What functionality should the BAPI provide and how does it affect related BAPIs, especially the other BAPIs of the SAP Business Object in question?

In line with the scenario concept BAPIs must complement each other to create a complete scenario. Their relationships with each other must be clearly defined.

To read a creditor's details as described in the above scenario, two BAPIs are required:

- Display list of creditors
- Display details of a specific creditor

The interdependency between these two BAPIs is evident because first the creditor list is displayed to obtain the ID of the specific creditor sought. From this ID, details of this creditor can then be displayed.

However, the two BAPIs remain functionally independent of each other, because if the creditor ID is known, the BAPI "Display details of a specific creditor" can be used without first calling the BAPI "Display list of creditors".

• To what extent can the BAPI's functionality be implemented within the scope of the business object?

A BAPI should be developed so that it provides functionality exclusively within the context of its associated SAP Business Object. If the data of a different SAP Business Object is to be read or updated then the appropriate interface for this object must be used. The functions or methods of these other objects are used implicitly (delegation principle).

The BAPIs required to read creditor details in the above scenario are only able to access data in the SAP Business Object Creditor. Other object types are not involved.

• Is the BAPI assigned to the SAP Business Object in a meaningful and semantically correct way?

Result

Once you have considered these issues you will be able to clearly conceptualize the functionality of the planned BAPI(s). You will also have identified the SAP Business Objects relevant to the BAPI scenario.


Review

Purpose

In the previous step you created a concept for a scenario a BAPI could be applied to. You also defined relevant SAP Business Objects.

Before you implement the scenario and begin defining and developing the BAPI, you should carry out a review of the scenario concept.

Process Flow

You should carry out the review of the BAPI scenario in cooperation with all persons involved in the BAPI development and those responsible for quality control in your development group.

Result

Start developing the BAPI only after you have successfully completed the review.


Defining a BAPI and Its Interface

Purpose

After you have carried out the review of the BAPI concept and it has been accepted, you can start defining the BAPI itself.

In this step, you will decide on the names, parameters, and characteristics of the BAPI and determine the structures the BAPI will be based on.

Only after you have planned and defined these required details can you start to implement the BAPI, as described in Creating Individual Programming Objects and Programming BAPIs.

Process Flow

To define the scope and required components of the BAPI to be implemented, the following steps must be completed:

• Determining the SAP Business Object and Its Key Fields
• Defining the Interface Structure of the BAPI
• Identifying the name of the function group, or if a function group does not exist already, planning a name for one.

All BAPIs belonging to one SAP Business Object should be stored as function modules in one function group. Ascertain whether a function group has already been created for the BAPIs of the SAP Business Object in question. If a function group does not already exist, then plan a name for the one to be created.

You can use the default technical name (object type) of the SAP Business Object as the basis of the function group name. The technical name of a SAP Business Object usually takes the form of BUSnnnn, where n is a number.

Use the suffix "nnnn" as the name of the function group. For example, if the technical name of the object is BUS1008 then the associated BAPI function group is called 1008.

To ascertain the technical name of the Business Object, open the Business Object in the Business Object Repository (BOR), as described in Determining the SAP Business Object and Its Key Fields. To display further details, for example, the object type, double click the name of the Business Object.

• Assigning a name to the function module

Choose a name that gives an indication of what the BAPI is used for. The naming convention is: BAPI__. For information about naming a method refer to Naming the Method in the BOR.

For example, in the case of a BAPI which reads details for the object type Creditor, the name of the associated function module is BAPI_CREDITOR_GETDETAIL.

• Naming Parameters in the Function Module

• Defining the format for passing the values in the function module interface.
Parameters must not be converted before they are passed to and from the BAPI interface. This is because BAPIs are programming interfaces and not end user interfaces. Exceptions are currency codes, ISO codes and fields with an internal key.

• Specifying the Required Objects in ABAP Dictionary
• Naming the Method in the BOR
• Naming Parameters in the BOR

RELATED POST

SAP architecture,its full form of working and enjoy sap products

No comments :

Post a Comment