Hi Veselina,
Thanks alot for your detail email and all the open questions which I had in my mind as I was working on this requirement. I have listed few of them below.
1. Number of Line Items in Sales Order.
2. Whether Material will contain free goods/third party item/bom material etc etc.
3. The Status Profile can be assigned both at header and item level.
4. If status profile is assigned at item level, then it would be laborious job for the sales manager to go and approve each line item wise.
With respect to your workflow approach I agree that will completely new customised workflow which I think will not be into scope presently. So let us keep this out of picture for time being.
Now coming on to this requirement I have discussed above and my approach I would prefer to have the Status profile to be at the header level where in I will cumulate the total gross profit margin.
I will check how this behaves when there are 3 line items with different profit margin percentages.
Again here the pain point is if one line item has profit margin percentage less than 20% I need to write the logic in in completion log to reflect the line item in error log and the price has to be adjusted against the same so profit margin % has to be adjusted by the sales manager and then the order should be moved to approved status.
I will take care of the above.
I have created status profile with the below three status
1. INIT (Initial)
2. PEND (Pending).
3. APPR (Approved)
The reason I would like to share the inputs from you all is that I will be writing the logic in the User Exit MV45AFZZ so that when my sales order is created in VA01, the initial status will be INIT.
When the sales order is getting saved, at that time my code should check the overall value of the Profit Margin %.
1. If the PM% < 20 then the Order Status should be changed from INIT to PEND while saving.
2. If the PM% > 20 then the Order Status should be changes from INIT to APPR which saving as it satisfies the criteria.
With respect to the notification, I can include the logic in the Output which will only trigger when the Order Status is approved and notification email should be send to the Sales Person.
Please review the above approach and share your valuable inputs.
Thanks,
Farhan.