Skip to Content
0
Former Member
Aug 10, 2011 at 10:39 PM

Class /SAPSRM/CL_WF_PROCESS_LEVEL method IS_LAST_LEVEL not working

305 Views

We are running SRM 7.0 SP 8 with Process Controlled Workflow.

I am trying to use object with reference to class /SAPSRM/CL_WF_PROCESS_LEVEL, method IS_LAST_LEVEL to determine if the current workflow process level is the last in an N-step approval. But the method does not return what I am expected, instead, it is always returning abap_true. I am puzzled for a while for this. Following is my code excerpt with this call:

        data:ls_process_level    type /sapsrm/s_wf_process_level,
             lo_curr_proc_level  type ref to /sapsrm/cl_wf_process_level.

          call method /sapsrm/cl_wf_apv_facade=>get_current_process_level
            exporting
              iv_document_guid = iv_doc_guid
            importing
              es_process_level = ls_process_level.

          try.
              lo_curr_proc_level = /sapsrm/cl_wf_process_level=>getpersistent_by_oid( ls_process_level-level_guid ).

              if lo_curr_proc_level->is_last_level( ) eq 'X'.
                lv_final_step = 'X'.
              endif.

            catch cx_root.
              raise exception type /sapsrm/cx_wf_not_found.
          endtry.

Note: After the call to /sapsrm/cl_wf_process_level=>getpersistent_by_oid, lo_curr_proc_level is returned with the actual valid object. The issue is only with the next call to IS_LAST_LEVEL.

If you can shed some light as to what might be wrong with this code, OR, how else you would determine whether the current process level is the last step in an N-step approval, I'd really appreciate it.

Thanks.