Skip to Content

In the good old days when we worked with SRM4, it was all about simple FMs and module pool programming. But now in SRM7 it’s all about classes, webdynpro and FPM. It is not that I am complaining (I do like the architecture), but it is just that when you get into a problem, it is difficult to find your way out.

In this blog, I am going to share what I have understood about creation of business documents (I am going to talk about shopping cart specifically here) after working in few projects on SRM7.  Please do keep in your mind that I am not an expert on this and if you find something wrong in what I have mentioned here, feel free to comment. I will be more than happy to receive constructive comments from readers.

SRM business document creation architecture

srm arch.JPG

UI layer refers to user interface build using different webdynpro components. BOM and DOM refers to business object and dependent object mapper classes. These classes facilitate the transfer of data from user interface to further layers (I will talk about those in my next blog). BO and DO refers to business object and dependent object classes which internally works with PROCDOC function modules ( This is what we are going to discuss in this blog).

Every business document creation logic in SRM7 works with below mentioned classes on a high level. I am taking example of shopping cart here to explain the process.

Factory class – /SAPSRM/CL_PDO_FACTORY_SC_ADV

This class is an abstract class containing static methods where the instances of BO class are manufactured (I think that is why it has FACTORY in its name) and retrieved from the buffer if available.

Business Object class (BO) – /SAPSRM/CL_PDO_BO_SC_ADV – This class contains methods that are responsible for all the actions that we take on BO. The constructor of this class contains code to instantiate the PDO buffer class and relevant DO classes.

BO class Inheritance tree

bo tree.JPG

Note: Replace /SAPSR/CL_PDO_BO with /SAPSRM/CL_PDO_BASE

Dependent Object classes (DO) – These classes cater to certain sub-sections of business object

Examples of Do classes

Account assignment data – /SAPSRM/CL_PDO_DO_ACCT_ASSGMNT

Partner data – /SAPSRM/CL_PDO_DO_PARTNER

Attachment data- /SAPSRM/CL_PDO_DO_ATTACHMENTS

DO class Inheritance tree (Attachment DO)

do tree.JPG

PDO buffer class – /SAPSRM/CL_PDO_UPDATE_BUFF_SC – This class manages buffer. Adding, updating and deleting data from buffer.

PDO buffer class inheritance tree

pdo buffer.JPG

Meta data classes – For every DO class there is a corresponding Meta class which has methods to determine the properties of the fields related to that particular DO (field properties like visible, enable and required). In SPRO under “Configure field control” and “Control actions” we configure the fields/action visibility etc. We also define customer metadata class and methods to control the field/action properties based on custom logic. These classes are dynamically called inside the metadata class methods.

Examples of metadata classes:

Attachment – /SAPSRM/CL_PDO_META_DO_ATT

Longtext – /SAPSRM/CL_PDO_META_DO_LTX

Limit data – /SAPSRM/CL_PDO_META_DO_LIMIT

Meta data class inheritance tree

meta class.JPG

Here Business object can be shopping cart, purchase order, confirmation etc. Dependent object can be considered as different tabs available in SC like attachment, longtext, partner data etc.

When we click on “Shop” link on the home screen control goes to the class /SAPSRM/CL_PDO_FACTORY_SC_ADV method CREATE_NEW_INSTANCE

What happens here?


This method returns an instance of class /SAPSRM/CL_PDO_BO_SC_ADV (This is the BO class for SC) also adds the instance to the buffer. Do not get scared by hearing the word BUFFER (I used to 😉 ). This is nothing but a static attribute of the class (precisely MT_INSTANCE_BUFFER attribute). By adding instance to buffer, we can access it anywhere we want.

More details:-


CREATE_NEW_INSTANCE internally calls GET_DEFAULT_DATA to get the default data for SC based on user who logged in. Next it calls method CREATE_SC_INT by passing only the header data, as there is no item data available yet.  Here BBP_DOC_CHANGE_BADI gets called for the first time. This method internally calls FM BBP_PROCDOC_CREATE, inside of which there is a call to BBP_DOC_CHECK_BADI (Keep in mind all these classes are wrappers of either PROCDOC FMs or some other basic FMs). Next call is made to method GET_INSTANCE where the actual creation of instance of class /SAPSRM/CL_PDO_BO_SC_ADV happens and instance is stored in buffer.

