Enhance the Check Cash Flow Item Fiori app

System: S/4HANA 1909

Preparation

Application to be enhanced:

https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps(‘F0735’)/S18OP

Task: Add new column to the Analytical List and populate with data

SAP Help

https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ac319d8fa4ea4624b40a58d23e3c4627/c76d8054f87c033de10000000a441470.html?q=Cash+Flow+Item&locale=en-US&version=LATEST

So far so good. One would think, this can be done easily – like me facing first time enhancement of Analytical list. I even have an official guide, so I will be ready in 1 hour. Great, since according the SAP description everything was familiar to me already.

The reality not 1 hour, not even 2 . I struggled and had to deal with some unmentioned annotations. At least SAP Help expects from you to know them, without any further details.

The enhancement process

Extend the customer include structure

@EndUserText.label : 'Payment Item Extension'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
extend type fclm_cp_s_entity_pay_item_incl with zfclm_cp_s_entity_pay_item_a01 {
  zzdocumentreferenceid : xblnr1;

}

Create CDS View Extension of Fclm_Paymentdetailflow

@AbapCatalog.sqlViewAppendName: 'ZVAPD_PAYMEN_A01'
@EndUserText.label: 'Payment Item Extension'
extend view Fclm_Paymentdetailflow with ZFclm_Paymentdetailflow
{
  _AccountingDocument.DocumentReferenceID as ZZDocumentReferenceID
}

Dynamic entity property

Instead of redefining the standard OData service FCLM_CP_PAYMENTDETAIL, and replacing this standard service within a brand new Fiori extension app for FIN_PAYDETAIL, I rather added the new property to the standard service FCLM_CP_PAYMENTDETAIL_SRV dynamically. To do so, Ian implicit enhancement was created at the end of the define method of the model provider extension class CL_FCLM_CP_PAYMENTDETA_MPC_EXT. Future system upgrades delivering new features kept, good.

  "Add reference Document ID to PaymentDetail Item, so that available on UI
  "This solution is combined with the CDS View extension ZFclm_Paymentdetailflow
  DATA(zz_entity_type) = model->get_entity_type( iv_entity_name = 'PaymentDetailItem' ).
  DATA(zz_property) = zz_entity_type->create_property(
    iv_property_name  = 'ZZDocumentReferenceID'
    iv_abap_fieldname = 'ZZDOCUMENTREFERENCEID'
  ).

  zz_property->set_type_edm_string( ).
  zz_property->bind_data_element( EXPORTING iv_element_name = 'XBLNR1' ).

Let know SADL about the new property

Mapping new property via SADL is done by IF_SADL_GW_EXTENSION_CONTROL~SET_EXTENSION_MAPPING method of class CL_FCLM_CP_PAYMENTDETA_DPC. Enhance this to map the new property to the ABAP field which was appended to the structure in the first step. This structure is configured in SEGW for the OData entity PaymentDetailItem.

  "Add reference Document ID to PaymentDetail Item, so that available on UI
  "This solution is combined with the CDS View extension ZFclm_Paymentdetailflow
  CASE iv_entity_set_name.
    WHEN 'PaymentDetailItemSet'.
      io_extension_mapping->set_property_mapping(
        it_property_mapping  = value if_sadl_gw_extension_mapping=>tt_property_mapping(
          (
            property_abap_name = 'ZZDOCUMENTREFERENCEID'
            business_entity_element  = 'ZZDOCUMENTREFERENCEID'
          )
        )
      ).
  ENDCASE.

Result

User can select the column in the Fiori app, but content still empty. What am I missing ?

Analysis of the empty column

However column visible on UI, the OData request for the sap.ui.comp.smarttable.SmartTable of type sap.ui.table.AnalyticalTable deos not request the new property through the binding. The OData request does not contain the property on the SELECT list.

A new area, new problems. SAP documentation gives no more support. UI5 Guideline, a snippet available, but also not working within an extension project. Hmmm… Ok lets start further deep dive in analysis.

Common issue with the thousand of SAP Fiori apps, that applications were delivered by SAP at one of the plenty stages of the Fiori and OData evolution Absolutely not obvious, where the job is to be done. In UI5 or CDS or OData service configuration or in SEGW or dynamic programming? This results in lot of headaches for customers.

In this case Freestyle Fiori app is delivered, OData service manually implemented, based on CDS and SADL intermediation, but not as a reference CDS entity/model. So annotations were implemented with tons of manual work those times, and of course later appeared the helper classes.

OK, lets check the MPC_EXT class, and define method in detail which is responsible for any annotation and model extension. There are some interesting annotations which might be in focus for Fiori ALVs. As I saw “dimension” and “single value”, I felt, I am on the right track in context of analytics. Anyway, nothing to lose, to add such annotations for my new extension field, due I do not want any aggregation or grouping. So at the end my extension define looked like this:

  "Add reference Document ID to PaymentDetail Item, so that available on UI
  "This solution is combined with the CDS View extension ZFclm_Paymentdetailflow
  DATA(zz_entity_type) = model->get_entity_type( iv_entity_name = 'PaymentDetailItem' ).
  DATA(zz_property) = zz_entity_type->create_property(
    iv_property_name  = 'ZZDocumentReferenceID'
    iv_abap_fieldname = 'ZZDOCUMENTREFERENCEID'
  ).

  zz_property->set_type_edm_string( ).
  zz_property->bind_data_element( EXPORTING iv_element_name = 'XBLNR1' ).  
  cl_fis_filter_annotation=>single_value(
    io_model = model
    iv_entity_type = 'PaymentDetailItem'
    iv_property    = 'ZZDocumentReferenceID'
  ).

  cl_fis_sadl_annotation=>dimension( 
    io_model = model
    iv_entity_type = 'PaymentDetailItem'
    iv_property    = 'ZZDocumentReferenceID' 
  ).

Voila, I got the values!


Lesson

We can be experienced with CDS for example, but a slap can come, although this is the opportunity to learn new undocumented things and features of variety of SAP frameworks . In this case we know how or manually manage annotations for analytics, instead of dealing with CDS view annotations.

An alternative way for calculated properties

So what if the value in your custom field cannot be populated into the new ZZ field by simply a CDS View extension, but have to be calculated dynamically. Do not be sad, here are actually two alternatives.

A. Implement BAdI fclm_cp_payment_item_details

B. Create a virtual element in the CDS View

SAPDEV.EU
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.