You are on page 1of 4

Today's Class:

___________________________
Note :
io_tech_request_context->get_keys( ) ----->capture the INput value of the Key
Field
io_data_provider->read_entry_data( ) ----->capture the INPUT RECORD
________________________________________________________________________________
______________
NOte :
For Workarea

-> ____MPC=>TS_<ENTITYTYPENAME>

For internal TABLe -> ____MPC=>TT_<ENTITYTYPENAME>


________________________________________________________________________________
______
STEPS:
--------in SEGW , create ZDB_PROJECT.
and save it
Right click DATA MODEL,
IMPORT "DDIC STRUCTURE"
provide ENTITY TYPE NAME = USER
ABAP DIC. STRUCTURE
Chose

ZSA_USERS

CREATE default ENTITYSET

continue
select Required FIELDs and continue
chose

FOR EX: EMAIL field as KEY FIELD

save
check syntax errors.
generate runtime objects ( MPC, MPC EXT, DPC , DPC EXT etc... are autogenera
ted )
________________________________________________________________________________
______
NOTE : According ENTITY TYPE FIELDs,
the TABLE STRUCTURE and TABLE TYPE are generated inside Model PRovider
cLASS
________________________________________________________________________________
_______

To implement the functionality :


GOTO

Data provider Extension CLASS

chose _CREATE_ENTITY method ,

redefine that method..

and implement the code for INSERTING the record


_______________________________________________________________
data ls_user TYPE
ZCL_ZDBPROJECT_MPC=>TS_USER .
IO_DATA_PROVIDER->READ_ENTRY_DATA( importing es_data = ls_user

).

INSERT into ZSA_USERs values ls_user.


ER_ENTITY
= ls_user.
_______________________________________________________________
save and activate the method
Now goto GET_ENTITY Method

, redefine that method..

and implement the code for fetching the record based on INPUT KEY FIELD value
_______________________________________________________________________________
data : lt_keys
TYPE /IWBEP/T_MGW_TECH_PAIRS.
data : ls_key
TYPE /IWBEP/S_MGW_TECH_PAIR.
data : lv_email TYPE char20.
data : ls_user
TYPE ZCL_ZDBPROJECT_MPC=>TS_USER.
lt_keys =

IO_TECH_REQUEST_CONTEXT->get_keys( ).

Read table lt_keys into ls_key with KEY NAME = 'EMAIL' .


lv_email

= ls_key-VALUE.

select single * from zsa_users into


corresponding fields of
ls_user
where email = lv_email.
er_entity = ls_user .
________________________________________________________________________
NOTE :

As Developer, whenever required


we can implement all ABAP based statements to handle Database operations.

________________________________________________________________________________
__________
Activate the class :
_______________________________
Goto service maintainence :
Click on Register,
select MAINTAIN,.

goto "GATEWAY client"


____________________________________________________________________________
case1 :

/sap/opu/odata/sap/ZDBPROJECT_SRV/USERSet('VIJAY@OASIS.COM')
Note : here service will execute GET_ENTITY method, if that method is impleme
nted,
then it display output record based on INPUT
______________________________________________________________________________
case 2:
/sap/opu/odata/sap/ZDBPROJECT_SRV/USERSet
Note : here service will execute GET_ENTITYSET method, if that method is not im
plemented,
then it display error.
_______________________________________________________________________
CAse 3:
Use RESPONSE as REQUEST.,
and provide NEW RECORD values
for EX : HARI@OASIS.COM
HARI
KIRAN
VIJAYWADA, AP
chose POST METHOD

for CREATING RECORD

____________________________________________________________________________
NOTE :
STATUS CODE = 200 with OK
---> FOR FETCHING data successfully
STATUS CODE = 201 with CREATED ---> FOR INSERTING data successfully.
_____________________________________________________________________________

You might also like