cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

AshwinDutt
Active Contributor
0 Kudos

Hello Nidhi,

Please check Krishna's answer here ->

Regards,

Ashwin

vivek_gaurav
Participant
0 Kudos

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

former_member186746
Active Contributor
0 Kudos

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-createdeepen...

Kind regards, Rob Dielemans