Odata Interview Questions
Odata Interview Questions
QUESTIONS AND
ANSWER MADE EASY
By Pankaj Kumar
ABAP|OOPS ABAP|ABAP ON
HANA|ODATA|ALE IDOC Trainer
Email – [email protected]
WhatsApp: +918700435272
--Training is my Passion
Website: www.saptechmadeeasy.com
Morning ABAP Ritual – Get Mastery in ABAP
related Technology
Web Services?
->One which provides the service on the web / to the web
What is web service? REQUEST
Browser/Client
How web services generated by protocol system
Cookies
RESPONSE
Web services
• It is open standard to send the data back and forth between two system via REST using HTTP
SOAP REST
• Like Envelope • Like Post Card
• No that much secured
• Inbuilt high security feature comparatively. Workaround is
• Heavy required
• Light weight
• No Good Performance • Super Performance
• HTTP/SMTP/FTP etc. • Only HTTP
• XML(WSDL) Based protocol • Architecture Based Protocol
• Stateless
• State full
Example 1 – SOAP vs ODATA
Example 2: SOAP Vs OData
Last 4 Slides:
Credit: Anubhav Sir – Videos
Link: - https://www.youtube.com/watch?v=v_xPlRumdbE&t=34s
2
9th Feb
Why SAP needed OData?
Ans. SEGW
What is Entity
Google Translation in Hindi
Entity Type: It is blue print / Structure for Entity set. Entity type must have key
defined.
Ans.
What is the other name of O Data ?
What are the Gateway Deployment in order to generate the OData we have?
1. Hub Deployment
And
2. Embedded Deployment
UI5/FIORI
Hub / Central
SAP GATEWAY
Deployment
RFC
DM01
DM02(CRM) DM03(SRM)
If your system is on NW7.3 or Before what are the components need to be installed in order
to enable the SAP Gateway?
Q. If you are on NW7.4 onwards release which component need to be installed in order to
enable the GW
Ans. SAP_GWFND.
Q. How you will identify in your system if it is Hub Deployment or Embedded Deployment?
1. Go to SEGW.
2. Maintenance Service – if some artifact is there then that is Embedded
otherwise it is HUB.
Session 3
10TH Feb
What is the t-Code to Register the Service? VVI
Ans./IWFND/MAINT_SERVICE
Ans. /IWFND/GW_CLIENT
Ans. /IWFND/ERROR_LOG
Q. What are the classes generated when we create and activate a project?
Ans.
DPC
DPC_EXT
MPC
MPC_EXT
Q. What is the Architecture of SAP OData?
• OData Model
• Used to represent the
data form different
sources into single
format
• OData Service
• Odata Model is
exposed using Odata
Services using Odata
Protocol and Odata
Libraries
• OData Protocol
• Best on REST Principle
• OData Client Libraries
• Used by Browser of
Client application to
access the data using
O Data Protocol
Session 4
11-Feb
Q. What are the different way of generating O Data Service?
Ans.
1. ABAP Code based Implementation -> Write the Code in typically in DPC Extension Class
2. Mapping Editor -> In SEGW gateway builder, you can map an ABAP CDS Views as a data source to the entity
type properties. SADL Framework will generate the O data Service to retrieve the data from CDS.
3. Data References -> Using the Referenced Data Source - In SEGW gateway builder, you can reference an
ABAP CDS Views as a data source. Each entity type in OData service model corresponds to 1 ABAP CDS view.
4. Using Annotation
@Odata.publish: true
Q. What is SADL?
Ans.
SADL – Service Adaptation Description Language
• This is a framework which generates the O Data service from the
CDS
CURD
C-> CREATE
U-> UPDATE
R-> READ
D-> DELETE
CRUD
• Create – Includes the business logic to create data in the back-end system.
• Delete – to delete the data from the back-end system.
• GetEntity(Read) – to read the single record details from back-end system.
• GetEntitySet(Query) – to read the list of data from the back-end system
• Update- to update the data into back-end system.
Q. On top of which artifact you perform the CURD/CRUD operation?
1. Entity - NOT
2. Entity Type – Not
3. Entity Set - Yes
Q. What is Function Import? VVI
Ans.
• Function Imports are the actions like release of a sales order/purchase
order executed in the back-end system.
• Function Imports can be used when ever the given requirement does not fit
into the CRUD-Q operations.
• They are defined at service level and you can have N number of function
imports functions.
FI_PORELEASE
ET_eMPLOYEEseT
Q. In Odata, when you create and activate the project what are the classes generated?
Q. If you want to implement fetching logic for header and item which method need to be opted to VVI
write
Ans. Get_Expanded_EntitySet
VVI
Q. If you want to implement record creation logic for header and item, which method to be opted.
Ans. Create_Deep_EntitySet
VVI
What are the HTTP methods
Patch -> This is the Actual HTTP Method. We are supposed to use the PATCH (SAP NetWeaver
Gateway 2.0 SP05)
Merge -> it is given by Microsoft. Hence it is not global Standard. So the preferred approach
should be PATCH.
VVI
Q. What is the Difference between PUT( Complete Update) and ( PATCH/Merge =>
Partial Update)
PATCH -> In patch from the frontend , all the fields are not required. We can send only specific field which
need to be updated.
Session 5
12th Feb
Q. What is the T-Code for Cache Clean Up?
Ans. /n/IWFND/CACHE_CLEANUP Q. In case of Embedded Scenario, What is
the T-Code to Clear the cache?
Q. What are the different way of cleaning the Cache?
Ans.
1. Globally for all the services in case we have central hub scenario– Ans. /n/IWBEP/CACHE_CLEANUP
/n/IWFND/CACHE_CLEANUP -> Gateway
/n/IWBEP/CACHE_CLEANUP-> BACKEND
or IN case of Embedded Scenario- Method Signature:
/n/IWBEP/CACHE_CLEANUP-> BACKEND
/iwfnd/cl_sutil_moni=
2. Specific to Service
/iwfnd/gw_client-> More-> Metadata-> Clean up >cleanup_metadata_c
3. Using Class method - ache(
/iwfnd/cl_sutil_moni=>cleanup_metadata_cache EXPORTING
iv_mode = 'A'
iv_multi_origin = abap_true
iv_namespace = '/SAP/'
iv_service_name = 'Your Service Name'
iv_service_version = '0001'
IMPORTING
ev_error_text = lv_error_text
).
In this method, we make use of the TCodes /n/iwfnd/maint_service and /n/iwfnd/gw_client to
clear our metadata cache. Follow the below steps:
To clear the metadata cache using the above process, for the Embedded implementation, it is enough to clear
only on the back end system, but in Hub implementation, it is mandatory to clear the cache on both systems
to properly clear the metadata cache.
VVI
Ans.
Whenever we do any changes at service level and those changes are not reflecting then we are supposed
to do both type of Cache Cleanup.
When we add / delete / modify any property in the entity set or an annotation in the CDS or any BOPF
functionality such as Creatable, Updatable or Delectable, then we need to clear the metadata cache for
our changes to be visible in the Metadata.xml file of the OData service, which can then be consumed in
any UI5 application.
Session 6
13-Feb-2020
Q. How to do file / Image handling in Odata? VVI
VVI
• /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_STREAM.
• /IWBEP/IF_MGW_APPL_SRV_RUNTIME~UPDATE_STREAM
VVI
ABCD123 ABCD123SUGAR
E-TAG
SAP GATEWAY
Entity Tag
EKPO
14-Feb-2020
What is the function module to generate the Hash Value for Etag?
Ans. FM is - ‘CALCULATE_HASH_FOR_RAW’
Q. How to Troubleshoot if your break-point is not triggering which was already triggering
sometimes back?
Ans. /n/IWFND/TRACES
Q. Suppose you want to delete the Odata Service. Is it possible to delete directly.
Ans. No.
Ans. It will give the error – ICF Node will be deleted first
Note: when you will try to delete the ICF node it gives the error - “Object directory entry
cannot be deleted, the object is locked”.
15th Feb
Navigation & Association
EKPO – ET_PO_ITEM
Po No. Item material
1 10 Laptop
ET_PO_ITEM_DESC 3 10 PRINTER
Po No. Item Material Desc 3 20 INK
1 10 Big Laptop
1 20 Big Mouse, Black
1 30 CPU, i7 processor
Q. What is Navigation?
Ans. In case one Entity set is associated with multiple entity set, then
in order to determine from which entity set, data need to be fetched
is determined by navigation properties.
Q. What is Association?
*****************************************************************
Get number of entries - /sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POHeaderSet('4500000001')/$count
*****************************************************************
Extract only some fields of the Entity Type ($select=Field1,Field2,Field3)
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POHeaderSet('4500000001')?$select=Ernam,Bukrs
*****************************************************************
Session 9
16 Feb 2021
Get all the PO Items( ET_POITEMSET_GET_ENTITYSET method should be implemented)
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POItemSet
*******************************************************************
Get the specific PO ITEM( ET_POITEMSET_GET_ENTITY method should be implemented )
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POItemSet(Ebeln='4500000002',Ebelp='00010')
*******************************************************************
Get few fields:
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POItemSet?$select=Ebeln,Ebelp,Werks
*******************************************************************
in json format
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POItemSet?$select=Ebeln,Ebelp,Werks&$format=json
*******************************************************************
get the count
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POItemSet/$count
*******************************************************************
Access a specific field
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POItemSet(Ebeln='4500000000',Ebelp='00010')/Menge
*******************************************************************
Multiple Values
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POHeaderSet('5815000026')/HeadToItemNav?$format=json
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POHeaderSet('5815000026')/?$expand=HeadToItemNav&$format=json
Q: What is the difference between the below two URIs?
1. /sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POHeaderSet('5815000026')/HeadToItemNav
2. /sap/opu/odata/SAP/ZABAPRITUAL_SRV/Et_POHeaderSet('5815000026')/?$expand=HeadToItemNav
Session 10
17TH Feb
/sap/opu/odata/SAP/ZABAPRITUAL_SRV/ => Resource Root
Et_POItemSet(Ebeln='4500000002',Ebelp='00010') => Resource
?
Export:
_GET_ENTITYSET <ENTITYSET Path> = /sap/opu/odata/sap/<SERVICE NAME>/<ENTITYSET Name>
ET_ENTITYSET
Import:
IT_NAVIGATION_PATH
_GET_ENTITY In case if we had association and navigation between 2 entities
Export:
ER_ENTITY
Import:
IV_ENTITY_NAMEIV_ENTITY_S
ReosouceRoot/<ENTITYSET Name1>(<‘value’)/<ENTITYSET Name2>
ET_NAMEIT_NAVIGATION_PAT
_EXPANDED_ENTITY OR
HIT_KEY_TAB
ResourceRoot/<ENTITYSET Name1>(<‘value’) ?$expand=<ENTITYSET Name2>
Export:
ER_ENTITYSET
What are the different status codes and their Meaning?
405 Method Not Allowed A request cannot be used for this record.
Entity Name, Entity Type and Entity Sets are case sensitive or not?
Ans. - Yes
Ans.
Bad Request(400) – Incorrect URI
Bad Gateway(502) – SAP NW Issue
Session 11
18t – Feb
Q. What is Batch Call Processing? VVI
If you want to perform the multiple operations on a single or multiple entity together
then we go for Batch Call Processing.
It helps to improve the performance and to maintain the data integrity and consistency
while processing. It gets processed normally in parallel
Q. What HTTP method need to be called in order to call the Batch Processing?
Ans. POST
Q. Where we can define the number of parallel queries for Batch Call processing?
Ans.
In case if you want to disable the activation of parallel batch request, how to do?
Source:
https://blogs.sap.com/2018/05/06/batch-request-in-sap-gateway/
Q. Can we use multiple one or more Update/delete/insert operation within a “Changeset”?
Yes
Q. Can we use “Commit work” statement within any one UPDATE/CREATE/DELETE entity method.
No
Go into dump
Q. What prefix need to be used in HTTP header in order to segregate the multiple batch request separately?
19TH Feb
What is the correct Full form of CSRF ?
or example, a typical GET request for a $100 bank transfer might look like:
A hacker can modify this script so it results in a $100 transfer to their own account. Now the malicious
request might look like:
Q. Do we have to take care while performing the post call from Gateway/Fiori/UI5 Application?
1. It is required when you are going to call the Odata Service from third Party Application – PostMan,
Java Application, Any .Net Application
2. From UI5/Fiori also it can be required if you are not going to make the Odata Call. Rather you are
making a REST based call using AJAX.
Ans. First make the Get call and the get the token.
Once you get the token, pass this token during post call and then only you will be able to
perform
What is the T-Code to set the parameter to enable or disable the CSRF Token Request?
Ans. T-Code is SICF Parameter Name: ~CHECK_CSRF_TOKEN . Here value =1 => Enable
and 0 => Disable
Q. If you are going to make that parameter(~CHECK_CSRF_TOKEN ) disable then do you not have to
do anything while posting from the third party application or using the AJAX Call?
SAP USER –
FIORI/UI5
RFC
1. Use the $expand in query string – It will reduce the roundtrip time
GET_EXPANDED_ENTITY
GET_EXPANDED_ENTITYSET
3. $Batch Call – grouping the multiple operation together in one Odata call
4. Deep Insert
6. $select
7. $filter
Sap suggests to use Co-Deployment whenever possible because 2nd option ( Co-deployment ) is 15%
is faster than 1st one( Routing Based)
Total = 100ms, GWHUB = 50ms , GWRFCOH = 10ms, Gwbe = 20m
Gwapp = 5ms,
Gwbewait = The time for which GWBE has to wait to become free
RFC( the work process
5)
dispatcher Fw = nw gateway time + rfc + as = 2 + 5 + 10 = 17ms
Ans. /IWFND/TRACES
XS oDATA
In case of any Query of Feedback, Please feel free to reach out to [email protected]
Or My WhatsApp: +918700435272
I provide Live training as well as Video courses on different Subjects in super simple and easy way.
Can visit my website www.saptechmadeeasy.com for more detail about different courses