SAP SRM – Get current status of a Shopping Cart

SAPThere is a general function module (BBP_PD_SC_GETDETAIL) to get overall summary of a shopping cart which also provides a list of statuses assigned to the shopping cart. But this list tells you nothing about which status is the actual one. And how to find out the correct one?

Use function module BBP_PD_SC_GETDETAIL to get the list of actual statuses for your shopping cart:

  DATA:
    lv_sc_number   TYPE crmt_object_id_db,
    ls_header      TYPE bbp_pds_sc_header_d,
    lt_items       TYPE bbpt_pd_sc_item_d,
    lt_statuses    type BBPT_PD_STATUS,
    lt_messages    TYPE bbpt_pd_messages.

  CHECK lv_sc_number IS NOT INITIAL.

  CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
    EXPORTING
      i_object_id = lv_sc_number
    IMPORTING
      e_header    = ls_header
    TABLES
      e_item      = lt_items
      e_messages  = lt_messages
      e_status    = lt_statuses.

Note: You can get the same list of statuses by selecting data from CRM_JEST table for your ls_header-guid (textual description of all the status IDs is available in table TJ02T)

Now use the GUID of the shopping cart (ls_header-guid) and the list of statuses (lt_statuses) in the function module BBP_DOC_STATUS_GET for business object BUS2121 (shopping cart) … using different BUS you can get this information also for different business objects (inquiry, requisition, …):

  CALL FUNCTION 'BBP_DOC_STATUS_GET'
    EXPORTING
      IV_OBJTYPE                        = 'BUS2121'
      IV_GUID                           = ls_header-guid
    IMPORTING
      EV_STATUS                         = lv_status
      EV_STATUS_DESCRIPTION             = lv_status_description
    TABLES
      IT_STATUS                         = lt_statuses.

The result (status ID) you are looking for is stored in lv_status. It’s description can be found in lv_status_description.

Note: If a shopping cart approver rejects the shopping cart, it remains in I1015 “Awaiting Approval” status, because after approver’s rejection the shopping cart returns back to the requisitioner where it waits in his inbox until he either

  • corrects the shopping cart and sends it for approval again
  • confirms the rejection (only in this case the SC gets into status I1016 – “Release rejected”)

Leave a Reply