SAP Knowledge Base Article - Public

3273168 - How to create custom CDS view to display journal entries for a supplier invoice

Symptom

You would like to create custom CDS view to display journal entries for a supplier invoice.

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

SAP S/4HANA Cloud

Resolution

In CDS view I_JournalEntry there is a field "OriginalReferenceDocument" which is equal to the combination of field SupplierInvoice and FiscalYear in CDS view I_SupplierInvoiceAPI01.

You need to create a custom CDS view and create element A as the combination of SupplierInvoice and FiscalYear, and then create another custom CDS view to join the 1st custom CDS view and I_JournalEntry with join condition "OriginalReferenceDocument" = A so that the journal entries for a supplier invoice can be selected and displayed.

Detailed steps:

  1. Create 1st custom CDS view with data source I_SupplierInvoiceAPI01:


    Create Element “orig_doc” and add calculation for it as the combination of supplier invoice number and fiscal year:



  2. Create 2nd custom CDS view using the 1st custom CDS view as primary datasource, and I_JournalEntry as associated datasource:


    Click “Join Condition” and maintain it as following:

Keywords

I_SupplierInvoiceAPI01, I_JournalEntry, custom CDS view, supplier invoice, journal entry, join condition , KBA , MM-IV-LIV , Logistics Invoice Verification , Problem

Product

SAP S/4HANA Cloud all versions

Attachments

Pasted image.png