cancel
Showing results for 
Search instead for 
Did you mean: 

MDG Customised Workflow approval levels -

0 Kudos
510

I have customised workflow of MM where I have 4 approval level, So my requirement is to hide , invisible and greyed out the fields based on the approval levels.


So i am using BADI :

USMD_ACC_FLD_PROP_CUST_DEP_SET

But what the issue is that after clicking on submit button, it should ideally go to 1st approver means next CR step.

But in this BADI the correct CR Step number is not getting captured due to which I am not able to change the properties of the fields based on step types.


Please help in this. how to approach it. as I need to handle this workflow based on steps. Or is there any way where I can get the capture the workflow steps like on submission which step it is going ?

Thanks

View Entire Topic
bpawanchand
Active Contributor
0 Kudos

Hi Mahak,

You should get the step of the workflow by using below code snippet.

    DATA:
      ls_sibflporb TYPE sibflporb,
      lt_cr_wi     TYPE swrtwihdr,
      ls_cr_wi     TYPE swr_wihdr,
      ls_cr_step   TYPE usmd_s_step_action,
      lt_wi_cont   TYPE swrtcont,
      ls_wi_cont   TYPE swr_cont.
    CHECK iv_cr_number IS NOT INITIAL . "iv_cr_number  = IV_CREQUEST

    CLEAR: lt_cr_wi,ls_sibflporb.
    CONCATENATE iv_cr_number '000000' INTO ls_sibflporb-instid.
    ls_sibflporb-typeid = 'BUS2250'.
    ls_sibflporb-catid  = 'BO'.


    CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'
      EXPORTING
        object_por = ls_sibflporb
      TABLES
        worklist   = lt_cr_wi.

    IF lines( lt_cr_wi ) EQ 1.
      ls_cr_wi = lt_cr_wi[1].
      IF sy-subrc IS INITIAL.
        CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
          EXPORTING
            workitem_id      = ls_cr_wi-wi_id
          TABLES
            simple_container = lt_wi_cont.
        IF lines( lt_wi_cont ) GT 0.
          READ TABLE lt_wi_cont
                INTO ls_wi_cont
                WITH KEY element = 'STEP_ACTION'.
          IF sy-subrc IS INITIAL.
            ls_cr_step = ls_wi_cont-value.   " Step and action should be avaiable
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.

Regards

Pavan Bhamidipati