Learn how to configure a mechanism that controls which follow-up transactions will be available for a given transaction type based on the source transaction and status.
Key Concept
You create a follow-up transaction to directly follow another transaction. Data is transferred from the original transaction to the follow-up transaction, linking the two together.
In new versions of SAP CRM, the CRM WebClient UI is fully customizable, and configurators usually hide views and fields that are not relevant to the user. When a user wants to create a follow-up document, however, he or she receives a full list of all activities, tasks, and sales and service transactions according to copy control.
For example, perhaps your system handles parking tickets. Once a parking ticket is sent to a customer, the customer can appeal the ticket. It should not be possible to appeal twice on the same ticket, so the appeal option generally should not be available in the system after the first time. Having said that, the district might have two levels of appeal, so if the first level appeal is rejected it might make sense to allow a second level appeal. It might also make sense to disable the appeal option once the parking ticket is paid, as the customer will likely not appeal the parking ticket after this point.
I explain how to add an additional custom table that enables you to easily create and configure complex business scenarios. This new customizing table allows you to build a business process based on business transactions and statuses. You can thus control which follow-up documents are available.
Implementing this solution requires developer rights, and knowledge of ABAP. The solution described is based on SAP CRM versions 6.0 and 7.0.
Business Process
Let's take the parking ticket scenario I described above. You don’t want the customer to be able to appeal twice unless there is a second level of appeal, and you want to close the appeal after it is paid. The transaction types and status profiles needed to create the scenario are.
Transaction types:
- Z001 – Parking Ticket
- Z002 – First Appeal
- Z003 – Second Appeal
Status profile:
- Z001 (for the ticket)
- 0001 – Created
- 0002 – Sent to Customer
- 0003 – Paid
- 0004 – Canceled
- Z002 (for both appeals)
- 0001 – Created
- 0002 – Accepted
- 0003 – Rejected
Table 1 shows how to create the dependencies.

Table 1
Transaction and status profile dependencies
To implement this solution, you need to do the following in the system:
- Create a custom table and view
- Add the code that checks the table
Create the Custom Table and View
The custom table you build in this section is used to define the new logic desired, and the custom view is used to allow easy maintenance of these new settings.
1. Use transaction SE11 and create the table ZFOLLOWUP_DOC, with the description Follow-Up Document Setup, and the standard fields shown in Table 2.

Table 2
Fields for table ZFOLLOWUP_DOC
Click the Technical Settings button. Set the Data class field to USER and the Size category field to 0 as shown in Figure 1.

Figure 1
Populate the Data class and Size category fields
Activate the table using the activate icon.
2. Go to transaction SE11and create the view ZVFOLLOWUP_DOC. The tables are ZFOLLOWUP_DOC (which you just created), CRMC_PROC_TYPE, and CRMC_PROC_TYPE_T. Under the Table/Join Conditions tab, set the join conditions seen in Figure 2.

Figure 2
Set join conditions for ZFOLLOWUP_DOC, CRMC_PROC_TYPE, and CRMC_PROC_TYPE_T
Under the View Flds tab, enter the view fields shown in Figure 3.

Figure 3
Enter view fields
The process type (view field P_DESCRIPTION_20) is marked with R in order to disallow a process (transaction) type description change. Transaction descriptions are maintained in standard customizing and you do not want this new development to change them.
Under the Selection Conditions tab, set the condition shown in Figure 4. This causes the view descriptions to be displayed automatically in the language in which a user logs on.

Figure 4
Set selection conditions
Activate the view using the activate icon. Go to Utilities > Table maintenance generator using the SAP menu (Figure 5). Enter your authorization group if you wish to restrict the maintenance of this view with authorizations and enter a function group (new one or existing).

Figure 5
Add authorizations and function group
Create Code that Checks the Table
You next add code that checks the custom settings in the new table just created and restricts the types of follow-up document types displayed accordingly. Use transaction BSP_WD_CMPWB to enhance component BTFOLLOWUP under your project enhancement set (Figure 6).

Figure 6
Enhance component BTFOLLOWUP
Click the Display button in order to see the component (Figure 7).

Figure 7
View of component BTFOLLOWUP
The enhanced view is ProcTypeBo, and the implementation class in my example is ZL_BTFOLLOW_PROCTYPEBO_IMPL (use your own logic for class name). Implementation class names start with the letter Z, and it is recommended that the rest of the names be copied from the name of the original class.
In this class, you need to redefine method DO_INIT_CONTEXT and create four new methods, as shown in Table 3.

Table 3
New methods to be defined
Redefine method DO_INIT_CONTEXT. This is the method that calls all the new methods that are using the new customizing table (Figure 8). A downloadable version can be found here: Download New Method.

Figure 8
Redefine method DO_INIT_CONTEXT
Create Table Type ZFOLLOWUP_DOC_TT line type ZFOLLOWUP_DOC (Standard). Create method get_coco_context_node with the following parameters:
- IV_CNODE_NAME Importing Type SEOCMPNAME
- RV_RESULT Returning Type Ref To CL_BSP_WD_CONTEXT_NODE
The code for method get_coco_context_node is shown in Figure 9.

Figure 9
Create method get_coco_context_node
Create method allowed_followup_proctypes_get with the following parameters:
- IR_BTADMINH_ENTITY Importing Type Ref To CL_CRM_BOL_ENTITY
- RV_RESULT Returning Type ZFOLLOWUP_DOC_TT
The code for method allowed_followup_proctypes_get is shown in Figure 10.

Figure 10
Create method allowed_followup_proctypes_get
Create method exist_followup_doc_get with the following parameters:
- IR_BTADMINH_ENTITY Importing Type Ref To CL_CRM_BOL_ENTITY
- RV_RESULT Returning Type /1BEA/RT_CRMB_SRC_GUID
The code for method exist_followup_doc_get is shown in Figure 11.

Figure 11
Create method exist_followup_doc_get
Create method follow_up_doc_list_restrict with the following parameters:
- IT_PROCESS_TYPE Importing Type TT_FOLLOWUP_DOC
- IR_PROCTYPE_COLL_WRAPPER Importing Type Ref To CL_BSP_WD_COLLECTION_WRAPPER
The code for method follow_up_doc_list_restrict is shown in Figure 12.

Figure 12
Create method follow_up_doc_list_restrict
After completing the code, you activate the DO_INIT_CONTEXT and the new Z methods using the activate icon. You are now ready to start testing your new functionality.
Uri Dembo
Uri Dembo has been an SAP consultant since 1997 in the areas of SAP ERP SD and SAP CRM. He is the CEO of Fishman Dembo Consultants, Ltd., an SAP Special Expertise partner in the area of SAP CRM. He is also an SAP CRM team leader at Colmobil Israel.
You may contact the author at info@fdc.co.il.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.