Skip to Content

Co-Authored: Ritesh K Kumaria, Shekhar Razdan

In continuation to the previous Posts (The Semantically Rich Data Model – An ABAP based CDS Views example) & (The Semantically Rich Data Model – An ABA… | SCN )

Annexure 4: How to Expose CDS Views as ODATA


CDS as OData for AS ABAP 7.5.

  • Create a CDS view as follows.

ODATA_DDL.jpg

  • Copy the below code in the newly created CDS view.

ZCDS_ODATA_750.png

  • As soon as the CDS view is activated, service <ZCDS_ODATA_CDS> is created.

ODATA_MARKER.png

  • Navigate to the Tcode /IWFND/MAINT_SERVICE.
  • Click on the “Add Service”.

ServiceCatalog.png

  • Fill the following details on the subsequent screen

SelectBackendServices.png

  • Select the Service and click on Add Selected Services and Press Enter

AddService.png

  • The service created successfully

ServiceCreated.png


  • Service is available in the Service catalog. Double click on the highlighted row


ServiceCatalog2.png


  • For testing, Under the ICF Nodes section, Press SAP Gateway Client

ICFNode.png


  • Click on the “EntitySets” and press Execute button. The service is successfully executed, with data for CARRID = “AA”, Status Code = 200 OK.

EntitySets.png


  • On the CDS view Side we can click on the “OData-Service” under Generated Object and test the same as well


Click-OData-Service.png


  • For fetching the data add the entity set name< ZCDS_ODATA> at the last as shown the screen shot below

Fetch-Data.png


  • Themetadata for the service <ZCDS_ODATA_CDS> can be checked as well through the following

MetadataOdata.png

Annexure 5: How to Translate Labels in CDS Views


Column labels, Field Labels, Report names etc. can be specified while creating CDS Views. The Column and Fields can pick up labels from their corresponding Data Elements. This ensures that the translations for the Data Element Labels are available to the fields and thus no separate Translation needs to be done.

However, it is also possible to add fields in field list as literals that do not refer to any Data Element in particular. In such cases the field labels can still be specified using the Annotation “@EndUserText.label:”


The same annotation can also be used to specify the report name that is visible to the end user while consuming the report via an analytical client.  So how does one translate the labels that have been specified by using @EndUserText.Label: ?


Similar to other DDIC objects CDS Views are also translatable via TCODE SE63 (Translation Editor). 


  • Go to Transaction SE63 and client Button “Short Texts”.

ButtonShortText.png

  • On the Object type Selection Box Double click on A5 User Interface Texts -> DDLS CDS Views. Alternatively use the search buttons to find DDLS and then double click on it to move to next screen.

SelectObjectType.png

  • Give CDS name and Enter Source and Target Language and then Press “Edit”

SourceTargetLanguage.png

  • Subsequent screen opens with labels in Original Language and blank fields where corresponding translations can be given in target language. Save the changes when done

Translate.png

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply