cancel
Showing results for 
Search instead for 
Did you mean: 

Determine if Account Assignment is used in SC

Jon_Rajewich
Explorer
0 Kudos

I would like to add an approval step via BRF Process Controlled workflow that checks if an asset account assignment exists in the cart.  I have tried several different approaches and none of them seem to work. 

The first, and the one that works most consistently, was a simple formula expression, AAC = AS.  This works so long as the AS account assignment is the only account assignment used in the cart.  If there is another cart line with a cost center account assignment, then this approach does not work. 

Next I tried using the expression 0B_SC_ACCTASSCAT_AS, but the notes say this one only works with item set decisions, not full document decision sets, and it doesn't work at all.

I tried creating my own version of class /SAPSRM/CL_WF_RULE_CONTXT_SC and creating modifying the method CONTAINS_ACCOUNT_ASSIGNMENT but even this isn't working, and its giving me an error message about the parameter type being incorrect.  (I can't find any documentation on this message, and don't know if its relevant to the issue)

Parameter for business object type incorrect

Message no. /SAPPSSRM/WFL_BRF001

Any thoughts on what I am missing or alternatives I can consider?

Thanks

Jon

Accepted Solutions (0)

Answers (2)

Answers (2)

robin_janke
Contributor
0 Kudos

Hi Jon,

you can use 0B_SC_ACCTASSCAT_AS for your requirement - all it does is take the shopping cart guid, loops over the items, checks the account assignment data for the existence of 'AS' and if it finds one it returns 'true'.

So that is exactly what you need.

I think the only thing you need to do is to create your own Z event which contains the standard expression 0B_SC_ACCTASSCAT_AS and assign it to your process level in the evaluation ID field.

Regards,

Robin

Jon_Rajewich
Explorer
0 Kudos

For some reason, when I use this approach, it added the designated approver to every cart, wether or not the account assignment actually exists in the cart.

robin_janke
Contributor
0 Kudos

I checked the method - it actually maintains an 'X' when the account assignment cat does not exist and clears it when it is found... So I guess if you have a SC with an AS it actually skips the approval when you use this expression.

On the other post you made:

Check if that zexpression is really correct. You need to have something like:

ZC_C1_C_CONTEXT_SC - with value ZCL_WF_RULE_CONTXT_SC

ZC_C2_C_METHOD - your method name in class ZCL_WF_RULE

0C_C4_C_ACCTASSCT_AS - as this is the AS constant, so you don't have to create a new one.

The ZC_C<number>_C part is really important is the BRF framework decides what type of import parameter that is.

Jon_Rajewich
Explorer
0 Kudos

Thank you Robin! The piece I was missing was the naming convention on the parameters.  I was able to successfully use my Z Class and Z Method in the BRF.  Since I had copied the code from the delivered Contains Account Assignment method, I was also able to change the return value so it returns an 'X' when the asset account assignment exits and blank when it doesn't.

Jon

Former Member
0 Kudos

Hi jon

You can create your own z event and expression for the current requirement.

make sure the exoression must be boolean type and it should contain function module as procurement type. inside your Z function module write code which ll identify the account assignment for every line item level and decide the value for field ev_value.

tell me how do u identify the approval based upon the Accounting data? have you created any custom table to store approver data ?

regards

sahil p

Jon_Rajewich
Explorer
0 Kudos

I have a Z Event using a Z Expression that I modeled after the delivered expression 0B_SC_ACCTASSCAT_AS but using my ZCL_WF_RULE_CONTEXT_SC class and my Z method.

I tested the class and method and it returns the correct result.

However, when testing in the full shopping cart, I get a message in SLG1 for this step saying “Missing parameter for method name; configure Business Rule Framework”

I can’t find any documentation on that message, do I need to register this class in BRF somewhere?

thanks

jon