Skip to Content

Trouble in Applying Batch-Parent-Child in UI5

Hi Expert,

I was looking at this great blog https://blogs.sap.com/2016/02/15/introduction-odata-batch-processing-with-content-id-in-sap-gateway by Kenichi Unnai, then I was trying to create the UI5 code to simulate normal payload (i.e.: $1/Nav), but I have some problem.

oModel.createEntry("/HeadSet", { 
	"groupId": "foo",
	"headers":{"Content-ID":1},
	properties: aHead
});
.....
oModel.createEntry("$1/HeadItemNav", { <-- ERROR HERE: No Metadata for collection found
	"groupId": "foo",
	properties: aItem
});
.....                                  NOTE: HeadItemNav is linked to ItemSet
oModel.submitChanges({
	"groupId": "foo",
	success: function(oData){
		MessageToast.show("SUCCESS");
	},
	error: function(oError){
		MessageToast.show("ERROR");
	}
});

Meanwhile if I just use like below, it got through, but I have a difficulty in getting pushing in value for IT_OPERATION_INFO-CONTENT_ID_REF in CHANGESET_BEGIN.

oModel.createEntry("/ItemSet", {        <-- this got through to CHANGESET_BEGIN
	"groupId": "foo",
	"headers":{"Content-ID-Ref":1}, <-- This Does not seem to pass to CONTENT_ID_REF
	properties: aItem
});

How do I pass value to IT_OPERATION_INFO-CONTENT_ID_REF I wonder? Appreciate your expertise and advice on this matter

Best Regards

Andre Julius

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 14, 2018 at 11:20 AM

    Hi Andre,

    The "Content-ID" you are passing is incorrect. it should be "content-ID" and It should work for normal "create" but not sure if it works for "createEntry".

    					"headers": {
    						"content-ID": 1
    					}
    

    Let me know if you get any issues.

    I am not sure why "$1/Nav" is not working, not even sure if ui5 supports it(Never tried :( ).

    Instead you can use the deep structure format to send the data, but you might have to call "Create" function for this and you will be able to get the data in deep format in changesetprocess method.

    ** UPDATE **

    you need to mention "/$1/navigation" . you missed the '/' before the content id.

    BR,

    Mahesh

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 14, 2018 at 12:35 PM

    hi Mahesh,

    Thanks for responding, but Content-ID works fine for me

    My problem is to retrieve CONTENT_ID_REF...meanwhile CONTENT_ID is populated just fine. (Those are 2 separate fields)

    Best Regards

    Andre Julius

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 14, 2018 at 01:47 PM

    Hi Mahesh,

    If i remember correctly i tried that also. Unfortunately i can't try now as i dont have my PC, but did it work for you?

    Best Regards

    Andre Julius

    Add comment
    10|10000 characters needed characters exceeded