Use the following snippet to determine the workflow agents / approvers of an SRM Shopping Cart.
DATA: ls_wf_hist TYPE /sapsrm/s_wf_process, lt_partner TYPE bbp_pdt_partner. /sapsrm/cl_wf_apv_facade=>retrieve_process_history( EXPORTING iv_document_guid = lv_shopping_cart_guid iv_agent_id = space iv_language = space IMPORTING es_process = ls_wf_process ).
You can extract the agents for each step from the deep structure
Hint: You find the shopping cart guid in table CRMD_ORDERADM_H in component GUID. You can select from this table with the given Shopping Cart Number which is stored in component OBJECT_ID.
To get the Requester of a Shopping Cart, you need to get the parners participating in the lifecycle of the Shopping Cart.
CALL FUNCTION 'BBP_PD_SC_GETDETAIL' EXPORTING i_guid = lv_shopping_cart_guid TABLES e_partner = lt_partner.
After retrieving lt_partner, you need to read the entry whit the right Partner Function ( component PARTNER_FCT). Which partner function is the Requester? Just search in the Implementation Guide for Partnetr Functions, and you'll find the corresponding customizing easily.
You'll find the requesters business partner guid in the line selected in component PARTNER_NO.
More information about the user agent (like the user name) using the partner guid can be gathered using the following function call:
CALL FUNCTION 'BP_CENTRALPERSON_GET' EXPORTING iv_bu_partner_guid = CONV bu_partner_guid( lv_partner_guid ) IMPORTING ev_username = lv_username EXCEPTIONS no_central_person = 1 no_business_partner = 2 no_id = 3 OTHERS = 4.
CONV bu_partner_guid( lv_partner_guid ). This statement not available in older releases. Instead of CONV move the value in field PARTNER_FCT to a variable expected by the function first, and pass it, that's it.