Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Srivatsa
Participant
0 Likes
558

🛠️ Step 1: Initialize the Service Generator

Start the Service Generator tool (often accessed via ADT or a relevant Fiori tool). You will typically begin by defining the main service configuration.

Srivatsa_0-1764935874648.png

Srivatsa_8-1764935963049.png

 

 

🔗 Step 2: Define Business Object Entities

The key to multi-entity services is correctly defining all entities and their relationships.

A. Define the Parent Entity (Header)

  1. Add Entity: Start by adding the primary, or "Header," entity. In your case, this is R_S2P_VendMGNT.

    • Entity Alias: R_S2P_VendMGNT

    • Parent Name: Not applicable (as this is the top-level entity)

    • Fields: Define the necessary fields, such as VendorLegalName1, ensuring correct data types and lengths (e.g., Char, length 10).

    • You dont have to pass the key field, it will automatically generate to SAP UUID.

Srivatsa_2-1764935910461.pngSrivatsa_3-1764935916589.png

 

B. Define the Child Entity (Item)

  1. Add Entity: Add the secondary, or "Item," entity, which represents the line items. In your scenario, this is R_S2P_VMITem.

  2. Establish Relationship: This entity must be defined as a child of the header entity to enable navigation properties in the final OData service.

    • Entity Alias: R_S2P_VMITem

    • Parent Name: R_S2P_VendMGNT (The header entity)

    • Cardinality: "To Many" - This is crucial as one vendor (header) can have multiple line items (items).

  3. Fields: Define the item-specific fields (your image shows fields being added to R_S2P_VMITem as well).

Srivatsa_4-1764935930924.png

 


⚙️ Step 3: Review and Generate Artifacts

After defining both entities and their relationship, you can proceed to the generation step.

  1. Review Artifacts: The generator will prepare a list of ABAP Repository Objects to be created. This list confirms the successful configuration of the multi-entity service.

    The generated artifacts will include:

    • Service Definition (ZUI_R_S2P_VENDMGNT...😞 Defines the entire OData service structure and exposes the entities.

    • Service Binding (ZUI_R_S2P_VENDMGNT...😞 Provides a deployable endpoint for the OData service.

    • SAP Object Node Types (ZR_S2P_VENDMGNT😞 Defines the underlying object structure for each entity.

    • Data Definitions (D ZC_R_S2P...😞 Defines the core ABAP structures.

    • Business Object Projection Entities: Maps the CDS entities to the Business Object layer.

  2. Generate: Click Finish to generate these artifacts.

Srivatsa_5-1764935949209.pngSrivatsa_6-1764935954019.png

Srivatsa_7-1764935958554.png

Srivatsa_9-1764935971191.png

 

🎉 Conclusion

By defining a hierarchical structure where the item entity is a child of the header entity with "To Many" cardinality, you successfully generate all required ABAP artifacts for a robust OData service that handles complex data from multiple source tables/CDS views. This service can now be consumed by Fiori applications to retrieve both header and line item data efficiently.

Srivatsa_10-1764935981706.png

 

Srivatsa_11-1764935990860.png

 

Srivatsa_12-1764935998981.png