When instance of class /SAPSRM/CL_PDO_BO_SC_ADV is created using CREATE OBJECT statement, constructor of this class get called. Inside the constructor, instances of the PDO buffer class and all the DO objects are created.

Adding item from catalog


When you try to add items from catalog, after check out from catalog, control goes to method /SAPSRM/IF_PDO_BO_SC~ADD_ITEMS_FROM_CATALOG of class /SAPSRM/CL_PDO_BO_SC (super class of /SAPSRM/CL_PDO_BO_SC_ADV). Here there is a call to FM BBP_WS_IMPORT_SC_DATA in which the call to BADI BBP_CATALOG_TRANSFER happens. After that the code mainly fills in required details in item, if not filled in BBP_CATALOG_TRANSFER BADI like company code, plane, delivery data, delivery address, partner details, account assignment details etc. ( values are extracted from “Personal default settings” setting). Finally all the data is updated to buffer using method WRITE_TO_PDO_BUF_AFTER_VALI of class /SAPSRM/CL_PDO_BO_SC.

The item details are now added to the SC by calling method /SAPSRM/IF_PDO_BASE~SUBMIT_UPDATE of class /SAPSRM/CL_PDO_BO_SC_ADV. Inside this there is call to the same method of super class (/SAPSRM/CL_PDO_BO_SC), inside this there is a call to the same method of super class (/SAPSRM/CL_PDO_BO). Here Sap calls /SAPSRM/IF_PDO_UPDATE_BUFFER~SUBMIT of PDO buffer class /SAPSRM/CL_PDO_UPDATE_BUFF_SC. Inside this method, method PREPARE_PD_UPDATE of same class. BBP_DOC_CHANGE_BADI gets called inside this method. After that BBP_PROCDOC_UPDATE gets called (BBP_DOC_CHECK_BADI gets called here again). Finally buffers are cleared (Accounting data, partner data, orgdata and pricing data etc.)

The method /SAPSRM/IF_PDO_BO_SC~ADD_LIMIT_ITEM of class /SAPSRM/CL_PDO_BO_SC gets called when adding limit item to the shopping cart.

The “Order” action on shopping cart calls method /SAPSRM/IF_PDO_BO_SC~ORDER of class /SAPSRM/CL_PDO_BO_SC_ADV. This method calls another method of same class called CHANGE_DOCUMENT where BBO_DOC_CHECK_BADI and BBP_DOC_CHANGE_BADI are called again. Finally BBP_PROCDOC_SAVE is called and we have our shopping cart in ordered status.

I have mostly covered here the BO and DO parts of CLL layer. Please read through this thread SAP SRM Technical Architecture?  by RBEI SRM, which has more details on PDO and CLL layer architecture in SRM. This thread is the motivation for me to write this blog in first place. If I get time I will write about Mapper classes in another blog.

I know there is lot of information in the blog with so many classes and methods. I would suggest reader to open the SAP GUI and refer the classes and methods I have mentioned while reading this blog. I hope I have added some valuable information to the vast knowledge base of SCN.

link to part 2 Understanding Shopping cart creation in SRM7 – Part 2

Keep sharing 🙂 Have a nice day 🙂

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

    1. sankara rao bhatta Post author

      Hi Karthik,

      Thank you…

      When I searched SDN for understanding SC creation in SRM7, I could not find any good resources and I know lot of SRM7 technical consultants want to undestand the process at a more deeper level. So I thought why don’t take the first step 🙂

      I had created the part 2 as well, in case you are interested.

      thanks,

      sankar

      (0) 
  1. Naganandini S

    Hi Sanakara,

    Thank you for a very detailed article…

    It is must read for every SRM technical consultant!

    The BO class Inheritance tree I could trace back in the system is:

    /SAPSRM/CL_PDO_BO_SC_ADV

    /SAPSRM/CL_PDO_BO_SC

    /SAPSRM/CL_PDO_BASE

    However in the diagram it is /SAPSRM/CL_PDO_BO.

    Please Clarify.

    Regards,

    Nandini
     
     
     
     
     
     
     
     
     
     
     

    (0) 
    1. sankara rao bhatta Post author

      hi Nandini,

      Thanks for your comment. Which version of SRM you are in?  SAP might have changed the classes or May be I was wrong 🙂 . Anyway I will change the content.

      thanks,

      sankar.

      (0) 

Leave a Reply