0% found this document useful (0 votes)
3 views

Developing OData ABAP Service using Get(class6)

The document outlines the process of developing an OData ABAP service using the Get_Entity() method, which fetches a single record based on input key values from a front-end application like SAP UI5/Fiori. It details the necessary parameters, steps for creating the OData service project, implementing functionality, registering the service, and testing it using the SAP Gateway Client. The document also includes specific coding instructions and notes on using standard structures for key fields.

Uploaded by

yshu1217
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Developing OData ABAP Service using Get(class6)

The document outlines the process of developing an OData ABAP service using the Get_Entity() method, which fetches a single record based on input key values from a front-end application like SAP UI5/Fiori. It details the necessary parameters, steps for creating the OData service project, implementing functionality, registering the service, and testing it using the SAP Gateway Client. The document also includes specific coding instructions and notes on using standard structures for key fields.

Uploaded by

yshu1217
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Developing OData ABAP Service using Get_Entity( ) Method :

================================================
========

Get_Entity( ) Method is used to Fetch Single Record with Select Statement

Get_Entity( ) Method contain Two Important Parameters

it_Key_Tab : Will Accept Input Key Field Value(s) from Front-end App(SAP
Ui5/Fiori)

er_Entity : Will Send Output Record to Front-end App(SAP Ui5/Fiori)

Get_Entity( ) Method is Recommended if Front-end App(SAP Ui5/Fiori ) Contains

Form As Input

Form As Output

Get_Entity( ) Method is Triggered from Front-end App using bindElement( )


method
_______________________________________________________________________

Note : we can use Standard Structure for Declaring WorkArea for Key Fields

/IWBEP/S_MGW_NAME_VALUE_PAIR

Note : /IWBEP/S_MGW_NAME_VALUE_PAIR contains Two options


Name -> Name of Key Field
Value -> Value of Key Field
_________________________________________________________________________

Step by Step Procedure :


_______________________________

step1 : Create OData Service Project


-----------------------------------------------------------

open SEGW Tcode


click create Icon
Provide Project Name = ZTest630AMODataProject
Description = CRUDQ ODataProject
save in package/local

step2 : Create Entity Type and EntitySet


-----------------------------------------------------------------

Right Click DataModel -> Import -> DDIC Structure

Provide Entity Type = EMP


ABAP Structure = ZEMPDBTABLE ( Database Table )
Select CheckBox to Create EntitySet ( EMPSet )
Next
Select All Fields
Next
Select Key Fields ( Userid , Firstname )
Finish
step3 : Generate Runtime Artifacts :
--------------------------------------------------------------

Select Your Project Folder -> Click on Red Color Icon


Continue
Save in Package/local

step4 : Implement Functionality :


-----------------------------------------------------------------

open Runtime Artifacts


open Data Provider Extension Class ( DPC_EXT )
Click Change
Place Cursor on EMPSet_Get_Entity( ) Method
Click on "Redefine Method"
implement below Code
______________________________________________________

Data : Wa_Key_tab1 TYPE /iwbep/s_mgw_name_value_pair.


Data : Wa_Key_tab2 Type /iwbep/s_mgw_name_value_pair.

Read Table it_key_tab into wa_key_tab1 index 1.


Read Table it_key_tab into wa_key_tab2 index 2.

Select Single * from ZEMPDBTABLE


into
CORRESPONDING FIELDS OF er_entity
Where Userid = wa_key_tab1-value
and
Firstname = wa_key_tab2-value.

______________________________________________________

save And Activate

step5 : Register the Service


------------------------------------------------------

open Service maintainence Folder


Click on "Register"
continue
save in package/local
Finish

Note : The Odata Service will be internally Registered in SAP Netweaver


Gateway
& The Odata Service will be Activated in SICF Tcode Automatically

Step6 : Test the OData Service


--------------------------------------------------

open Service maintainence Folder

Goto SAP Gateway Client

Select EntitySets ( EMPSet )


To Fetch Record :
____________________

/sap/opu/odata/SAP/ZTEST630AMODATAPROJECT_SRV/
EMPSet(Userid='1001',Firstname='VIJAYENDAR')

Select "Get" option & Execute the Service

/sap/opu/odata/SAP/ZTEST630AMODATAPROJECT_SRV/
EMPSet(Userid='1002',Firstname='AJAY')

Select "Get" option & Execute the Service

/sap/opu/odata/SAP/ZTEST630AMODATAPROJECT_SRV/
EMPSet(Userid='1003',Firstname='VARUN')

Select "Get" option & Execute the Service

__________________________________________________________________________________
_____________

You might also like