cancel
Showing results for 
Search instead for 
Did you mean: 

Manual N-Step approval SRM 7.0

Former Member
0 Kudos

Hi SRM experts,

I have a requirement to approve n-step process control workflow manually in SRM 7.0.

Suppose if there is 5 steps, the first step should manually complete based on the work item id and rigger next level  for approval.

The function module SAP_WAPI_WORKITEM_COMPLETE allows to approve only for single step approval. So it doesn’t really help.

Can you please suggest any FM/Class method/or any other method to complete the N-approval?

Thank you

Magesh.

Accepted Solutions (1)

Accepted Solutions (1)

konstantin_anikeev
Active Contributor
0 Kudos

Hi Magesh,

try the class /SAPSRM/CL_WF_PROCESS_MANAGER

Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

Thank you for the suggestions.

I was using different methods of the class  /SAPSRM/CL_WF_PROCESS_MANAGER, But did not really helped me to resolve the issue. The workitems are not approve/complete/reject.

It would be great if you could suggest any other methods available.

I was trying to debug the webdynpro application and unable point out exact place.

Thank you

Magesh

konstantin_anikeev
Active Contributor
0 Kudos

Hi Magesh,

you can not approve all the Workflow steps with one call of function module. PCW work so, that next step evaluated and created only after previous completed. What is your requirement in details?

Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

thank you for the update again.

My requirement is also the same, I need to approve the first workflow step and open/trigger the next in N-step approval process. But I could not even to complete the first step. Do you have any idea which method used to complete the workitem and trigger next?

Since we are working for mobile approval, the process is when I receives the approval request from mobile i need to manually complete the workitem. if it is n-step, i need to complete the first one and triggers the next step.

Regards,

Magesh

konstantin_anikeev
Active Contributor
0 Kudos

Hi Magesh,

why don't just simulate it via SC object.

something like...

lo_sc = /sapsrm/cl_pdo_factory_sc_adv=>get_instance(

iv_header_guid   =     <<document_guid>>

iv_mode          =     /sapsrm/if_pdo_constants_gen_c=>gc_mode_approval

IV_WIID     = <<workitem number>>

IV_USER_ID = <<approver>>

IV_USER_LANGUAGE = <<language>>

).   

and then

lo_sc->/SAPSRM/IF_PDO_ADV_BASE~APPROVE( )

Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

Thank you for the help, the logic given is working fine for N-step approval.

Thank you

Magesh

konstantin_anikeev
Active Contributor
0 Kudos

glad to hear

Former Member
0 Kudos

Hi Konstantin,

The SC manual N-step approval is working as you suggested.

I am now facing issue to approve change PO which goes for N-step approval.

data lo_sc type REF TO /sapsrm/if_pdo_bo_po_adv.

    lo_sc = /sapsrm/cl_pdo_factory_po_adv=>get_instance(
    iv_header_guid   =  iv_document_guid
    IV_PROCESS_TYPE  = 'PO' also used 'ECPO'
    iv_mode          =  /sapsrm/if_pdo_constants_gen_c=>GC_MODE_APPROVAL

    IV_WIID          = iv_workflow_id
    IV_USER_ID       = iv_processing_user
    ). 

when I debug above method,inside(below code)  it is not creating any instance and always initial
CALL METHOD /sapsrm/cl_pdo_bo_po_adv=>get_po_adv_instance

 
Do you see any issue with this code ? is there any other method can we achieve this functionality?


Can you kind suggest your thoughts.

Thank you
Magesh

konstantin_anikeev
Active Contributor
0 Kudos

try process type BUS2201

Former Member
0 Kudos

Hi Konstantin,

the process type accepts only 4 char. I found the process type from the PO and mentioned it.

but still i am getting the error and INSTANCE IS NOT CREATED.

Thank you

Magesh

konstantin_anikeev
Active Contributor
0 Kudos

yap... sorry, thought about shopping cart.

I checked the code, and have not found APPROVAL mode. Only EDIT and DISPLAY.

Try to call with EDIT and ECPO as a type.

Former Member
0 Kudos

Hi Konstantin,

Sorry, Bad luck Edit mode is not working as usual the same place i am getting dump. it creates the instance and finally destroy it . so no instance will be created.

Thank you so much for the update again.

Magesh

Former Member
0 Kudos

Hi Konstantin,

It will execute below method and always rejected.
"------ Test if the requested adv mode can be established.
  /sapsrm/cl_pdo_adv_service=>evaluate_adv_mode(
        EXPORTING
           iv_requested_mode = mo_apf_context->mv_adv_mode
        IMPORTING
          ev_result = lv_result
        CHANGING
           co_apf_context = mo_apf_context
      ).


(IF co_apf_context->mv_workitem_type IS INITIAL.
*                IF co_apf_context->mv_user_is_document_owner EQ abap_true.
                  " Doc owner with ADJUST work item:
                  " Doc owner may recall document from POWL if the document is in approval phase.
                  " Doc owner may not recall document from POWL if the document is in completion phase
                  " (but he is allowed to operate on the EDIT instance).
                  " Doc owner may operate on EDIT instance from UWL if document is in completion phase.
                  " Doc owner may not modify instance from UWL if document is in approval phase.
                  lt_edit_wis = get_wis_for_edit( co_apf_context->mt_workitems ).
                  IF lines( lt_edit_wis ) EQ 0.
                    IF co_apf_context->mv_apf_version EQ /sapsrm/if_wf_process_c=>GC_APF_VERSION_0200.
                      " In V20 a document may only be recalled if no REVISE work item exists
                      lo_apf_context_v20 ?= co_apf_context.
                      IF lo_apf_context_v20->ms_interaction_workitem-workitem_type EQ /sapsrm/if_wf_process_c=>gc_workitem_type_revise.
                        lv_result = GC_MODE_REJECTED.
                      ELSE.
                        lv_result = GC_RECALL_REQUIRED.
                      ENDIF.
                    ENDIF.)

Thank you

Magesh

Former Member
0 Kudos

Hi Konstantin,

I was passing wrong header guid and corrected it. it is now king fine now..

Thank you for the help and guidance.

Regards,

Magesh

Answers (0)