Skip to Content
0
Oct 23, 2020 at 03:57 AM

Odata and attachment with folder problem

180 Views Last edit Oct 23, 2020 at 04:00 AM 2 rev

hi experts

I have an entity 'Project' with keys = ObjectType & Guid

This project has attachments, and the navigation to the attachment is 'ToAttachment'. The attachment entity has its own set of keys (one of the key is 'ParentFolderGuid')

I managed to create the file 'hhhh' directly under Project using this URI:

POST:

/sap/opu/odata/sap/xxxxxxxxxxxxxx/ProjectSet(ObjectType='DPO',Guid='00215A9CF3301EDABFC364CE8F39B4B1')/ToAttachment

Calling the above URI will trigger the CREATE_STREAM method and not the ATTACHMENTSET_CREATE_ENTITY method.

My question is, how should i call the URI in order to create new file under 'new subfolder'?

Calling using these URI are not valid:

POST:

/sap/opu/odata/sap/xxxxxxxxxxxxxxxx/ProjectSet(ObjectType='DPO',Guid='00215A9CF3301EDABFC364CE8F39B4B1')/ToAttachment(ParentFolderGuid='00215A9CF3301EEB859BBC0F30861A61')

/sap/opu/odata/sap/xxxxxxxxxxxxxxxx/ProjectSet(ObjectType='DPO',Guid='00215A9CF3301EDABFC364CE8F39B4B1',ParentFolderGuid='00215A9CF3301EEB859BBC0F30861A61')/ToAttachment

I cannot pass the Attachment entity data as request body too, because in the CREATE_STREAM, there is no io_data_provider->read_entry_data to get the entity data.

The only possible solution i can think of is to pass the ParentFolderGuid as the request header, but surely there is some official way to do this?

Please advise.

Thanks

Attachments

capture.png (4.9 kB)