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

SAP UI5 how to pass data to header and line item entity set using CREATE method

Hi,

We have two different entity sets for header and line item data in SAP. We defined the association to link header and line item details. We are able to post the document in SAP using XML template.

We designed the frontend using UI5 elements and need to post the document. Need the solution for the below issues.


1) How do we map the data of a view to ODATA model?


2) How do push the header and line item data of ODATA model to SAP using CREATE method?


As far as I know, we can specify one Entity Set in CREATE method. Our requirement is to push data to two different Entity Set using CREATE method.


Regards

Nidhi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Dec 14, 2015 at 04:34 PM

    Hi,

    If you provide header and item date it will go to the create_deep_entity method.

    Just check this blog, I think it will answer all of your questions.

    http://scn.sap.com/community/gateway/blog/2014/04/27/step-by-step-development-guide-for-createdeepentity-operation

    Kind regards, Rob Dielemans

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2015 at 04:59 PM

    Hi Rob,

    Thanks a lot.

    Yep, we have created a method called CUSTOME_CREATE_DEEP_ENTITY.

    The document is focused only on SEGW. Now we need to consume this service in front end. We are not aware of pushing the data from front end to SAP. It would be really helpful if you share any relevant documents which consumes the deep entity method from front end.

    Regards

    Nidhi

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Nidhi,

      I think you will get better answer in SAP UI5 Forum because you are trying to send the whole Create data into XML/JSON formate using POST call.

      In my understanding, you have to make whole XML/JSON of POST into data part as request Header parameter in AJAX call or inside odata Model call.


      data will contain XML or JSON data which will create


      Example in AJAX call :

      $.ajax({

      type:"post",

      data: ls_data,

      contentType : 'application/json',

      dataType : 'json',

      crossDomain: true,

      url:<service_url>,

      headers: {

      "Content-Type": "application/atom+xml;type=entry; charset=utf-8",

      "X-CSRF-TOKEN":"Fetch"

      },

      //beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Basic ' + btoa(usr+":"+pwd) ); },

      success : function(json,status,request) {

      ------------------------------

      -------------------------

      },

      error : function(jqXHR, textStatus, errorThrown) {

      errorMsg+=" Sorry! Error in getting User Details";

      }

      });

      Regards

      Vivek

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.