on 01-10-2018 7:11 AM
Hi experts,
I read on the net about how to solve that issue but nothing is helping.
I have a simple table created in SAPUI5 and I want to send it back to my sap gateway.
I am using sap.ui.model.odata.v2.ODataModel.
I read about the batch technique but it is for v1.
I guess I have to use the create method of the model.
How can I achieve it? What to do on sapui5 side and what method to implement on sap gateway side?
Thank you.
Regards.
Sorry, but it is still not clear for me.
I will post a sample code and maybe you can help me.
I want to send per RFC one IId, one IDetailNo, one Subject and many ItFlights.
var oEntry =[
"IId": "my name",
"IDetailNo": "1",
"Subject": "subject 1",
"ItFlights": {
"Country" : "11",
"Aircraft" : "22",
"Unitsinstock" : "33",
"CommentText" : "44"
},
];
var sServiceUrl11 = "host:port/sap/opu/odata/SAP/ZGW200_LMS1_SRV_01";
var oModel11 = new sap.ui.model.odata.v2.ODataModel(sServiceUrl11,{
json : true,
});
oModel11.setHeaders({"X-Requested-With" : "X"});
oModel11.create("/SaveFlightSet", oEntry, null,
function(oData, oResponse){
alert ("OK");
},
function(err) {
alert("Error");
}
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ..
This is not a batch request .. if you need to send multiple post request you need to use batch to send multiple post request to server in one service call... before post you need to include a get request in your batch to fetch the xcsrf token which you need to add it in the headers for the upcoming post requests of yours ..
thanks
Viplove
Hi,
It is not a multiple post request, it is a request with multiple lines.
I really do not understand why it is so hard to send a table back to backend....
The sap gateway does not simplify my life at all.
Hi ..
You can send a batch request of POST ... V2 oData model also supports batch ...Just check out these links for implementing batch ..
And there will be no change in gateway side as long as your service is oData oriented ..
https://stackoverflow.com/questions/45821145/sapui5-batch-with-sap-ui-model-odata-v2-odatamodel
https://stackoverflow.com/questions/45821145/sapui5-batch-with-sap-ui-model-odata-v2-odatamodel
thanks
Viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for your fast reply.
I realy need a bit more precision. Do I need to implement the DEEP method on sap gateway side ? What do I need to implement there ?
I have create the mapping for the Create, Query and QuerySet operations.
Another thing, I read that I have to send 2 arrays: item and header ? Is it right? If yes, do you know why I have to send a Header array?
Lot of questions but I realy need help with this issue.
Thank you.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
How your UI5 table is created, with JSon model or OData model.
I guess it is with JSon (in other case you wouldn't ask this questin ;)). In that case, you should create a OData with the same struture than your table, then with a post query the data are sent to the Back-end.
If you can give us more detail of the table's structure and your OData, it will be easier to help you.
Regards,
Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joseph,
My RFC is like this:
*"*"Local Interface:
*" IMPORTING
*" VALUE(IS_HEADER) TYPE ZLMS_HEADER_T OPTIONAL
*" VALUE(I_ID) TYPE CHAR10 OPTIONAL
*" VALUE(I_DETAIL_NO) TYPE CHAR10 OPTIONAL
*" EXPORTING
*" VALUE(E_SUCCESS) TYPE FLAG
*" TABLES
*" T_FLIGHTS STRUCTURE ZLMS_FLIGHTS_T OPTIONAL
I went to segw and created the entities. It created 2 entities: one for the Import data and the second for the table.
I did the mapping for the create, query. I created queryset only for the table.
Of course, everything is activated and I can test it via gateway client.
Now, I want to call from my ui5 this rfc and send it the IS_HEADER, the I_ID, the I_DETAIL_NO and the table T_FLIGHTS.
What am I missing?
Thank you,
Regards.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.