OpenText VIM: Adding Custom Fields to VIM Analytics powered by HANA
This blog is for beginner developers in OpenText VIM. It also gives fair idea to developer on how to approach extensions of standard VIM Analytics report (/n/opt/VIM_VA2) with custom fields.
- The blog is relevant if your VIM Analytics is running on a SAP NetWeaver AS ABAP 7.40 SP05 or higher and if the data selection is configured to be done with ABAP CDS views.
- Custom field is enabled in VIM customizing via transaction code /n/OPT/VIM_1CX1. In our case we are taking CUSTOM_FIELD0 field which is present in header table /OPT/VIM_1HEAD.
We have requirement of extending one of the most important and central reporting standard report VIM Analytics (transaction code /n/opt/VIM_VA2). The blog is only relevant if your VIM Analytics is running on a SAP NetWeaver AS ABAP 7.40 SP05 or higher and if the data selection is configured to be done with ABAP CDS views. The involvement of SAP HANA and CDS actually makes the report processing and responding quite fast.
Initial screen of VIM Analytics report (/n/opt/VIM_VA2) looks like:
On execution, output looks like following screen. On this screen, we need to add an additional custom field which already exits in the VIM header table(from Table /OPT/VIM_1HEAD, field CUSTOM_FIELD0).
Steps to add custom field:
- Append the field CUSTOM_FIELD0 via Append Structure option to standard structure /OPT/VVA2_OUT_DOC_HDR_ST (VIM Analytics 2: Document Header List Fields) which is the VIM Analytics report output ALV structure.[Note: In case you want to add field to report line item view, Append custom field to structure /OPT/VVA2_OUT_LINE_ITEM_ST. In case you want to add field to report process view, Append custom field to structure /OPT/VVA2_OUT_WORK_ITEM_ST.]
- Append the field CUSTOM_FIELD0 to structure /OPT/VVA2_CDS_DOC_HDR_ST (VIM Analytics 2: SAP CDS Document Header List Fields). This is to fetch header data from CDS view.
- Now run the /n/OPT/SPRO transaction and navigate to Vendor Invoice Management > Cross Component Configuration > VIM Analytics (New) > Maintain Customizing Profiles. Select the DEFAULT profile and navigate to Define Field Mapping. Add the following details as a new line in Field Mapping for this custom field.
Selection Mode Use ABAP CDS views
View Type Header View
Database Field Name CUSTOM_FIELD0_O
Input/Output field of data selection Output Field (as for report output)
Application Field Name CUSTOM_FIELD0
- Till now, we have done the changes in ALV structure for output and the Field Mapping. In previous step, we define Database Field Name CUSTOM_FIELD0_O. This is the only disconnect we are left with as of now.
Now to flow data to this Output Database Field Name from Database we need to enhance CDS views based on which the report is running.(a) Enhance the CDS view /OPT/VVA2_DPO to include this field to be returned from view as below:
(b) And also we can observe, the CDS view /OPT/VVA2_DPO has the base view /OPT/VVA2_COMO which we also need to enhance to let data flow from the underlying base table .
Now when we run the report /n/opt/VIM_VA2 (VIM Analytics) and change the report layout, we can see the additional field we added in the list and upon selection the output will show the additional field with data.
I hope above blog will be somewhat useful for basic understanding and working of enhancements in OpenText VIM (VAN to be more precise).