on 2025 Dec 05 9:20 AM
Dear Community,
I am trying to create ODATA V4 as mentioned in SAP Note 2485370, So I created a custom entity in Eclipse and also a Class with below method implemented from interface /IWBEP/IF_V4_DP_BASIC.
@EndUserText.label: 'ZSAMPLE_SERVICE'
@ObjectModel.query.implementedBy: 'ABAP:ZCL_SAMPLE_SERVICE'
define custom entity ZSAMPLE_SERVICE
{
key component_material : abap.char(40);
fg_material : abap.char(40);
fg_material_descr : abap.char(40);
}And Class as below
CLASS ZCL_SAMPLE_SERVICE DEFINITION
PUBLIC
inheriting from /iwbep/cx_gateway
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES /IWBEP/IF_V4_DP_BASIC.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_SAMPLE_SERVICE IMPLEMENTATION.
METHOD /IWBEP/IF_V4_DP_BASIC~CREATE_ENTITY.
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~CREATE_REFERENCE.
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~DELETE_ENTITY.
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~EXECUTE_ACTION.
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~EXECUTE_FUNCTION.
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~READ_ENTITY.
DATA: TS_DATA TYPE zsample_service.
TS_DATA-COMPONENT_MATERIAL = '12333333'.
TS_DATA-FG_MATERIAL = '321'.
TS_DATA-FG_MATERIAL_DESCR = 'This is material description'.
IO_RESPONSE->SET_BUSI_DATA( TS_DATA ).
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~READ_ENTITY_LIST.
DATA: TS_DATA TYPE zsample_service,
TT_DATA TYPE TABLE OF zsample_service.
TS_DATA-COMPONENT_MATERIAL = '12333333'.
TS_DATA-FG_MATERIAL = '321'.
TS_DATA-FG_MATERIAL_DESCR = 'This is material description'.
APPEND TS_DATA TO TT_DATA.
IO_RESPONSE->SET_BUSI_DATA( TT_DATA[] ).
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~READ_REF_TARGET_KEY_DATA.
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~READ_REF_TARGET_KEY_DATA_LIST.
ENDMETHOD.
METHOD /IWBEP/IF_V4_DP_BASIC~UPDATE_ENTITY.
ENDMETHOD.
ENDCLASS.After this, I created service definition to explose above cds entity and then service binding.
When I do Get request to my service URL from postman I am getting dump saying as below
Error analysis |
| The application has indicated exception "CX_SADL_DUMP_APPL_MODEL_ERROR" as the |
| reason for the |
| termination: |
| Processing was aborted because of an application modeling error: See previous |
| in exception chain. |
| |
| The exception is related to the previous exception |
| "LCX_RAP_QUERY_PROV_BAD_IMPLMNT" that occurred in |
| program "CL_SADL_UNMANAGED_QUERY_ENGINECP", in line 6 of include |
| "CL_SADL_UNMANAGED_QUERY_ENGINECM00J". The reason for this exception |
| was: |
| Error occurred during execution of query provider 'ZCL_SAMPLE_SERVICE' |
| |
| The exception is related to the previous exception |
| "CX_RAP_QUERY_PROV_CONSTRUCTION" that occurred in |
| program "CL_RAP_QUERY_PROVIDER_FACTORY=CP", in line 6 of include |
| "CL_RAP_QUERY_PROVIDER_FACTORY=CM004". The reason for this exception |
| was: |
| Error during construction of the Unmanaged Query Provider for entity |
| ZSAMPLE_SERVICE |
| |
| The exception is related to the previous exception "CX_SY_CREATE_OBJECT_ERROR" |
| that occurred in |
| program "CL_RAP_QUERY_PROVIDER_FACTORY=CP", in line 3 of include |
| "CL_RAP_QUERY_PROVIDER_FACTORY=CM004". The reason for this exception |
| was: |
| Could not create object; reference variable does not match specified class |
| ZCL_SAMPLE_SERVICE. Can anyone help on this?
I appreciate your time and reply on this query.
Regards,
Omkar
Request clarification before answering.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.