cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OData associations and navigation for C4C not working as expected , Etag Error

dhruv_mehta
Active Contributor
0 Likes
2,331

Dear All,

I have a requirement to fetch DocumentOutputRequest from Sales Quote , this is nothing but the Output Tab from SalesQuote which has the details of the Sent Quote.

Now We need to create or use a oData service so that our DataWarehose can access that data.

So first of all, there is no standard oData Service for this ( Which is surprizing ), Secondly the object is available when you dont create "Data Workbench Enabled" Odata service.. X(

So then I started creating custom ODataService for this,

I did following.

1. Selected Root so that I Can pass ID

Like : https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection?$filter= ID eq '1885'&$format=json

So I get below response

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "uri": "https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection('00163E6DB29B1ED8AB8AAF91D03B532A')",
                    "type": "cust.CustomerQuote",
                    "etag": "W/\"datetimeoffset'2018-09-03T11%3A12%3A27.6887360Z'\""
                },
                "ObjectID": "00163E6DB29B1ED8AB8AAF91D03B532A",
                "ETag": "/Date(1535973147688)/",
                "ID": "1885",
                "UUID": "00163E6D-B29B-1ED8-AB8A-AF91D03B532A",
                "DocumentOutputRequestDocumentOutputRequest": {
                    "__deferred": {
                        "uri": "https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection('00163E6DB29B1ED8AB8AAF91D03B532A')/DocumentOutputRequestDocumentOutputRequest"
                    }
                }
            }
        ]
    }
}
<br>

As you can see i recived the URI : https://myXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection('00163E6DB29B1ED8AB8AAF91D03B532A')/DocumentOutputRequestDocumentOutputRequest

So I jumped with a joy which was short lived.

So I opened nother window of Postman(tool i use to test odata)

https://myXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection('00163E6DB29B1ED8AB8AAF91D03B532A')/DocumentOutputRequestDocumentOutputRequest?$format=json

and again jumped with Joy by seeing below response

{
    "d": {
        "results": {
            "__metadata": {
                "uri": "https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/DocumentOutputRequestDocumentOutputRequestCollection('00163E6DB29B1ED8AB8AE08A3921F4B4')",
                "type": "cust.DocumentOutputRequestDocumentOutputRequest"
            },
            "ObjectID": "00163E6DB29B1ED8AB8AE08A3921F4B4",
            "ReferenceObjectNodeID": "00163E6DB29B1ED8AB8AAF91D03B532A",
            "ReferenceObjectNodeTypeCode": "3807",
            "ReferenceObjectTypeCode": "30",
            "UUID": "00163E6D-B29B-1ED8-AB8A-E08A3921F4B4",
            "DocumentOutputRequestItem": {
                "__deferred": {
                    "uri": "https://myXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/DocumentOutputRequestDocumentOutputRequestCollection('00163E6DB29B1ED8AB8AE08A3921F4B4')/DocumentOutputRequestItem"
                }
            }
        }
    }
}<br>

So now the moment of truth I reached the DocumentOutputRequestItem which is what was required.

But now it gave me errorwith the URI which it gave me to fetch DocumentOutputRequestItem .

So I used URI https://myXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/DocumentOutputRequestDocumentOutputRequestCollection('00163E6DB29B1ED8AB8AE08A3921F4B4')/DocumentOutputRequestItem

And Response :

<?xml version="1.0" encoding="utf-8"?> <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code/> <message xml:lang="de">Geschäftsobjektattribut für Eigensch. ETag nicht gefunden; Dienst anpassen.</message> </error>

Something Etag issue , and no clue what went wrong.

Has anyone encountered this kind of issue with C4C OData?

Kindly help.

Regards, Dhruvin


Accepted Solutions (1)

Accepted Solutions (1)

dhruv_mehta
Active Contributor
0 Likes

Recived answer and correction from SAP in incident.

Whenever any oData service custom / standard is missing Etag , we have raise incident and they can add the same in backend.

Regards,

Dhruvin

Answers (2)

Answers (2)

anurag_nath3
Product and Topic Expert
Product and Topic Expert

Hi Dhruvin,

We see you have created a Custom OData service to achieve your requirement.

ETag is basically a property for date/time. This cant be created of updated

<PropertyName="ETag"Type="Edm.DateTimeOffset"sap:creatable="false"sap:updatable="false"sap:filterable="true"


Please check if you can add it your custom OData service. If not then you can report an incident to us and then we can check the custom service created by you


Regards,
Anurag

dhruv_mehta
Active Contributor
0 Likes

Hi Anurag,

Thanks a lot for your inputs , I already created incident 3101113746.

And Please check if you can add it your custom OData service. If not then you can report an incident to us and then we can check the custom service created by you

It is already there! thats what i checked , but the it still gives me error message.


dhruv_mehta
Active Contributor
0 Likes

Hi Anurag,

Today i thought let me recheck it the issue of Eatg!

and i guess i know the root cause.

So https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection?$filter= ID eq '1885'&$format=json

This recieves a response with a Eag,

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "uri": "XXXX",
                    "type": "cust.CustomerQuote",
                    "etag": "W/\"datetimeoffset'2018-09-03T11%3A12%3A27.6887360Z'\""
                },
                "ObjectID": "00163E6DB29B1ED8AB8AAF91D03B532A",
                "ETag": "/Date(1535973147688)/",
                "ID": "1885",
                "UUID": "00163E6D-B29B-1ED8-AB8A-AF91D03B532A",
                "DocumentOutputRequestDocumentOutputRequest": {
                    "__deferred": {
                        "uri": "https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection('00163E6DB29B1ED8AB8AAF91D03B532A')/DocumentOutputRequestDocumentOutputRequest"
                    }
                }
            }
        ]
    }
}

So my first service has the Etag good hence the concurrent request is working.

but

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/CustomerQuoteCollection('00163E6DB29B1ED8AB8AAF91D03B532A')/DocumentOutputRequestDocumentOutputRequest

Doesnt yield any Etag see below!,

{
    "d": {
        "results": {
            "__metadata": {
                "uri": "XXXX"
            },
            "ObjectID": "00163E6DB29B1ED8AB8AE08A3921F4B4",
            "ReferenceObjectNodeID": "00163E6DB29B1ED8AB8AAF91D03B532A",
            "ReferenceObjectNodeTypeCode": "3807",
            "ReferenceObjectTypeCode": "30",
            "UUID": "00163E6D-B29B-1ED8-AB8A-E08A3921F4B4",
            "DocumentOutputRequestItem": {
                "__deferred": {
                    "uri": "https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/testop/DocumentOutputRequestDocumentOutputRequestCollection('00163E6DB29B1ED8AB8AE08A3921F4B4')/DocumentOutputRequestItem"
                }
            }
        }
    }
}

and I think this is the rootcause.

Funny thing is i am also not able to add Etag on my own,

See below.




dhruv_mehta
Active Contributor
0 Likes

anant.acharya : Is there any 1 from OData - Rest framework whom i can tag?

Thanks a lot 🙂 as alway!

Regards, Dhruvin

anant_acharya
Product and Topic Expert
Product and Topic Expert

Hey Dhruvin,

I have forward this question to concerned team, waiting for reply.

Regards
Anant

dhruv_mehta
Active Contributor
0 Likes

Thanks a ton , Anant! I wonder is there way to provide input on best moderators of SCN! 🙂 \

Regards,

Dhruvin