Invoices are posted from SRM to ECC as IDocs whose message type is BBPIV. When there is an error in the IDoc input such as invalid IO and GL, invalid company code etc., these IDocs will be moved to status 51.
When IDoc is moved to status 51, work item need to be sent to approvers saying this IDoc has an error and need to be corrected. For this a workflow task needs to be developed.
In our system, there are two types of IDoc invoices sent to ECC. One is of type INVOIC01 and another is of type BBPIV01. There already exists a standard task TS00008057 which is activated for the event INPUTERROROCCURREDMM for IDOCINVOIC object type.
I shouldn't use the same event (INPUTERROROCCURREDMM) and IDoc object type(IDOCINVOIC) for BBPIV01, because responsible agents for both type of invoices are different in our company.
Please help us in getting this resolved. Also let me know if my approach is wrong towards this problem.
Using the same BOR object and event for two different idoc types is not necessarily wrong. There are ways to differentiate the responsible agents based on the idoc type if needed.
Here is how I would solve this:
Prerequisite: you need to make sure that event IDOCINVOIC.INPUTERROROCCURREDMM is triggered when your BBPIV01 iDoc is in error. To check that, you can activate the event trace and test your idoc (activate with tx SWELS, display with tx SWEL).
If the event does not trigger then you need to find out which event is getting triggered (using the event trace as well).
Now the serious business:
1. Create a copy of standard task TS00008057 that will be used for when BBPIV01 iDocs are in error.
2. Link this task to your event IDOCINVOIC.INPUTERROROCCURREDMM in transaction SWETYPV
3. Check in SWO1 if you have an attribute that gives the idoc type (or anything else which you can use to determine wich workflow should start in each case).
If not you need to create a subtype of IDOCINVOIC and in the subtype create an attribute that returns the iDoc type. Then you would need to delegate IDOCINVOIC to your subtype.
4. Create start conditions (tx SWB_COND) in which you check that TS00008057 starts only when idoctype is INVOIC01 and your new task starts only when idoc type is BBPIV01.