Skip to Content
avatar image
Former Member

Function module expression for dynamic value for Cost center in BRF

Hello Experts,

We are in SRM 7.0 and our business object is shopping cart using BRF.

Right now we have Cost Center Approver and its evaluation id ()zev_sc_**_*) has expression zc_sc_*_** that checks whether overallvalue >= 5000. It initiates cost center approver only if value is greater than or equal to 5000. But this is static expression. We want it in a dynamic way so that we don't have to modify this value frequently. Therefore we have set approach to use an expression of Function Module BAdI as expression. We have a new z table which contains value field zval. Now I want to know how or what should be the process so that this FM knows the corresponding value from a z table that user might select in the SC.How it should be linked to this. I am using /SAPSRM/WF_BRF_0EXP000 function module. Please advise where should the code be written ? Any method ? And what should be the exporting and importing parameters for this ?

Right now I can see EV_VALUE, EV_TYPE, EV_CURRENCY etc as exporting paramters. Looking for your suggestions experts.

Thank you.

Best regards.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Mar 01, 2012 at 03:03 PM

    Dear abhijeet,

    just follow the steps.

    i) I believe you have created the event as Zev_*** with implememt Class 0EVENT.

    ii) copy the std fm /SAPSRM/WF_BRF_0EXP000 to z custom fm

    iii) since you want to have an expression as function module procurement type create expression with

    expression type 0CF001

    result type B ( boolean)

    Buffering as event-controlled buffering

    and very important procurement type as function module.

    iv) immediatly you may find written as AccessFM where pass your custom z function module.

    v) finally link this expression to your event.

    In the custom function module the exporting parameter EV_VALUE is solely responsible for identifieng the approval based upon the approval criteria. If the field EV_VALUE = 'X' this notify that the approval is required for current process level, otherwise if it is initial then it will skip the current level and continue with the next level.

    whatever your coding should be written in FM.

    just look into below code

    DATA LO_WF_BRF_EVENT TYPE REF TO /SAPSRM/CL_WF_BRF_EVENT.

    DATA LO_CONTEXT_PROVIDER TYPE REF TO /SAPSRM/IF_WF_CONTEXT_PROVIDER.

    DATA: LV_HEADER LIKE BBP_PDS_SC_HEADER_D.

    DATA: LT_ITEM TYPE STANDARD TABLE OF BBP_PDS_SC_ITEM_D.

    LO_WF_BRF_EVENT ?= IO_EVENT.

    LO_CONTEXT_PROVIDER = LO_WF_BRF_EVENT->GET_CONTEXT_PROVIDER( ).

    CALL METHOD LO_CONTEXT_PROVIDER->GET_DOCUMENT

    IMPORTING

    EV_DOCUMENT_GUID = LV_DOCUMENT_GUID

    EV_DOCUMENT_TYPE = LV_DOCUMENT_TYPE.

    pass this guid in the below function module in order to get the SC details.

    • GET SC DETAILS

    CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

    EXPORTING

    I_GUID = LV_DOCUMENT_GUID

    IMPORTING

    E_HEADER = LV_HEADER

    TABLES

    E_ITEM = LT_ITEM

    After that loop the internal table LT__ITEM and you decide based upon your approval criteria for each line item level wheather the gross price of line item is exceed 5000k or not.

    you should decide the value for field EV_VALUE within the loop so that each line item will be verified for approval.

    Pls contribute if this helpfull.

    regards

    sahil purushan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Sahil, Sarvanan thank you very much for your continuous suggestions. However we found a solution in other way. We made customized expression FM ZWF_BRF_0EXP001 (copy of /sapsrm/WF_BRF_0EXP001). In that I defined ev_value as float, of course i referred attributes of the interface and selected

      ev_value = /sapsrm/if_wf_rule_c=>TYPE_FLOAT

      .

      Later I passed my table value to the ev_value. I got the required results.

      Thank you very much.

      Best regards.