cancel
Showing results for 
Search instead for 
Did you mean: 

How to look for where data is coming from for oData service

paskal_singh
Explorer

Hello Experts,

I find myself in need of some assistance. I'm trying to find where the backend implementation is for data coming into an oData service built in SEGW. We have a custom front-end SAPUI5 application in which a field is receiving the wrong data for display. I went into SEGW and opened the oData project in the service builder and looked at the Service Implementation. In that I found the 'Set' which is bringing in the wrong data but it isn't using mapping to an ABAP structure. It only has the CRUDQ implemented. In the Runtime Artifacts I looked at both *_DPC and *_DPC_EXT also *_MPC and *_MPC_EXT classes and found the structure but the structure is all string types. I found the particular field in question but I cannot locate where that field is getting the data assigned to it. Are there any suggestions how I can locate where this structure is getting its assignments? Below is the code that get the data for the 'Set' I need to change one of the fields for.

In the Importing there a structure called et_entityset that gets assigned the getorderdetailss_get_entityset. In the Changing part cr_data gets assigned the er_entityset. When I forward navigate to these it takes me to the structure definitions but not exactly where the structure gets assigned the data. I suspect this is where the change would need to be made, but I can't locate that code!

Thank you for your time.

WHEN 'GetOrderDetailsSet'.
*     Call the entity set generated method
      getorderdetailss_get_entityset(
        EXPORTING
         iv_entity_name = iv_entity_name
         iv_entity_set_name = iv_entity_set_name
         iv_source_name = iv_source_name
         it_filter_select_options = it_filter_select_options
         it_order = it_order
         is_paging = is_paging
         it_navigation_path = it_navigation_path
         it_key_tab = it_key_tab
         iv_filter_string = iv_filter_string
         iv_search_string = iv_search_string
         io_tech_request_context = io_tech_request_context
       IMPORTING
         et_entityset = getorderdetailss_get_entityset
         es_response_context = es_response_context
       ).
*     Send specific entity data to the caller interface
      copy_data_to_ref(
        EXPORTING
          is_data = getorderdetailss_get_entityset
        CHANGING
          cr_data = er_entityset
      ).

Forward navigation takes me to

DATA getorderdetailss_get_entityset TYPE zcl_create_order_mpc=>tt_getorderdetails.

This is the structure that gets filled but I can't find where it gets filled.

  begin of TS_GETORDERDETAILS,
     VBELN type string,
     VKORG type string,
     KUNNR type string,
     AUART type string,
     CONTRACTCODE type string,
     CONDTYPE1 type string,
     CONDTYPE2 type string,
     CONDTYPE3 type string,
     CONDTYPE4 type string,
     NETWR type P length 8 decimals 3,
     NETWR1 type P length 8 decimals 3,
     NETWR2 type P length 8 decimals 3,
     NETWR3 type P length 8 decimals 3,
     DATUM type string,
     POSID type C length 24,
     AUFNR type string,
     CURRENCY type string,
     KOSTL type string,
     REQDELDATE type string,
     ORDERCOMP type string,
     COMPLETEDELIVERY type string,
     DELBLOCK type string,
     BILBLOCK type string,
     SALES_NO type string,
     RESPONSE type string,
     NET_TOTAL type P length 8 decimals 2,
     SHIPPING_HANDLING type P length 8 decimals 2,
     TAXES type P length 8 decimals 2,
     LAYOUT_SETHEADER type string,
     LAYOUT_SETHEADER_FLAG type string,
     TERMS_PAYMENT type string,
     TERMS_PAYMENT_FLAG type string,
     INCOMP_FLAG type C length 1,
     PO_TYPE type string,
     BILLING_DATE type string,
     ENQUEUE_MESSAGE type string,
     PRICE_DATE type string,
  end of TS_GETORDERDETAILS .<br>
  types:
TT_GETORDERDETAILS type standard table of TS_GETORDERDETAILS .

PS.

Sandra_Rossi
Active Contributor
0 Kudos

You need to clarify what you mean "where data is coming from". Do you mean where is the SELECT to read the data from the database? It may come from several tables, CDS Views and so on... If so, an SQL trace will help you.

paskal_singh
Explorer
0 Kudos

Hi Sandra,

Thanks for your comment. Yes, by asking "where data is coming from" I meant the SELECT statement to read the data from the database. Specifically I'm trying to locate the area of the code where the above structure (TS_GETORDERDETAILS) is getting filled with the data. One of the fields in that structure is being populated incorrectly and I need to change it to the correct value.

P.

View Entire Topic
Tukutupap
Participant
0 Kudos

I can think of 3 things:

  • Does GetOrderDetailsSet return a single entity or multiple entities? You may wanna check at the implementation for GET_ENTITY instead of GET_ENTITYSET
  • Are you sure ***_SO_CREATE_SRV is the right oData service? A quick look at the network tab in the browser could tell you the right service, just to double check.
  • Is your backend and your frontend system the same? If not, it is possible that your gateway is routing the OData call to a different system where the service is being executed.

Curious about this one!

Kr,

paskal_singh
Explorer
0 Kudos

Hello Vincente, Thanks for your response and questions, my responses are below

  • Does GetOrderDetailsSet return a single entity or multiple entities? You may wanna check at the implementation for GET_ENTITY instead of GET_ENTITYSET

Only GetOrderDetailsSet is present in the service, the singular form is not implemented. In fact even the SET implementation is empty, with commented code, but yet when I look in the Javascript code of the controller, the call is being invoked in the onCopyPressed method. I included the code above.

  • Are you sure ***_SO_CREATE_SRV is the right oData service? A quick look at the network tab in the browser could tell you the right service, just to double check.

I've 20 times checked this over that I have the right oData service in context!

  • Is your backend and your frontend system the same? If not, it is possible that your gateway is routing the OData call to a different system where the service is being executed.

Our frontend system is different to our backend. We have a Fiori front end server where our SAPUI5 apps get deployed to. Our backend system is our S/4 HANA ERP system where the data is retrieved from.


P.

Tukutupap
Participant
0 Kudos

In that case, I assume that your frontend system its also the gateway for the OData services, and in that case, you could check the routing configuration just to verify where the OData calls are being routed to.

You can go to SEGW and expand your OData service, then double click on GATEWAYSERVER. Then click on toolbar button Maintain and a new window will open up with configuration information about that service.

Please take a look or share a screenshot and share here, maybe there is something useful there.

paskal_singh
Explorer
0 Kudos

Vincente,

When I'm in SEGW and I expand my oData project. I only see Data Model, Service Implementation, Runtime Artifacts and Service Maintenance. There isn't GATEWATSERVER. I can go to IWFND/MAINT_SERVICE and find the service there too. But that only shows me the service and navigate to the Gateway Client.

In the call to the service from the app.controller.js, the call is configured as follows:

var sOption = {"$expand": "GetHeaderItemNavigation,GetHeaderPartnerNavigation,GetHeaderConditionNavigation,HeaderElectronicNavigation"};
var sPath = "/GetOrderDetailsSet(DocNo='" + this.byId("docNumInputId").getValue() + "',OrderType='" + this.byId("orderTypeSelectId").getSelectedKey() 
+"',SalesOrg='" + this.byId("salesOrganizationSelectId").getSelectedKey() + "',SoldToParty='',Operationflag='SEL')";
models.callQuery(sPath, null, null, sOption, fnSuccess, fnError, this);





P.

Tukutupap
Participant
0 Kudos

Please expand Service Maintenance and you will see GATEWAYSERVER. If you could share a screenshot of what you see that'd be great.