cancel
Showing results for 
Search instead for 
Did you mean: 

Odata Service with the following format

Former Member
0 Kudos

Hello Experts,

Can I create an Odata service which will return me the following json format, without using association and navigation?


If yes, request you to please suggest how could I achieve that.



{

  "category" : [

      {

  "dkey" : "01",

  "dtext" : "Zero One"  ,

    "subCategory":[{

      "dkey":"A",

      "dtext":"Alfa A"

    }]

},

{

  "dkey" : "02",

  "dtext" : "Zero Two"  ,

    "subCategory":[{

      "dkey":"B",

      "dtext":"Beta B"

    },{

      "dkey":"G",

      "dtext":"Gama G"

    },{

      "dkey":"D",

      "dtext":"Delta D"

    }]

}

]

}

Warm regards,

Upendra

Accepted Solutions (1)

Accepted Solutions (1)

kammaje_cis
Active Contributor
0 Kudos

Upendra,

You cannot use OData to get exactly like this, I would not prefer using OData as well.

OData has its own data model restrictions/rules and I do not think it suits here.

Rather, I would suggest using generic rest classes and create a generic icf service.

You may check this for ideas.

Regards

Krishna

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello! Did you find a decision how create same your json model on sap service?

Former Member
0 Kudos

I followed Krishna's suggestion and used the JSON Adapter for ABAP Function Modules.

Please check the above blog. It's exactly what I was looking.

AshwinDutt
Active Contributor
0 Kudos

Hello Upendra,

As far as i know its not possible with out creating association & navigation between the entities.

Regards,

Ashwin