Ansicht
Dokumentation

WRB_BADI_001 - Extend Entity iView to Include More Types

WRB_BADI_001 - Extend Entity iView to Include More Types

ABAP Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

Business Add-In WRBX_ENTITY

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 " (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.

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_DCfor 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_INSTANCEof factory class CL_WRB_ENTITY_FACTORY creates an object of class CL_WRB_MYSITE, the attribute of which has the value &lt;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 &lt;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_SEARCHimplements. This object is used for the back end functions of the iView "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_SEARCHfor 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_FACTORYif 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.
  1. 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.

  1. Implementation of the back end functions for the iView "&lt;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.

No Customizing settings are required.

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.






TXBHW - Original Tax Base Amount in Local Currency   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 7253 Date: 20240523 Time: 214208     sap01-206 ( 98 ms )