SRM Programming

Tags: SRM

Constants

DescriptionNameType
Document Status /sapsrm/if_pdo_status_c constant interface

Object Types

/sapsrm/if_pdo_obj_types_c constant interface

Procurement Document Generic

/sapsrm/if_pdo_constants_gen_c constant interface

Workflow

/sapsrm/if_wf_process_c constant interface

Constant mix

/sappssrm/cl_constants constant class

URL generation services (to access PDO)

/sapsrm/cl_url_service class

Useful classes

 
DescriptionNameUse
Workflow - Process Controlled /sapsrm/cl_wf_adv_facade Retrieve WF related data of a Procurement Document

Workflow - Application Controlled

/sapsrm/cl_wf_apv_facade_50 Retrieve WF related data of a Procurement Document

 Workflow - Info

 /sapsrm/cl_apf_service Features to get workitem details and and related PDO Information

 

   

Programming using the PDO Model

Generic access to Procurement Document Header Details

Here you can pass the Header GUID/Object ID of various kind of document types (Shopping Cart, Purchae Order etc.), and retrieve all the fragments of this procurement document. 

  DATA(lo_pdo_model) = /sapsrm/cl_pdo_model_factory=>get_instance( ).

  lo_pdo_model->get_detail(
     EXPORTING
      iv_guid  = ls_po_item-header
    IMPORTING
      es_header   = DATA(ls_header)
      et_item     = DATA(lt_po_item)
      et_partner  = DATA(lt_po_partner)
  ).

Generic access to Procurement Document Item Details

Like for the header, but here you need to pass the item GUID.

  DATA(lo_pdo_model) = /sapsrm/cl_pdo_model_factory=>get_instance( ).

  lo_pdo_model->get_item_detail(
     EXPORTING
      iv_guid  = ls_po_item-guid
    IMPORTING
      et_account  = DATA(lt_account)
      et_partner  = DATA(lt_po_partner)
  ).

Specific Access to Procurement Documents

Unlike with generic access, you can target document specific features calling the factory dedicated for a given type of PDO. The example shows below, how-to access the Purchase Order in advanced mode.

DATA(po_adv) = /sapsrm/cl_pdo_factory_po_adv=>get_instance(
iv_header_guid = iv_header_guid
iv_mode = iv_mode
iv_process_type = lv_process_type
).

This works for most common documents in SRM, each has a dedicated factory.

  • /SAPSRM/CL_PDO_FACTORY_ASL Factory class for Supplier List BO
  • /SAPSRM/CL_PDO_FACTORY_AUC Factory for AUC object
  • /SAPSRM/CL_PDO_FACTORY_BEV SO PDO Factory for Bid Activities
  • /SAPSRM/CL_PDO_FACTORY_CP Componnent Planner PDO Factory Class 
  • /SAPSRM/CL_PDO_FACTORY_CRA Factory for getting CRA PDO instance
  • /SAPSRM/CL_PDO_FACTORY_CTR_ADV Factory for Contracts with approval document view
  • /SAPSRM/CL_PDO_FACTORY_CTR_MC Factory class
  • /SAPSRM/CL_PDO_FACTORY_CTR_MU Factory class for Contract Mass Update
  • /SAPSRM/CL_PDO_FACTORY_DAO_MO Creates Data Access Objects
  • /SAPSRM/CL_PDO_FACTORY_DAO_PM Creates Data Access Objects
  • /SAPSRM/CL_PDO_FACTORY_DAO_SRV Creates DAO objects
  • /SAPSRM/CL_PDO_FACTORY_INV_ADV Factory for Invoice with Workflow Capabilities.
  • /SAPSRM/CL_PDO_FACTORY_MUPD Factory class for MO Self Edit Company Data
  • /SAPSRM/CL_PDO_FACTORY_PC Factory class for PCard
  • /SAPSRM/CL_PDO_FACTORY_PO_ADV Factory for Purchase Orders with approval document view
  • /SAPSRM/CL_PDO_FACTORY_POR Factory class for POR
  • /SAPSRM/CL_PDO_FACTORY_PR Factory for Shopping Carts with approval document view
  • /SAPSRM/CL_PDO_FACTORY_QTA Factory class for Quota Arrangement BO
  • /SAPSRM/CL_PDO_FACTORY_QTE_ADV Factory for Quote Object
  • /SAPSRM/CL_PDO_FACTORY_RFQ Factory for RFQ object
  • /SAPSRM/CL_PDO_FACTORY_SC_ADV Factory for Shopping Carts with approval document view
  • /SAPSRM/CL_PDO_FACTORY_SC_SOCO Factory for Shopping Carts in Sourcing Cockpit
  • /SAPSRM/CL_PDO_FACTORY_SRVPKG Factory class for Survey Package
  • /SAPSRM/CL_PDO_FACTORY_SURV Factory for Survey
  • /SAPSRM/CL_PDO_FACTORY_SUSASN Factory Class for SUS ASN BO
  • /SAPSRM/CL_PDO_FACTORY_SUSCONF Factory class for SUS confirmation
  • /SAPSRM/CL_PDO_FACTORY_SUSINV Factory class for SUS INV BO
  • /SAPSRM/CL_PDO_FACTORY_SUSORD Factory class for AO SUS Order
  • /SAPSRM/CL_PDO_FACTORY_SUSPO Factory class for SUS PO
  • /SAPSRM/CL_PDO_FACTORY_USER Factory for User instances

Searching Procurement Documents

This can be done using the search factory, which provides a central access through OO pattern to search classes, implementing dedicated interefaces. Here is an example for contracts

DATA(contract_search) = /sapsrm/cl_pdo_so_srch_factory=>get_instance_ctr( ).

DATA(search_criteria) = VALUE /sapsrm/s_search_fields(
vendor = is_ctr_srch-supplier_no
category = is_ctr_srch-sh_category_id
with_closed = abap_true
).

contract_search->set_search_values( EXPORTING is_search_criteria_ctr = search_criteria ).

contract_search->execute_search(
IMPORTING
et_guid_list = DATA(ctr_hdr_guid_tab)
CHANGING
co_message_handler = message_handle
).
This works for other documents, just replace get_instance_ctr( ) with one of the methods below
  • get_instance_ros
  • get_instance_susinv
  • get_instance_suspo
  • get_instance_sc_2
  • get_instance_sc
  • get_instance_bupa
  • get_instance_dout
  • get_instance_po_2
  • get_instance_po
  • get_instance_rfq
  • get_instance_quick_search
  • get_instance_sus_quick_search
  • get_instance_ctr
  • get_instance_auc
  • get_instance_conf
  • get_instance_cnf2
  • get_instance_por
  • get_instance_inv
  • get_instance_qte
  • get_instance_arch