Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Change OData service field type from guid to string, and query still expects a guid

matt
Active Contributor
0 Kudos
474
  • SAP Managed Tags:

See original question here: https://answers.sap.com/questions/13749752/odata-filter-with-edmguid-guid-created-from-cl-sys.html

To get round this issue, since I don't really need it in guid format, I've changed the type to string. And I'm getting the same error

Invalid parametertype used at function 'eq' (Position: 11)

I've set sap-ds-debug=true in the uri, and under the URI tab I see:

$filter information
SessionID eq ''
$filter error position
SessionID eq ''
          ^
Error: Invalid parametertype used at function 'eq' (Position: 11)
$filter tree
{
  nodeType: "property"
  name: "SessionID"
  type: "Edm.Guid"
}
$filter token
{
  -token: [
  -{
     kind: "literal"
     position: 1
     type: null
     value: "sessionid"
     value_lower: "SessionID"
   }
-{
   kind: "literal"
   position: 11
   type: null
   value: "eq"
   value_lower: "eq"
   }
-{
   kind: "typed_literal"
   position: 14
   type: "Edm.String"
   value: null
   value_lower: "''"
   }
]
}<br>

The stack trace shows that it's still expecting SessionID to be Edm.Guid. I deleted the entity types and entity set, recreated and generated and I'm still get the error. There's no navigation properties on the entity. It is set to be addressable and requires a filter.

I've checked the _MPC class, method define (which isn't overridden in the _MPC_EXT class), and checked the Define_entity and that looks all correct.

lo_property = lo_entity_type->create_property( iv_property_name = 'SessionID' iv_abap_fieldname = 'SESSION_ID' ). "#EC NOTEXT
lo_property->set_label_from_text_element( iv_text_element_symbol = '045' iv_text_element_container = gc_incl_name ).  "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->set_type_edm_string( ).
lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_true ).

It looks like something isn't being properly regenerated. Does anyone have any idea of how I can proceed?

1 ACCEPTED SOLUTION

matt
Active Contributor
0 Kudos
384
  • SAP Managed Tags:

Answer here: https://answers.sap.com/questions/10882622/service-doesn%27t-update-after-data-model-updating.html

I ran tx /IWFND/CACHE_CLEANUP - Cleanup of GW Model Cache and that fixed the problem.

1 REPLY 1

matt
Active Contributor
0 Kudos
385
  • SAP Managed Tags:

Answer here: https://answers.sap.com/questions/10882622/service-doesn%27t-update-after-data-model-updating.html

I ran tx /IWFND/CACHE_CLEANUP - Cleanup of GW Model Cache and that fixed the problem.