CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
In the Manage Workflows application, you can define conditions that must be met to start an approval workflow. Some standard conditions are available, such as specifying a condition on marketing area. See blog post Setting up a simple approval workflow for the complete list of standard conditions.

It is also possible to add more conditions on custom fields or on standard fields for which conditions are not delivered. For example, for a campaign approval, you could define a condition based on the standard field Ignore Marketing Permissions.

See the following SAP Marketing Cloud online documentation for examples of definition of custom conditions for marketing approval workflows:

Example of custom condition for campaign approval

Example of custom condition for marketing plan approval

Example of custom conditions for program approval

This post presents a step by step example of defining one condition on a custom field of campaign. You can define as many custom conditions as you need for an object approval. See an example of the definition of two custom conditions in the above-mentioned documentation for program.

Procedure


Suppose you have defined a custom field for the campaign object. This custom field would be “approver level” in the following example. Depending on the value of this custom field, you want to be able to define conditions in campaign approval workflows.


Both BAdIs “Providing additional conditions for scenarios” and “Value evaluation of additional conditions for scenarios” should be implemented.

Implementation of the BAdI “Providing additional conditions for scenarios”


Under the Extensibility group, click on the application Custom Fields and Logic.


Click on the Custom Logic tab.


Click on the Create button. In the New Enhancement Implementation dialog, choose the business context ”Marketing: Campaign Approval Workflow” and the BAdI “Providing additional conditions for scenarios”. Enter an implementation description and press Enter.



Definition of the filter


For the approval workflow BAdIs, you must define the filter to specify for which approval scenario you are defining custom conditions. The scenario ID can be one of the following:

  • WS16800002 for campaign approval,

  • WS16800005 for marketing plan approval,

  • WS16800006 for program approval.


Click on the Filter tab. The default filter is on scenario ID “Initial”. Click on the edit button to change Initial to one of the scenario IDs mentioned above.


Click Save.

Definition of the logic


In the draft logic, there is a sample implementation that is very general. We recommend that you copy the sample provided in the documentation for the approval you are processing (for example campaign), or the one from this post.
CONSTANTS custom_condition_id TYPE string VALUE 'APPROVER_LEVEL'.

ct_condition = VALUE #( ( id = custom_condition_id
subject = 'Approver Level Is'
type = if_swf_flex_ifs_condition_def=>cs_condtype-start_step ) ).

ct_parameter = VALUE #( ( id = custom_condition_id
xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string ) ).

You can save the draft and publish.

Note: if you modify the implementation later, make sure the filter is not reset before republishing.

Implementation of the BAdI “Value evaluation of additional conditions for scenarios”


On the application Custom Fields and Logic, on the Custom Logic tab, click on the Create button. In the New Enhancement Implementation dialog, choose the business context ”Marketing: Campaign Approval Workflow” and the BAdI “Value evaluation of additional conditions for scenarios”. Enter an implementation description and press Enter.



Definition of the filter


Define the same filter as you did for the first BAdI implementation.

Definition of the logic


In the draft logic, you must figure out what is the technical name of your custom field in the CDS view for campaign. We suggest that you start with this piece of code:
SELECT SINGLE * INTO @DATA(campaign)
FROM i_mkt_initiative
WHERE campaignid = @is_sap_object_node_type-sont_key_part_1.

Then, by typing campaign-, and pressing shift-space, you can see all available fields and choose the one you want to define a condition on.


Now that you know the name of the field you are interested on, you can replace the whole implementation for a one similar as the following (with your own custom field instead of yy1_approverlevel_min).
CONSTANTS custom_condition_id TYPE string VALUE 'APPROVER_LEVEL'.
cv_is_true = abap_false.
IF is_condition-condition_id <> custom_condition_id.
RAISE EXCEPTION TYPE cx_ble_runtime_error.
ENDIF.
READ TABLE it_parameter_value INTO DATA(param_value) INDEX 1.
SELECT SINGLE yy1_approverlevel_min INTO @DATA(approver_level)
FROM i_mkt_initiative
WHERE campaignid = @is_sap_object_node_type-sont_key_part_1.
cv_is_true = xsdbool( approver_level = param_value-value ).

You can save the draft and publish.

Note: when you modify the implementation later, make sure the filter is not reset before republishing.

Conclusion


This blog post explains how to define and evaluate custom conditions for marketing approval workflow.

It is the fourth one of a series of posts on SAP Marketing Cloud blog posts. We hope that you will find them useful and informative. Give us your feedback, post your questions, follow us!

https://blogs.sap.com/2020/06/05/approval-workflow-in-sap-marketing-cloud-part-1-overview

https://blogs.sap.com/2020/06/08/approval-workflow-in-sap-marketing-cloud-part-2-setting-up-a-simple...

https://blogs.sap.com/2020/06/08/approval-workflow-in-sap-marketing-cloud-part-3-setting-up-a-multi-...

More Information


For more information about custom logic, see the SAP Marketing Cloud online documentation.
6 Comments