Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
abprad
Active Participant
7,257
Introduction:

Starting from S4 Hana 1909, you can add custom pre-conditions to the Manage Workflow App for Purchasing. Like Purchase Requisition. (https://blogs.sap.com/2019/12/03/sap-s-4hana-cloud-flexible-workflow-with-new-custom-pre-condition-f.../)

A common requirement in such cases would be to add an F4 help for the new field. Found a few blogs that explain how to put the preconditions but none explain how to attach an F4 help to it.

So here is a solution for all such needs.

Requirement 

  • Add a new precondition to the Purchase Requisition Manage Workflow App in S4HANA 1909 (Follow the blog in the Introduction Section to add this )

  • Add an F4 help to the new precondition


 

Solution:

  • You have a parameter CT_PARAMETERS(refer blog in the introduction) to insert the condition.

  • This method parameter has 3 fields for F4 help addition,

    • service_path - the service path of your OData Service

    • entity - the Value Help entity of your OData Service

    • property -  the field/property in your OData Service for your field value.



  • In my case, I had a requirement of adding value help for Inspection Type from table QMAT.

  • I found standard CDS views I_InspectionLotType and I_InspectionLotTypeText that helped in creating a value help CDS view. To make life easier did a bit more debugging and found out SAP's given CDS view for the Standard Value Helps (S_MMPURWorkflowVH) and created mine similar to it.

  • Code excerpts below for the CDS

    • Composite View to create the Value help for Inspection Lot and Text - ZI_InspectionLotType

    • Value Help exposed view/Published View-  ZC_InspectionlotVH




@AbapCatalog.sqlViewName: 'ZINSCOMPTY'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Composite View for Inspection Lot'

@Search.searchable: true
@VDM.viewType: #COMPOSITE
@ObjectModel.representativeKey: 'InspectionLotType'

@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.usageType.dataClass: #MASTER
define view ZI_InspectionLotType as select from I_InspectionLotType as InspectionType
association to I_InspectionLotTypeText as _Instext
on _Instext.InspectionLotType = $projection.InspectionLotType //and _text.Language = 'E'
{
@Search.defaultSearchElement: true
key InspectionLotType as InspectionLotType,

@Semantics.text
@EndUserText.label: 'Inspection Lot Text'
_Instext.InspectionLotTypeText as InspectionLotTypeText
} where _Instext.Language = 'E';

@AbapCatalog.sqlViewName: 'ZCINSPLOTVH'
@AbapCatalog.preserveKey: true
@EndUserText.label: 'Inspection Lot VH'
@AbapCatalog.compiler.compareFilter: true
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #M
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.dataCategory:#VALUE_HELP
@OData.publish: true
@ObjectModel.createEnabled: true

define view ZC_InspectionlotVH
as select from tsproc_wf_vh as Document
association [0..1] to ZI_InspectionLotType as _InspectionType on _InspectionType.InspectionLotType = $projection.InspectionLotType //and _text.Language = 'E'
{
key '' as MMPURWorkflow,
@Consumption.valueHelp: '_InspectionType'
cast( '' as qpart ) as InspectionLotType,

//expose assoc
_InspectionType

}

 

  • Now after the CDS is created, Publish the Odata and register the service.

  • Now in the CFL app, we will pass the 3 fields that we discussed earlier as below. (code attached).


 ct_parameter = VALUE #(
( id = 1 name = 'Inspection' xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string mandatory = abap_false
service_path = '/sap/opu/odata/sap/ZC_INSPECTIONLOTVH_CDS/' entity = 'ZC_InspectionlotVH' property = 'InspectionLotType'
)
).

 

  • That's it, the F4 help will now come up on the Manage workflow App new precondition field (Screenshot Below)


 

10 Comments
Interesting blog Abhilash. Keep exploring new areas and post the same.
manish2110
Explorer
Very helpful blog Abhilash ?
Andrew
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Abhilash,

Thanks for the blog. Can this actually be done in S/4HANA Cloud Essentials?
abprad
Active Participant
0 Kudos

Hi Andrew,

I have tried this in a S4 HANA 1909 STE Cloud Extended environment.

Don’t have a cloud essential setup to check this. It would be great if someone shares the experience of doing it in the cloud essential version. The CDS can be created in Cloud essentials and the badi used is a cloud badi so theoretically it should work.

 

Regards,

 

Abhilash

 

 

 

rishilal061
Explorer
Nice blog Abhilash, well explained .
0 Kudos
Hi Abhilash,

 

I tried to add F4 functionality from custom table, but could not able to get it. Could you please provide me some steps using custom table.

 

Thanks Bala
abprad
Active Participant
0 Kudos
H Balakoti,

 

Sure give me a few days I'll give an example to you.

 

Regards,

 

Abhilash
0 Kudos
Hi Abhilash,

 

Thank you for the reply...i'm able to achieve the F4 functionality now. I was registering the service locally instead of gateway system. After registering the service in HUB system, it was working ...thank you for the detailed documentation.

 

Thanks

Balu
NooruBohra
Active Participant
0 Kudos
Hi abhilash.pradhan1 ,

Thank you for your blog post, really helpful. I'm following your step but not getting desired results. My requirement is not to have a custom field but to have PurchaseReq DocumentType which is there for header approval but not there for the item approval.

I implemented the BAdi and I was able to get the field.

Since it's standard and VH is already there in the CDS "S_MMPURWorkflowVH". So, I'm using this CDS and populating the parameters tab. Didn't create a new one.

When I tried to add search help the field doesn't display anymore. Upon commenting the parameters it starts to display again. Not sure what is the problem. Could you please help me on this.

 

Regards,
Nooruddin Bohra
former_member756432
Discoverer
0 Kudos
Hi Nooruddin,

 

I am facing the same issue as you.

Did you get any solution to this.?

 

Thank you.

 

Regards,

Tasneem K
Labels in this area