In this article we have just mentioned imported keys related to ODATA in ABAP.

Index

  • What is ODATA? Why we need it?
  • How to Create an ODATA Service?
  • Exploring ODATA
  • CRUD Operation via ODATA
  • Calling CLASS, FM in ODATA
  • Checking your Service: CRUD

 

Exploring ODATA

  • Data Model
  • Entity Types
  • Association
  • Entity Sets
  • Vocabularies
  • Service Implementation
  • Runtime Artifacts
  • Service Maintenance

 

What is ODATA

  • ODATA stands for Open Data.
  • It was created by Microsoft
  • Based on REST API.

Definition: ODATA is the representation of Data in form of XML/JSON.

  • XML for iosbased device, JSON for Android based device.

 

Why ODATA

  • To communicate between different Interfaces

 

How to create ODATA

  • Go to SEGW.
  • Create a new project
  • Import a DDIC Structure
  • Redefine the methods
  • Generate your ODATA
  • Register your Service

 

Data Model

  • A Data model can be anything : A table, A structure, A View.
  • When we import a DDIC structure, its Entity Types, Entity Sets, Service Implementation, Runtime Artifacts are created automatically.
  • A Data Model is the one that decides on which fields the CRUD operations will be performed

 

Runtime Artifacts

  • DPC& DPC_EXT
  • MPC & MPC_EXT
  • The mentioned above are four classes generated by SAP. We only redefine methods of EXT classes, because the codes written in DPC and MPC are provided by SAP, and will override our codes once ODATA is generated.
  • In DPC_EXT we perform CRUD operations
  • IN MPC_EXT we write annotations.
  • Annotations are the extra functionality we want to achieve that is not provided by SAP by default.

 

 

Operations in ODATA

  • CRUD Operation
  • Same codes that we write in ABAP report will be written here
  • Calling FM & Class
  • Same codes that we write in ABAP report will be written here
  • Taking Data from Frontend:
  • io_data_provider->read_entry_data(IMPORTINGes_data=wa_entity).
  • SendingData to Fronend:
  • et_entitysetor er_entity.

 

Check your Service via Service Maintenance

1.To read all files just open your entity and click GET and press Execute

2.To read one file -Write the primary keys in bracket just after the URI as mentioned here: (ACQ_ID=’NEW1′,BUKRS=’7070′).

3.To Create, you need to read one file. After reading, click USE AS REQUEST. Change the values of primary keys and other fields you want, click POST Radio Button, remove the Primary keys from URI and click Execute.

4.To Update Perform Step 02, Click Use as request, just change the fields other than primary keys, Click PUT Radio Button, and Execute.

5.To Delete, perform Step 02. Click Delete Radio Button, Execute.

 

What’s Next?

  • Association
  • Vocabularies
  • MPC_EXT
  • Mapping : CDS Views
  • Batch Operation
  • Function Import
  • SICF : Getting your Service Link
  • Whitelisting your Service

 

Reference:

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translate »