Implement a Gateway service (Part 3) – CRUD Operations

Now we can implement the rest of the CRUD(Create, Read, Update and Delete) operations. We will do it for the entityset SUBJECTSSET. Create – Redefine the method SUBJECTSSET_CREATE_ENTITY METHOD subjectsset_create_entity. DATA: ls_subject LIKE er_entity. io_data_provider->read_entry_data( IMPORTING es_data = ls_subject ). ls_subject–mandt = sy–mandt. er_entity = ls_subject. INSERT INTO zsubjects VALUES ls_subject. ENDMETHOD. Read – Redefine the method SUBJECTSSET_GET_ENTITY method SUBJECTSSET_GET_ENTITY. DATA: ls_key_tab LIKE LINE OF it_key_tab, lv_id      TYPE zsubjects–id, lv_subject TYPE zsubjects–subject. CLEAR ls_key_tab. READ TABLE it_key_tab INTO ls_key_tab WITH KEY name = ‘Id’. IF sy–subrc EQ 0. lv_id = ls_key_tab–value. ENDIF. CLEAR ls_key_tab. READ TABLE it_key_tab INTO ls_key_tab WITH KEY name = ‘Subject’. IF sy–subrc EQ 0. lv_subject = ls_key_tab–value. ENDIF. SELECT SINGLE * INTO CORRESPONDING FIELDS OF er_entityContinue reading “Implement a Gateway service (Part 3) – CRUD Operations”

Implement a Gateway service (Part 2) – Coding the Query operation

After having defined the Data Model in part1, you have to implement the business logic in ABAP to retrieve the data from the backend. Expand the Runtime Artifacts folder. Double-click on the Data Provider Extension Class, namely ZCL_ZSTUDENTS_DPC_EXT. Double-click on the class again to open the Class Builder. Go to change mode. Select the method STUDENTHEADERSET_GET_ENTITYSET andContinue reading “Implement a Gateway service (Part 2) – Coding the Query operation”

Implement a Gateway service (Part 1) – Define a data model based on Data Dictionary Structure

We are going to define a Gateway service in the Service Builder SEGW. The first stage of implementing a service is to define the data model. For that, we will create custom z tables from scratch. Create 2 tables named ZStudent and ZSubjects as shown below.   In transaction SEGW, create a new project. GiveContinue reading “Implement a Gateway service (Part 1) – Define a data model based on Data Dictionary Structure”

SAP Gateway sample service for GW100 practice

You have the SAP Handbook GW100 and looking for the gateway practice sample service GW100_T_BASICGW_SRV. No worries. The service is installed by default in SAP Netweaver 7.51 innovation package and is named GWSAMPLE_BASIC instead. Use transaction SEGW and open the project /IWBEP/GWSAMPLE_BASIC. Technical Service Name: ZGWSAMPLE_BASIC External Service Name: GWSAMPLE_BASIC Namespace: IWBEP   Accessing the service via URI:Continue reading “SAP Gateway sample service for GW100 practice”