/SAPAPO/CL_EXM_IM_PDEM_DEM_CAT - Example Implementation for BAdI /SAPAPO/PDEM_DEM_CAT

rdisp/max_wprun_time - Maximum work process run time   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Functionality

In this example implementation the logic for determining custom demand categories is realized. The systemchecks the sales order items that are contained within the import parameter IS_DATA_STRUCTURE againstthe search criteria defined in the database table /SAPAPO/PDEMCAT and then determines a demand category for these sales order items.

The main method in this class is GET_DEMAND_CATEGORY, in which a demand category is determined. Within this method the system calls the following methods:

  • INITIALIZATION: In this method, the search criteria defined in the database table /SAPAPO/PDEMCAT and the semantic mappings are prepared based on a DataSource.
  • INITIALIZATION_OLD: In this method the search criteria defined in the database table /SAPAPO/PDEMCAT and the semantic mappings are prepared based on an InfoSource.
  • GET_DATA_ELEMENT: This method returns a data element of a field in the structure IS_DATA_STRUCTURE.
  • GET_AN_FIELD_VALUE_FROM_STRU: This method returns a value of a field in the structure IS_DATA_STRUCTURE.

Definition of Search Criteria

You must have specified the search criteria in the database table /SAPAPO/PDEMCAT. This table contains the following fields:

  • Client

  • Customer Number

  • Item Transaction Type

  • Indicator: Abnormal Demand

  • Demand Category

How you define the search criteria depends on the logic in the method GET_DEMAND_CATEGORY.

For the default demand category NONE, the table must be filled out as follows:

  • Customer Number: SPACE
  • Item Transaction Type: SPACE
  • Indicator: Abnormal Demand: SPACE
  • Demand Category: NONE

Other search criteria can be added according to the logic in the method GET_DEMAND_CATEGORY.

INITIALIZATION

  1. This method transfers the contents of the table /SAPAPO/PDEMCAT to the buffer table MT_FC_COMM_STRUC.
  2. This method determines the corresponding semantics, field names, data elements etc., based on the import parameter IV_DATASOURCE_NAME, and saves them in the buffer table MT_FC_COMM_STRUC.

INITIALIZATION_OLD

  1. This method transfers the contents from the table /SAPAPO/PDEMCAT to the buffer table MT_FC_COMM_STRUC.
  2. The method determines the corresponding semantics, InfoObject names, data elements, etc., based on the import parameter IV_INFOSOURCE_NAME, and saves them in the buffer table MT_FC_COMM_STRUC.

GET_DATA_ELEMENT

This method determines a data element according the semantics in the buffer table MT_FC_COMM_STRUC.

GET_AN_FIELD_VALUE_FROM_STRU

This method determines a value based on the semantics in the structure IS_DATA_STRUCTURE.

GET_DEMAND_CATEGORY

This method runs the following logic and defines which of the demand categories defined in the table /SAPAPO/PDEMCAT the system is to assign to a sales order item:

  1. The system checks whether the import parameters are correctly filled. Only IV_DATASOURCE_NAME or IV_INFOSOURCE_NAME can be filled; but not both together.
  2. If it is has not already been called, the system calls either the method INITIALIZATION or INITIALIZATION_OLD.
  3. The system checks whether the values of the following data fields from the data structure IS_DATA_STRUCTURE in the table MT_DEMAND_CATEGORY agree with an entry in the table MT_DEMAND_CATEGORY :
  • Customer Number

  • Item Transaction Type

  • Indicator: Abnormal Demand

If this is the case, then the system uses the demand category that was specified in this entry.
In other cases, the system continues with step 4.
  1. The system checks the data in the structure IS_DATA_STRUCTURE in the table MT_DEMAND_CATEGORY as towhether it agrees with the combination of two of the above mentioned data fields. That is, the system checks whether an entry in the table MT_DEMAND_CATEGORY agrees with one of the following combinations:
  • Item Transaction Typeand Indicator: Abnormal Demand

  • Customer Number and Item Transaction Type

  • Customer Numberand Indicator: Abnormal Demand

If this is the case, the system uses the demand category that you have defined for this entry in the table MT_DEMAND_CATEGORY.
In other cases, the system continues with step 5.
  1. The system checks the data in the structure IS_DATA_STRUCTURE in the table MT_DEMAND_CATEGORY in theIndicator: Abnormal Demand data field. If this indicator is set, then thesystem uses the corresponding demand category that is defined in the search criteria for this instance.If the indicator is not set, the system assigns the demand category 'NONE' to the sales order item.(This is, as described above, the default demand category for the combination CustomerNumber = SPACE, Item Transaction Type= SPACE, Indicator: Abnormal Demand = SPACE).
  2. If the system does not find a demand category, it triggers an exception.

Relationships

Example

Notes

Further information

For more information see the description of the Business Add-Ins (BAdI) /SAPAPO/PDEM_DEM_CAT and the description of the method

GET_DEMAND_CATEGORY


Addresses (Business Address Services)   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.


Length: 6975 Date: 20120526 Time: 070736     triton ( 224 ms )