mnm0 2013-05-31
By Abhijit Daptary & Siddharth Samal, Capgemini India
From link.
Pre-requisites.
It is assumed that the reader of this article has some knowledge in SAP workflow BOR objects and ALE Idoc process like process code, Partner Profile etc.
Description
Here, we will be discussing in details the Error handling of an Inbound Idoc through triggering an event, which in turn will be triggering a workflow attached to the workflow.
Steps:-
Creation of BOR objects. Go to the transaction SWO1.
Enter a name for the Object type and click ‘CREATE’ button for creating the custom BOR object.
Enter the details required for creating the BOR objects...
Create the Key fields and events of the BOR object.
For creating the Key fields place the cursor on the Key fields and Click on the Create Button
Create events for triggering the workflow and stopping the workflow.
For creating the event place the cursor on the EVENTS and Click the create button like Key fields.
Create two events.
Enter the event name description etc and proceed further to create it.
Similarly create another event for ending the Workflow in the similar manner like that created earlier.
Now, Generate the BOR object through the generate button
Release the EVENTS and subsequently release the BOR object.
After the creation of BOR object
Create a workflow for the generation of notification whenever an error is reached in the Inbound Idoc.
Execute the transaction SWDD.
Click on the CREATE button for creating the workflow for error handling.
Choose the Step type to be inserted for the notification like here we are using Send Mail option for sending a mail to the user whenever any error occurred.
Activate the Workflow and test it whether it is working as per the requirement.
After the successful completion it is required to attach the workflow with the event.
Go to the Header section (Denoted by CAP).
Go to the Start Events TAB.
Enter the details of the event with which the workflow should be linked like the category, BOR object type and the event with which that should be linked.
Enter here the BOR object that has been created and give the name of event created for starting the workflow.
Click on the Binding Button for generating the binding between the event and the workflow.
Generate the binding and click OK button to save the binding.
Click on Activate / deactivate button for activating the linkage.
After the successful linkage the following sign will appear on the workflow.....
This shows that the workflow has been linked to the event and it will be triggered whenever that particular event will be triggered.
After the creation and successful linkage of workflow with the event it is required it is required to generate a function module and attached it to the process code.
Go to SE37 transaction and copy a standard process code function module to a custom one. Do no delete any parameters from the function module as the SAP standard program itself is calling this.
In that function module do the required validation and whenever the validation fails set a standard parameter ‘WORKFLOW_RESULT’ to 9999 from within the function module, otherwise normally proceed to set the status to 53.
After the creation of function module it is required to attach it to the process code and corresponding attached to the message type at the Partner Profile stage.
The process code is being created through the transaction WE42
Go to the change mode and click the New Entries button for creating new process code.
Enter the Process Code Name, description and choose the processing type as Processing by function module. Click on the extension button of Identification.
The details for the of the Process Code after clicking the identification button will be
Whenever idoc arrives into the Destination system then the standard SAP triggers the Process code attached to the Message type in the partner profile. The partner profile is being maintained in the transaction WE20.
Since, it is and inbound scenario so the message type and the corresponding process code will be maintained for the Inbound Parameters.
Click on Create Inbound Parameters button for creating new Inbound Message type and the corresponding message type.
Enter the process code for the corresponding message type.
Click SAVE button for saving the changes.
Whenever the IDOC arrives into the target system, it checks the partner profile and finds the corresponding process code. The process code is being linked with the function module through which the IDOC is required to be processed.