Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member582997
Participant
6,198
In the previous blog posts Part 1 & 2, I created a custom flexible workflow scenario and configured it. In part 3, I showcased the possibility of multi-level approvals.

In this blog post, I will focus on creating a custom value help for start conditions in flexible workflow.

 

Adding the links to previous blog posts for a recap:

Part 1, Part 2, Part 3.

SAP already has standard value helps for fields like Company Code, Profit Center, Cost Center, Material Group etc. What if we need a new field based on our requirements ?

For example, in my requirement I need a start condition for RE-FX Contract Type. This can be achieved by created a custom value help for the required field using CDS Views.

Solution


Find out the master table for your field. In my case it is TIV26.

Next up, create a custom CDS value help.

Go to File->New. In the pop-up, select ABAP->Core Data Services->Data Definition
@AbapCatalog.sqlViewName: 'ZV_CNTRTYPE_WFVH'
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #M
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.dataCategory:#VALUE_HELP
@EndUserText.label: 'Contract type Value Help'
define view ZC_CntrType_WFVH
as select from tiv26
association [1] to tiv2f as _RecnText on $projection.RecnType = _RecnText.smvart and
_RecnText.spras = $session.system_language
{
key smvart as RecnType,
_RecnText.xmbez


} where newcntype = 'X'

 

In the above code, I am reading contract type from table TIV26 & contract type text from TIV2F. I need the two fields to be displayed in search help. I am aliasing the field contract type as 'RecnType'.

 

Next, I need another CDS view to map the value help created in above CDS into the start condition field in Workflow.
@AbapCatalog.sqlViewName: 'ZV_CTYPE_VHMAP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Contract type Value Help Mapping'
define view ZC_CntrType_VHMAP
as select from swf_flex_ifs_vh

association [0..1] to ZC_CntrType_WFVH as _RecnType on $projection.RecnType = _RecnType.RecnType
{
key '' as dummy,
@Consumption.valueHelp: '_RecnType'
cast( '' as smvart ) as RecnType,

_RecnType

}

In the  above code, we are reading the value help from the first CDS created, and mapping it into field RecnType.

 

Now, go to /IWFND/MAINT_SERVICE in your gateway system. In add service, add the 2nd CDS. In our case it is 'ZC_CNTRTYPE_VHMAP_CDS' .

Once service is added, go to the gateway client. In the entitysets, you will see the name the entities available. We will be using 'ZC_CntrType_VHMAP' for our value help. That is the mapping which we did earlier. The other entity gives the list of contract types which is used to map to this entity.


Entity Set for CDS View


 

Now for the part of assigning this value help to our field in the workflow.

Go to SWDD_Scenario. Enter you workflow number.

In the flexible block, go to Value Helps Tab. In the field for which you need the value help, enter the details.


 


Value Help Assignment


 

Service path: /sap/opu/odata/sap/ZC_CNTRTYPE_VHMAP_CDS

Entity: ZC_CntrType_VHMAP

Property: ZC_CntrType_VHMAP

 

Once this is set, go to the conditions tab. Select on the field & click on parameter button. The green indicator button for the help field will be set.

Next, open the Workflow scenario in your Fiori launchpad, go to Add.

In Start condiitons, select your field, and you will be able to see the F4 help assigned to your field input.


F4 Help



 

Conclusion


This completes my 4 part blog post series on custom workflow scenario development. It has been a great learning experience. I hope my blog post series helps you design custom scenarios based on your requirements.

 

Thank you. 🙂

 

 
8 Comments