Tuesday, October 6, 2015

Technical details about CLL layer & PDO layer.

PDO Layer
PDO is short form for Procurement Document Layer. PDO layer is available in all SRM versions.  PDO layer helps developer highly to write clear and very specific SRM document level coding. PDO Layer is wrapper of BBP Functions for each SRM business transaction type like PO, Shopping Cart, etc. Each PDO layer uses specific Header, Item and other structures for the SRM business transaction.    The PDO layer level function modules execute the base associated BBP function module and map into PDO specific structure.
For each PDO object type, SRM provides a set of data structures and function modules.   These data structures are very specific to the PDO object type.  For example, PO header detail uses specific structure BBP_PDS_PO_HEADER_D for display purpose and BBP_PDS_PO_HEADER_U for update purpose.  The BBP function module uses common header detail structure BBP_PDS_HEADER for both display and update purposes.
Untitled.png
The PDO get detail FM is not using i_read_flag structure instead the flag is set based on the FM parameters are supplied. The Most of PDO GET detail FMs defaults its parameter i_with_itemdata as ‘X’.  That means it will fetch the item level even the item data is requested in the function module.  If the item data is not required then explicitly defines the parameter i_with_itemdata as blank. It is very useful tips of SRM performance tuning.  Also, try to set the parameter  I_WITHOUT_HEADER_TOTALS as blank when header total is not required.   The header total may not be part of all PDO get detail function modules.
Performance Tips
Pass i_with_itemdata as blank in BBP_PD_<BO>_GETDETAIL FM when there is no item data required.  Also, pass parameter i_without_header_totals as empty (Default is true) when there is no total at header is not required.
The PDO level function modules are listed in below table with BBP function module and PDO level function modules.   The PDO layer function module for each object types are defined in the following section.  There are a lot of PDO function modules and the table lists only important function modules.
Action
Function Module
PDO Layer
Check
BBP_PROCDOC_CHECK
BBP_PD_<BO>_CHECK
Create
BBP_PROCDOC_CREATE
BBP_PD_<BO>_CREATE
Get Detail
BBP_PROCDOC_GETDETAIL
BBP_ PD_<BO>_GETDETAIL
Get List
BBP_PROCDOC_GETLIST
BBP_ PD_<BO>_GETLIST
Item Get Detail
BBP_PROCDOC_ITEM_GETDETAIL
BBP_ PD_<BO>_ITEM_GETDETAIL
Lock
BBP_PROCDOC_LOCK
BBP_ PD_<BO>_LOCK
Save
BBP_PROCDOC_SAVE
BBP_ PD_<BO>_SAVE
Unlock
BBP_PROCDOC_UNLOCK
BBP_ PD_<BO>_UNLOCK
The standard naming convention is used for PDO Function and it is defined as follows:
BBP_PD_<BO>_GETDETAIL.  Possible <BO>s
BO
Description
AUC
Auction
AVL
Supplier List
BID
Bid Invitation (RFx)
CONF
Confirmation
CTR
Contract
INV
Invoice
PCO
PO Confirmation
PO
Purchase Order
QUOT
Quotation
SC
Shopping Cart
SUSASN
SUS Advance Notification
SUSCF
SUS Confirmation
SUSINV
SUS Invoice
SUSPCO
SUS PO Confirmation
SUSPO
SUS Purchase Order
Note for performance tuning, support package (give package info) uses BORF concept to get detail instead of BBP function. SAP recommends uses PDO layer instead of BBP get details information.
Channel Logic Layer
The Channel Logic Layer is a wrapper on PDO Layer based on the ABAP objects.  CLL layer is not available at SRM 5 versions. CLL Layer prepares the business data for UI Layer and do specific operation of the SRM business object.   The following are type of objects is available in CLL.
  • Business Object (BO) - Business object represents business contents, for example, PO or Shopping Cart. It has all basic operations on the SRM document.
  • Dependent Object (DO) - Dependent Object is associated business contents like Account Assignment and Exchange Rate.
  • Mapper Object – Mapper object is used to map between UI screens and business data.
Business Objects
The business object is based on ABAP class object. The business object implements the interface classes like /SAPSRM/IF_PDO_BASE and its PDO business object level interfaces.  The methods of PDO_BASE interface refers to basic business operations on the SRM document. The table lists the interface classes for each SRM business object. Note that objects suffixed with _ADV refer the object with workflow.
SRM BO
Interface Class
Auction
/SAPSRM/IF_PDO_BO_AUC
Contract
/SAPSRM/IF_PDO_BO_CTR_ADV
PO
/SAPSRM/IF_PDO_BO_PO_ADV
Quote
/SAPSRM/IF_PDO_BO_QTE_ADV
Bid Invitation
/SAPSRM/IF_PDO_BO_RFQ_ADV
Shopping Cart
/SAPSRM/IF_PDO_BO_SC_ADV
The following table lists the implemented ABAP class for the SRM business objects.  
SRM BO
Implemented Class
Auction
/SAPSRM/CL_PDO_BO_AUC
Contract
/SAPSRM/CL_PDO_BO_CTR_ADV
PO
/SAPSRM/CL_PDO_BO_PO_ADV
Quote
/SAPSRM/CL_PDO_BO_QTE_ADV
Bid Invitation
/SAPSRM/CL_PDO_BO_RFQ_ADV
Shopping Cart
/SAPSRM/CL_PDO_BO_SC
Note that PO object has two implemented classes with and without workflow viz., /SAPSRM/CL_PDO_BO_PO_ADV and /SAPSRM/CL_PDO_BO_PO.
Factory Objects for SRM BO
Factory Objects are static objects where the object instances are stored in the buffer.  This is very useful ABAP Objects. Object instances are buffered and reduce the database accesses.  It increases performance.  All the factory objects have three major methods: get_instance, get_buffered_instance and create_new_instance. 
Method
Description
GET_INSTANCE
Get instance from buffer.  If not, get instance from database.  It will add to buffered instance.
GET_BUFFERED_INSTANCE
Get instance from buffer.  If not, return nothing.
GET_NEW_INSTANCE
Destroy instance from buffer if any and create new instance and add it to buffered instance.
CREATE_NEW_INSTANCE
Create new instance.
The following factor classes are listed in the following table.
Business Object
Factory Class
Auction
/SAPSRM/CL_PDO_FACTORY_AUC
Contract
/SAPSRM/CL_PDO_FACTORY_CTR_ADV
PO
/SAPSRM/CL_PDO_FACTORY_PO_ADV
Quote
/SAPSRM/CL_PDO_FACTORY_QTE_ADV
Bid Invitation
/SAPSRM/CL_PDO_FACTORY_RFQ
Shopping Cart
/SAPSRM/CL_PDO_FACTORY_SC_ADV
The following is sample code to using the Factory class to get instance.
  DATA lo_pdo_qte       TYPE REF TO /sapsrm/if_pdo_bo_qte.  CALL METHOD/sapsrm/cl_pdo_factory_qte_adv=>get_instance    EXPORTING      iv_header_guid = is_header-guid    RECEIVING      ro_instance    = lo_pdo_qte.
