Dular SharmaDular SharmaDular Sharma
(Monday - Saturday)
sharmadular7392@gmail.com
Himatnagar
Dular SharmaDular SharmaDular Sharma

7.DDIC Get Data – Multiple records.

7 Views

In this blog we will fetch all the data from table in OData service.

Prerequisite – We should have created table with field Emp_ID(Numc , 8) and Name(Char,30).

Right click on Data Model put cursor on import and select DDIC Structure.

Below screen will appear, provide Entity name according your choice and give table name in ABAP structure name.

Once you click on next below screen will appear and select fields which you want to display in service.

Click on next and select key field of table.

Click on finish.

We have imported DDIC structure and now we need to click on generate.

It will create DPC/MPC classes, technical model and service name for your project.

Once you click on right below screen will appear.

Keep on pressing Enter till you see below screen.

In Runtime artifacts folder six methods will be generated, select DPC_EXT method for further operation.

Class screen will appear like below.

Scroll down methods, you will find five important methods named Drop down in method, you will see five important methods CREATE_ENTITY, DELETE_ENTITY, GET_ENTITY, GET_ENTITYSET, UPDATE_ENTITY.We will use these methods for CRUD operation but in this blog we will only focus on GET_ENTITYSET method.

Change class to edit mode (It is in display mode) put cursor on *GET_ENTITYSET method and press redefine method.

Screen will look like below.

Remove all the code and write down query according your requirement. Here, we need to fetch all the data hence we will write below code.


DATA : wa_keytab TYPE /iwbep/s_mgw_name_value_pair.

READ TABLE it_key_tab INTO wa_keytab INDEX 1.

SELECT SINGLE * FROM ZEMPLOYEE_1 INTO er_entity WHERE EMP_ID EQ wa_keytab-value.

Save and Activate class.

Above steps are to select all fields on service. We have created project next step is to activate service. For that we need to execute transaction code /IWFND/MAINT_SERVICE.

Click on Add Service.

Fill details accordingly. System alias will be local and technical service name is your project name which you have created in SEGW.

Click on Get services or press enter.

One entry in backend services will appear now once you click on Technical Service Name it allows you to add service.

Write-down package name and click on right icon.

Below screen will be displayed in sequence.

Now search for your service in /IWFND/MAINT_SERVICE.

Select service and activate it.

Information message will be displayed.

Now, click on SAP gateway client.