cancel
Showing results for 
Search instead for 
Did you mean: 

Function module expression for dynamic value for Cost center in BRF

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Thank you very much Sahil. That was a very informative answer. I think my original query was not that clear. II am looking for an expression that would determine value from a z table. The z table will have an entry for the approval limit for each cost center.

Thank you.

Edited by: abhijitkamatkar on Mar 2, 2012 7:14 AM

Former Member
0 Kudos

Hi,

There is no standard expression for your business requirement, you have to build the customer expression to find the value from Ztable. let me know if you need more information

Saravanan

Former Member
0 Kudos

Hello Sarvanan,

Thank you very much for your reply. I am aware about the fact that there is not such standard expression to fetch data from z table. i have also already written a customized z FM to achieve. I want to know how/what should be the logic to get data from z table ? Please note i am not interested in approver here. Thank you.

Best regards.

Edited by: abhijitkamatkar on Mar 5, 2012 6:16 AM

Former Member
0 Kudos

Abhijeet could you specify little more about your business requirement about what cretiria like cost center or document type or approval limit ??? etc etc

regards

sahil p

Former Member
0 Kudos

Hi,

if your question is to trigger the process level event, then as you said build the logic ( Your business requirement ) in the expression .. if the condition is true then update the EV_VALUE as true or EV_VALUE is false. based on EV_VALUE the system will decide if process level is valid or not..

Former Member
0 Kudos

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.

Answers (0)