The get instance will get the instance from factory instance table.  If there is no entry then it will fetch data from database and insert the instance into instance table. 
Based on GUID, model access object returns base record.  The following simple example is a wrapper for BBP_PROC_GETDETAIL function module.
DATA: lo_pd_model TYPE REF TO /sapsrm/if_pdo_model_access,
      lt_status          TYPE bbpt_pds_status,
      ls_header          TYPE BBP_PDS_HEADER.
  lo_pd_model = /sapsrm/cl_pdo_model_factory=>get_instance( ).  lo_pd_model-get_detail(EXPORTING iv_guid = iv_header_guid                          IMPORTING es_header   = ls_header                                    et_status = lt_status ).
Dependent Object
CLL objects support a wide list of dependent objects to get associated section of the data.  The dependent class objects interfaces a number of interface classes.  The following table lists few of Dependent Object Classes.  Each DO object interfaces the corresponding DO interface /SAPSRM/IF_PDO_DO_ <DO>, /SAPSRM/IF_PDO_BO_BASE and /SAPSRM/IF_PDO_XO.  The dependent object uses basic BBP function.  The DO objects are invoked by the business object. Theses dependent objects are part of attributes in the business object.
SRM DO
Implemented Class
Condition
/SAPSRM/CL_PDO_DO_CND
Dynamic Attributes
/SAPSRM/CL_PDO_DO_DYNATTRI
Exchange Rate
/SAPSRM/CL_PDO_DO_EXR
Freight
/SAPSRM/CL_PDO_DO_FREIGHT
History
/SAPSRM/CL_PDO_DO_HISTORY
Limit
/SAPSRM/CL_PDO_DO_LIMIT
Long Text
/SAPSRM/CL_PDO_DO_LONGTEXT
Org data
/SAPSRM/CL_PDO_DO_ORGDATA
Partner
/SAPSRM/CL_PDO_DO_PARTNER
SOS
/SAPSRM/CL_PDO_DO_SOS
Status
/SAPSRM/CL_PDO_DO_STATUS
Tax
/SAPSRM/CL_PDO_DO_TAX
Version
/SAPSRM/CL_PDO_DO_VERSION
Weight
/SAPSRM/CL_PDO_DO_WEIGHT
Mapper Object
The mapper object creates connection between the UI and Business object.   SRM provides a list of BOM (business object mapper) and each object type refers to a BOM.    The BOM has been instantiated in the web Dynpro application using the object /SAPSRM/CL_CH_WD_TASKCONTAINER.  The BOM mapper instance is created using the ABAP object /SAPSRM/CL_CH_WD_MAP_FACTORY.    The factory class has a separate method for each SRM object type.
Object
SRM BO Mapper
Auction
/SAPSRM/CL_CH_WD_BOM_AUC
Confirmation
/SAPSRM/CL_CH_WD_BOM_CONF
Contract
/SAPSRM/CL_CH_WD_BOM_CTR
Invoice
/SAPSRM/CL_CH_WD_BOM_INV
Purchase confirmation
/SAPSRM/CL_CH_WD_BOM_PC
Purchase Order
/SAPSRM/CL_CH_WD_BOM_PO
Quota Arrangement
/SAPSRM/CL_CH_WD_BOM_QTA
Quote
/SAPSRM/CL_CH_WD_BOM_QTE
Bid Invitation
/SAPSRM/CL_CH_WD_BOM_RFQ
Shopping Cart
/SAPSRM/CL_CH_WD_BOM_SC
SUS ASN
/SAPSRM/CL_CH_WD_BOM_SUSASN
SUS Confirmation
/SAPSRM/CL_CH_WD_BOM_SUSCONF
SUS Invoice
/SAPSRM/CL_CH_WD_BOM_SUSINV
SUS PO
/SAPSRM/CL_CH_WD_BOM_SUSPO
Note that above objects implements interfaces /SAPSRM/IF_CLL_MAPPER and other mapper interfaces. 
Dependent Object Mapper (DOM) refers a particular section of the document.  For example, PO has header overview screen and it refers to DOM mapper /SAPSRM/CL_CH_WD_DODM_PO_OV_H.   The DOM classes are instantiated using its own BOM object.  The BOM has separate method for each DOM used by SAP.  

No comments:

Post a Comment