cancel
Showing results for 
Search instead for 
Did you mean: 

SRM 7 BRF Process Controlled workflow

Former Member
0 Kudos

Hi all,

I have a client requirement like below,

A PO is in ordered status and if some one chages the PO value and if the changed value is more than 1000 Euros then the PO has to go through the approval process else it should go for an automatic approval.

Can any of you please guide me how to acheive this functionality.

Just for reference I am giving some details :

I have created an Eval Id (ZEVAL, this is the event), and this event linked to a expression(ZDET_SCHEMA: Function module for determining the schema), and I have 2 process levels for the schema

1 Level will have folowing details:

Level # Level Type Evaluation ID Responsibility Resolver Name Task ID Decision Type

100 Approval ZE_PO_EXE ZE_PO_APP 40007953 4

and the evalutio id ZE_PO_EXE points to an expression(ZDET_PO_CALC Function module) ZDET_PO_CALC Function module will have the actual manipulation for calculating the price change and passes a result 'X' or space , if 'X' level 100 will get excecuted else level 2 will be executed.

2 Level will have an automatic approval

But some how this is not working..

Any info will be highly apreciated.

Thanks in advance

Krishna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
  • Get changed version details ...

CALL FUNCTION 'BBP_PD_PO_GETDETAIL'

EXPORTING

i_guid = iv_document_guid

i_with_itemdata = 'X'

IMPORTING

e_header = lwa_po_header_change

TABLES

e_item = li_item_change

e_account = li_accnt_change

e_limit = li_limit_change

e_version = lt_version.

  • Fetch the active version ...

  • Current Header is active header so no need to WF ...

CLEAR ev_value.

READ TABLE lt_version INTO lwa_version

WITH KEY guid = iv_document_guid.

IF sy-subrc EQ 0.

  • Since there is no active version this is a new PO so WF need not

  • get triggered ...

IF lwa_version-active_header IS INITIAL.

EXIT.

ENDIF.

With the above coding you can identify whether the PO got change version or not.. Based on your business requirement you can frame your function module..

Hope this will help you..

Thanks!!

Bharath

Answers (5)

Answers (5)

Former Member
0 Kudos

Solved on my own with the information from different posts.

Thanks and Regards,

Krishna Chaitanya

Former Member
0 Kudos

Thank you for giving me the confidence... I will try the way you suggested.. Hope it works .. I will post back the results after trying

Thank you once again for the info... this certainly helps me, as I am new to SAP SRM

Regards,

Krishna

Former Member
0 Kudos

Hi Bharath,

Here is my concern,

" But in the same PO screen if I press on REFRESH again the code is getting hit and this time the new and the old value is same and the conditions are failing and the FM is returning space "

Once the PO value is changed and clicked on order button(I am still in the PO screen) the code is getting hit in the background and approvers are getting determined perfectly. I am hitting the REFRESH button without changing any value in the same PO screen as I am still in the PO screen, now the actual problem, the code is getting hit again and the conditions are getting failed as I am not changing the value and the expression returns space as result, this means the doc is going for an automatic approval(the 2nd process level) and the approvers are wiped off even they are in open status before hitting the REFRESH button...

I am not sure.. whether the way I am doing is correct or no. I doubt even after coding the way you suggested in the above post will have the same problem.

Hope you got it.. any ideas or info to acheive this is highly appreciated.

Thanks and Regards

Krishna..

Former Member
0 Kudos

You will not get such type of issue, if you go by my Idea.. I have developed this solution for my project too..

Move forward :-)..

Thanks!!

Bharath

Former Member
0 Kudos

Thank you for the info... I will try the way u suggested...

Krishna

Former Member
0 Kudos

Hi ,

I Thank you for the reply.

I have some doubts.

As I have posted earlier, My process schema have 2 process levels. my 1st process level will return the value "X" or space based on this the process level will be executed. My 2nd process level is an automatic approval.

I am doing as following to achieve my requirement.

I am getting the old value from BBP_PD_PO_GETDETAIL, and the changed value is imported from global memory, now I have the old and the changed value and I am doing the required manipulation with some conditions and based on this I will pass "X" or space to ev_value.

But the problem now is, for the first time after changing the value and ordering PO the FM will return "X" as result and the approvers are getting determined from the first process level and the status against each approver is showing as OPEN, But in the same PO screen if I press on REFRESH again the code is getting hit and this time the new and the old value is same and the conditions are failing and the FM is returning space and the 2nd process level is executed and the Active approver are gone even if the status against each approver is OPEN and the document is going for automatic approval.

Can you give any idea to resolve this. Help on this highly appreciated.

Thanks in advance. I am searching for a way to avoid this. Any information and ideas to achieve this will really help me.

Krishna.

Former Member
0 Kudos

To achieve your requirement I can say you going in wrong direction.. Before I put down my suggestion I like to explain you about the PO mechanism in SRM..

Whenever we talk about PO version management in SRM, we need to be aware of three type of document versions as following..

u2022Active Version

u2022Changed Version

u2022Historical Version

You can see this document versions under Tracking tab of PO Screen..

Now back to your problem..

In your case first you need to verify whether your PO document contains a change version.. Then compare the active version and changed version..

In your question the following line confuses me..

" But in the same PO screen if I press on REFRESH again the code is getting hit and this time the new and the old value is same and the conditions are failing and the FM is returning space "

Since you change the values, consider below example..

Price:

Active version price = $100/item or total value

Changed Version Price = $150/item or total value

How this will become equal if you hit refresh.. Looks like you not look into changed version info (Stop Looking into global memory)..

The following code sample should help you..

LOOP AT li_item_change INTO lwa_po_item_change.

  • Item could be deleted hence Looping on change item details ...

READ TABLE li_item_active INTO lwa_po_item_active

WITH KEY guid = lwa_po_item_change-active_item.

IF sy-subrc EQ 0.

  • Quantity or Price is increased ...

IF lwa_po_item_change-value GT lwa_po_item_active-value.

ev_value = 'X'. u201CSet value X as you do..

EXIT.

ENDIF.

ENDIF.

ENDLOOP.

lwa_po_item_change = Changed version PO Info (AS I explained above)..

lwa_po_item_active = Active version PO Info..

Thanks!!

Bharath