cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the approver of shopping cart in single step approval

Former Member
0 Kudos

Hi,

we are using process controlled workflow in srm 7.0 , can any one tell me how to find the approver in single step approval after shopping cart has been created.

Thanks

kamakshi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi kamachi ,

IN SRM 7 .0 the FM 'BBP_BW_APPROVER_COUNT' will not work because of process controll work flow .

hence i used the below logic will find the approve name ( system or adhoc approver ) for the SC

CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
       EXPORTING
*   I_GUID                           =
         i_object_id                      = im_sc " shopping card no
         i_with_itemdata                  = 'X'
       IMPORTING
         e_header                         = ls_header
       TABLES
         e_item                           = lt_item .

*/SAPSRM/D_WF_006
* collecting the Item GUID
      SORT lt_item BY guid.
      IF lt_item[] IS NOT INITIAL.
* pass only the Item guid require
        delete lt_item where guid NE IM_ITEM_GUID .

*passing the item GUID  to get the DECISION_SET_ID
        SELECT * FROM /sapsrm/d_wf_006 INTO TABLE lt_decision
               FOR ALL ENTRIES IN lt_item WHERE item_guid EQ lt_item-guid.

*/SAPSRM/D_WF_005
*get Area context GUID

        IF lt_decision[] IS NOT INITIAL .
          SORT lt_decision BY decision_set_id .

          SELECT * FROM  /sapsrm/d_wf_005
                   INTO TABLE lt_area_context
                   FOR ALL ENTRIES IN lt_decision
                   WHERE decision_set_id EQ lt_decision-decision_set_id.

          IF lt_area_context IS NOT INITIAL .
            SORT lt_area_context BY id.

*/SAPSRM/D_WF_004
            SELECT * FROM /sapsrm/d_wf_004
                     INTO TABLE lt_decisionset
                     FOR ALL ENTRIES IN lt_area_context
                     WHERE  area_contxt_guid EQ lt_area_context-id.

            IF lt_decisionset[] IS NOT INITIAL .
              SORT lt_decisionset BY id descending .

*/SAPSRM/D_WF_013
              SELECT * FROM /sapsrm/d_wf_013
                       INTO TABLE lt_workitem
                       FOR ALL ENTRIES IN  lt_decisionset
                       WHERE leading_obj_guid EQ lt_decisionset-id .

              IF lt_workitem[] IS NOT INITIAL .
                SORT lt_workitem BY wiid descending.

                DELETE lt_workitem WHERE is_executed EQ 'X'.
*SWWUSERWI
                READ TABLE lt_workitem INTO ls_workitem INDEX 1 .
                IF sy-subrc EQ 0 .


                  SELECT SINGLE user_id wi_id
                         FROM swwuserwi INTO (lv_userid , lv_wid )
                         WHERE wi_id EQ ls_workitem-wiid .

                  SELECT SINGLE name_text
                         FROM user_addrp INTO lv_fullname
                         WHERE bname EQ lv_userid .

                  IF sy-subrc EQ 0 .
                    rt_pending_app_name = lv_fullname.
                  ENDIF.

                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.

Former Member
0 Kudos

Hi,

thank you for your quick response.

your answer is really helpfull , thank you but i am not abloe to get approver name in iv_full name, please help me.

thanks

kamakshi

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I needed to do the same. This is how I solved it. You only need the GUID of the shopping cart.

REPORT 

zmsz_teszt.



DATA:

      lv_sc_id
TYPE crmd_orderadm_h-object_id,

      lv_sc_guid
TYPE crmd_orderadm_h-guid,

      ls_wf_hist
TYPE /sapsrm/s_wf_process.



FIELD-SYMBOLS:

               <ls_prolevlist>
TYPE LINE OF /sapsrm/s_wf_process-process_level_list,

               <ls_decision>
TYPE LINE OF /sapsrm/t_wf_decisionset_s,

               <ls_wi_list>
TYPE LINE OF /SAPSRM/T_WF_WORKITEM_S.



lv_sc_id
= '6800003658'.

lv_sc_guid
= '0050568602601ED299E0575227599CF4'.



/sapsrm/cl_wf_apv_facade
=>retrieve_process_history( EXPORTING iv_document_guid = lv_sc_guid

                                                              iv_agent_id
= ''

                                                              iv_language
= ''

                                                   
IMPORTING es_process = ls_wf_hist ).



*ls_wf_hist

WRITE: / 'USER         Decision'.

LOOP AT ls_wf_hist-process_level_list ASSIGNING <ls_prolevlist>.

 
LOOP AT <ls_prolevlist>-decisionset_list ASSIGNING <ls_decision>.

   
LOOP AT <ls_decision>-workitem_list ASSIGNING <ls_wi_list>.

     
WRITE: / <ls_wi_list>-agent, <ls_decision>-status.

   
ENDLOOP.

 
ENDLOOP.

ENDLOOP.

Cheers,

Misi