Discover the steps behind using the sort functionality in action job monitor, including how to define an action profile, extend the one order context, use a Business Add-In to fill the sort fields, and create a layout with sort fields. Because standard order context does not have the fields that the user for sorting data, this article helps bridge this gap.
Key Concept
The action job monitor is used to trigger the processing of actions for several documents. To use the action monitor to process actions, in the actions profile customizing screen, select the Process Using Selection Report option.
If you use the action job monitor (transaction CRMC_ACTION_JOB) to print documents, you might have a business requirement to execute the actions in a particular sequence (e.g., print service orders by ship-to party, employee responsible, or service date).
There is no standard documentation to use sort fields on the action job monitor. The following step-by-step instructions show how to define the sort attributes and use them accordingly. Your actions provide three sort fields to be used for sorting. The sort fields are on the action profile, and you can fill the fields with attributes from the order context in the action profile. The standard order context does not have the fields on which you need to sort. If you need to use additional fields (e.g., employee responsible or order date), you can extend the order context class and use the context extend Business Add-In (BAdI) to populate the additional fields in the extended context class. Let’s look at how to do this.
Extend the Context Class
The standard context class for one order documents is CL_DOC_CONTEXT_CRM_ORDER. Below are the steps to extend the order context:
- Identify the attributes that you need to sort. As an example, I use a service transaction with standard partner functions of ship-to party, employee responsible, and the date type SRV_CUST_BEG.
- Copy the standard context class CL_DOC_CONTEXT_CRM_ORDER and include the attributes needed. Here, I add the attributes ZSHIP_TO_PARTY, ZEMPL_RESPONSIBLE, and ZSERVICE_DATE.
- In the context class, fill in the attributes that you need (Figure 1).

Figure 1
Custom order context
Use Context Class in Action Profile Definition
Once you extend the context class, you can use it in your action definitions. Take the following steps:
1. Use the defined context class in the action profile screen via transaction CRMC_ACTION_DED (Figure 2).

Figure 2
Add in the context class
2. Add the sort fields from the context class to your action profile (Figure 3).

Figure 3
Add sort fields
Implement BAdI CONTEXT_EXTEND_PPF
The BAdi is filter-dependent, so use your action profile as a filter. Figure 4 shows an example with TPC Service as the action profile.

Figure 4
Set a filter for the BAdI
Implement the BAdI and fill in the custom attributes (as an example, I use ship-to party, employee responsible, and service requested date from the order header). I’ve provided sample that outlines how to fill the attribute values in the BAdI. Users can modify the code according to their needs. You can download this code at the end of the online version of this article under the Downloads heading.
In the post-processing framework action job monitor, the sort fields are filled in with the attribute values. Create a sorting variant and sort according to your requirement.
Create and Use Sort Layout
In the action job monitor, create a sorting variant and use the variant every time you run the monitor. You can also create an action job variant with the sort variant. Use transaction CRMC_ACTION_JOB to go to the output screen. On the toolbar menu, click the sort icon (Figure 5).

Figure 5
Click the sort icon
Add the sort fields to the Sort criteria and define ascending or descending order and the order of your sort fields (Figure 6).

Figure 6
Defining sort order
Click the save layout icon to save your sort order layout (Figures 7 and 8).

Figure 7
Click the save layout icon

Figure 8
Save layout screen
Now, enter the sort variant (/ZPPFSORT) that you created in Figure 8 in the action job monitor (transaction CRMC_ACTION_JOB) Variant for Sorting field. (Figure 9).

Figure 9
Action monitor with sort variant
If you run the action job monitor with the sort variant, the actions are sorted according to the sort criteria (Figure 10).

Figure 10
Actions grouped by sort criteria
Having completed the above steps, now when you execute the actions in batch mode or in dialog mode, the documents are printed in the sorted order.
Dwarakanath Maligi
Dwarakanath Maligi is a certified SAP CRM senior consultant with The Principal Consulting, Inc. He specializes in SAP CRM and SAP sales and distribution.
You may contact the author at dwarakanath.maligi@tpcus.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.