Skip to Content
author's profile photo Former Member
Former Member

Odata Service with the following format

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jan 14, 2016 at 06:23 AM

    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.

    JSON Adapter for ABAP Function Modules

    Regards

    Krishna

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2016 at 06:20 AM

    Hello Upendra,

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

    Regards,

    Ashwin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2016 at 09:05 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.