SAP ABAP IMG Activity WRB_BADI_001 (Extend Entity iView to Include More Types)
Hierarchy
SAP_APPL (Software Component) Logistics and Accounting
   MM-PUR (Application Component) Purchasing
     WRB (Package) Retail Buying
IMG Activity
ID WRB_BADI_001 Extend Entity iView to Include More Types  
Transaction Code S_AX8_68000368   IMG Activity: WRB_BADI_001 
Created on 20030124    
Customizing Attributes WRB_BADI_001   Extend Entity iView to Include More Types 
Customizing Activity WRB_BADI_001   Extend Entity iView to Include More Types 
Document
Document Class SIMG   Hypertext: Object Class - Class to which a document belongs.
Document Name WRBX_ENTITY    

Business Add-In WRBX_ENTITY

Use

Using the BAdI WRBX_ENTITY, you can implement the back end functionality for <Entity>-iViews for other entity types.

An entity is defined as a business management object, which you can uniquely describe using a key field and a description field. For example, an object of entity "vendor" is uniquely identified by an entry in database table LFA1 by the key field LIFNR and the description field NAME1.

The entities are used by the following iViews in the Enterprise Portal.

  • iView "My <Entities>" (Personalization dialog for entities)

    From this iView, the following function modules are called using SAP Java Connector to construct the personalization dialog.

    • WRB_RFC_ENTITY_GET_DESCRS
    • WRB_RFC_ENTITY_GET_HIERARCHY
    • WRB_RFC_ENTITY_GET_LIST
  • iView "<Entity>Single Search" (entity search dialog with the option to select an entity)

    Module WRB_RFC_ENTITY_SEARCH is called from this iView using the SAP Java Connector. This module performs the search in the relevant database tables according to the user entries and returns the search results for selection in the iView.

For more information on the function modules, see the documentation for function modules, which you can access using transaction SE37.

Requirements

Entity Type

The BAdI is filter-dependent, which means there can be several implementations of the BAdI. This means that different entity types can be implemented using the BAdI.

The entity type is used as the filter value of the BAdI. The entity type determines which entity object is instantiated by the BAdI.

An example of an entity type is the distribution center. The entity type (data element WRB_ENTITY_TYPE) has the value C_ENTITY_TYPE_SITE_DC for the distribution center defined in interface IF_WRB_CONSTANTS and is needed to create a corresponding object.

Depending on this entity type, a factory class (class that creates objects) can create the required object.

For the example of the distribution center, method CREATE_MYENTITY_INSTANCE of factory class CL_WRB_ENTITY_FACTORY creates an object of class CL_WRB_MYSITE, the attribute of which has the value <AB>IF_WRB_CONSTANTS=>C_SITE_TYPE_DC for the plant type SITE_TYPE.

To implement a BAdI, you need to define an entity type. The values for entity types are defined as fixed values of domain WRB_ENTITY_TYPE .

The defined entity type is used as a filter value for the BAdI and ensures that the relevant BAdI implementation will run.

BAdI Methods

The methods of the BAdI are factory methods, which means they create object instances of other classes.

  • CREATE_MYENTITY_INSTANCE

    Creates an object that the interface IF_WRB_MYENTITY implements. This object is used for the back end functions of the iView "My <Entities>".

    It provides methods for authorization checks and read methods that are used to display the entities in the personalization dialog. These methods are called in the function module for the iView "My<Entities>" mentioned above.

  • CREATE_ENTITY_SEARCH_INSTANCE

    Creates an object that the interface IF_WRB_ENTITY_SEARCH implements. This object is used for the back end functions of the iView "<Entities>Single Search".

    It provides methods for authorization checks and read methods that are used to display the entities in the entity search dialog. These methods are called in function module WRB_RFC_ENTITY_SEARCH for the iView "<Entities>Single Search".

The implementation of the BAdI therefore consists mainly of the development of corresponding object classes that implement the afore-mentioned interfaces.

As the BAdI provides object instances, it is called in factory class CL_WRB_ENTITY_FACTORY if an object is created, which needs to be instanced by the BAdI.

In the implemented BAdI methods, the constructors of the relevant classes are called and the created objects are returned.

For more information on the interfaces, see the documentation for interfaces, which you can access using transaction SE24

For more information on the BAdI methods, see the method documentation.

Summary of the Implementation Steps:

Carry out the following implementation steps to implement corresponding functions in the back end for the iViews mentioned above:

  1. Definition of an Entity Type:

    Choose a name for the entity type that will be used as a filter value for the BAdI. To do this, choose one of the fixed values defined in domain WRB_ENTITY_TYPE.

  2. Implementation of the back end functions for the iView "My<Entities>"
    • Implement a class that implements the interface IF_WRB_MY_ENTITY. Implement the corresponding interface methods.
    • Call the constructor defined in the class in the BAdI method CREATE_MY_ENTITY_INSTANCE and return a reference for the object created.
  3. Implementation of the back end functions for the iView "<Entity>Single Search"
    • Implement a class that implements the interface IF_WRB_ENTITY_SEARCH. Implement the corresponding interface methods.
    • Call the constructor defined in the class in the BAdI method CREATE_ENTITY_SEARCH_INSTANCE and return a reference for the object created.

Standard settings

No Customizing settings are required.

Activities

Example

An example of a BadI implementation is the class CL_EXM_IM_WRBX_ENTITY. To be able to test this example, you still need to create a BAdI implementation with the definition name WRBX_ENTITY and the name CL_EXM_IM_WRBX_ENTITYas implementing class.

After activating the BAdI you can test the implementation of the BAdI by calling the function module mentioned above.

Business Attributes
ASAP Roadmap ID 257   Create User Exits 
Mandatory / Optional 2   Optional activity 
Critical / Non-Critical 2   Non-critical 
Country-Dependency A   Valid for all countries 
Maintenance Objects
Maintenance object type E   Business Add-In - Definition 
History
Last changed by/on SAP  20030124 
SAP Release Created in 2002_1_46C