OData no result after impleenting the method get_expanded_entityset

Hi experts,
any idea about on this issue?
I created a simple OData in SEGW, and it is working fine. but after changing the structure of SalesHeader from VBAK to ZAJ_VBAK and try to execute in the odata service in /iwfnd/gw_client its not returning any records

AJeB_0-1715091103270.png

AJeB_1-1715091140437.png

-the URL is correct
/sap/opu/odata/SAP/ZAJ_ODATA_SD1_SRV/SalesHeaderSet?$expand=Nav_to_VbakExt&$format=json
-both custom table has records

-I already tried to do frontend/backend cleanup

-mapping of structure is correct

-I already regenerate the runtime objects

-my program is correct, and I don’t see any error

– passing the records in er_entityset is successful and the records is correct 

 

 

 

METHOD /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset.
TYPES: BEGIN OF ts_header,
SalesOrderID TYPE zaj_vbak-vbeln, “SalesOrderID
SalesDocType TYPE zaj_vbak-auart, “SalesDocType
DocumentDate TYPE zaj_vbak-audat, “DocumentDate
SalesOrg TYPE zaj_vbak-vkorg, “SalesOrg
DistributionChannel TYPE zaj_vbak-vtweg, “DistributionChannel
Division TYPE zaj_vbak-spart, “Division
rdd TYPE zaj_vbak-vdatu, “RDD
PurchaseOrder TYPE zaj_vbak-bstnk, “PurchaseOrder
SalesDocCategory TYPE zaj_vbak-vbtyp, “SalesDocCategory
END OF ts_header,
BEGIN OF ts_extension,
mandt TYPE zaj_vbak_ext-mandt, “Mandt
vbeln TYPE zaj_vbak_ext-vbeln, “Vbeln
erdat TYPE zaj_vbak_ext-erdat, “Erdat
erzet TYPE zaj_vbak_ext-erzet, “Erzet
tcode TYPE zaj_vbak_ext-tcode, “Tcode
price TYPE zaj_vbak_ext-price, “Price
waers TYPE zaj_vbak_ext-waers, “Waers
text1 TYPE zaj_vbak_ext-text1, “Text1
text2 TYPE zaj_vbak_ext-text2, “Text2
text3 TYPE zaj_vbak_ext-text3, “Text3
END OF ts_extension.

DATA: lt_header TYPE TABLE OF ts_header,
lt_extension TYPE TABLE OF ts_extension.
DATA: ls_header TYPE ts_header,
ls_extension TYPE ts_extension.

DATA: BEGIN OF ls_expanded,
SalesOrderID TYPE zaj_vbak-vbeln, “SalesOrderID
SalesDocType TYPE zaj_vbak-auart, “SalesDocType
DocumentDate TYPE zaj_vbak-audat, “DocumentDate
SalesOrg TYPE zaj_vbak-vkorg, “SalesOrg
DistributionChannel TYPE zaj_vbak-vtweg, “DistributionChannel
Division TYPE zaj_vbak-spart, “Division
rdd TYPE zaj_vbak-vdatu, “RDD
PurchaseOrder TYPE zaj_vbak-bstnk, “PurchaseOrder
SalesDocCategory TYPE zaj_vbak-vbtyp, “SalesDocCategory
extension TYPE TABLE OF ts_extension,
END OF ls_expanded.

DATA: lt_expanded LIKE TABLE OF ls_expanded.

SELECT vbeln auart audat vkorg vtweg spart vdatu bstnk vbtyp FROM zaj_vbak INTO TABLE lt_header.

SELECT * FROM zaj_vbak_ext INTO TABLE lt_extension
FOR ALL ENTRIES IN lt_header
WHERE vbeln = lt_header-salesorderid.

LOOP AT lt_header INTO ls_header.
MOVE-CORRESPONDING ls_header TO ls_expanded.
LOOP AT lt_extension INTO ls_extension WHERE Vbeln = ls_header-salesorderid.

APPEND ls_extension TO ls_expanded-extension[].
ENDLOOP.

APPEND ls_expanded TO lt_expanded.

CLEAR: ls_expanded, ls_header, ls_extension.
ENDLOOP.

/iwbep/if_mgw_conv_srv_runtime~copy_data_to_ref(
EXPORTING
is_data = lt_expanded
CHANGING
cr_data = er_entityset
).

APPEND ‘Nav_to_VbakExt’ TO et_expanded_tech_clauses.

ENDMETHOD.

 

 

 

Result
status code = 200 but no result

AJeB_0-1715091927874.png

 

 

 

 

{
“d” : {
“results” : [
{
“__metadata” : {
“id” : “http://azrerptap025.cscsapconsulting.local:50800/sap/opu/odata/SAP/ZAJ_ODATA_SD1_SRV/SalesHeaderSet(”)”,
“uri” : “http://azrerptap025.cscsapconsulting.local:50800/sap/opu/odata/SAP/ZAJ_ODATA_SD1_SRV/SalesHeaderSet(”)”,
“type” : “ZAJ_ODATA_SD1_SRV.SalesHeader”
},
“SalesOrderID” : “”,
“SalesDocType” : “”,
“DocumentDate” : null,
“SalesOrg” : “”,
“DistributionChannel” : “”,
“Division” : “”,
“RDD” : null,
“PurchaseOrder” : “”,
“SalesDocCategory” : “”,
“Nav_to_VbakExt” : {
“results” : [
{
“__metadata” : {
“id” : “http://azrerptap025.cscsapconsulting.local:50800/sap/opu/odata/SAP/ZAJ_ODATA_SD1_SRV/SalesExtensionSet(Mandt=”,Vbeln=”)”,
“uri” : “http://azrerptap025.cscsapconsulting.local:50800/sap/opu/odata/SAP/ZAJ_ODATA_SD1_SRV/SalesExtensionSet(Mandt=”,Vbeln=”)”,
“type” : “ZAJ_ODATA_SD1_SRV.SalesExtension”
},
“Mandt” : “”,
“Vbeln” : “”,
“Erdat” : null,
“Erzet” : “PT00H00M00S”,
“Tcode” : “”,
“Price” : “0.00”,
“Waers” : “”,
“Text1” : “”,
“Text2” : “”,
“Text3” : “”
}
]
}
}
]
}
}

 

 

 

 

Scroll to Top