I have been attempting to discover if SAP supports content ID referencing in Gateway oData calls. The answer appears to be no.
Firstly sorry Thomas Jung for stuffing up your chi in the XSODATA threads, http://scn.sap.com/thread/3604817should have posted here instead
If you're working with say, a .net application using Microsoft library System.data.services.client (v3.5.00) that forms up your oData batch calls, you can't create a deep entity structure the same way we do with JSON for example.
Instead the Microsoft library has to rely on "setLink" or "addLink" which refers to the content ID referencing method for processing $batch calls.
Our older documentation states it's not supported but there were rumours this functionality may have been planned for support, but clearly ( as the below code suggests ) we're not there yet with Gateway SP08 (740)?
Class: /IWFND/CL_SODATA_PROCESSOR
Method: check_content_reference.
DATA: lv_char TYPE char1, lv_path_translated TYPE string, lx_mgw_busi_exception TYPE REF TO /iwfnd/cx_mgw_busi_exception. * PATH_TRANSLATED contains '$' as first character lv_path_translated = io_request->get_header_field( if_http_header_fields_sap=>path_translated ). lv_char = lv_path_translated. IF lv_char <> '$'. EXIT. ENDIF. * Create and raise a Business Exception TRY. CREATE OBJECT lx_mgw_busi_exception EXPORTING textid = /iwfnd/cx_mgw_tech_exception=>rfc_system_error remote_error_unlimited = 'Referencing requests in a changeset not supported'. "#EC NOTEXT RAISE EXCEPTION lx_mgw_busi_exception. CATCH /iwfnd/cx_mgw_busi_exception INTO lx_mgw_busi_exception. raise_business_error( lx_mgw_busi_exception ). ENDTRY.
For anyone reading this, what I'm referring to by Content-ID referencing, an example batch call is below ( I've hacked this down so it's clearer but should illustrate the process ):
POST /service.svc/Customers HTTP/1.1
Host: host
Content-Type: application/atom+xml;type=entry
Content-Length: ###
Content-ID: 1
POST /service.svc/Address HTTP/1.1
Host: host
Content-Type: application/atom+xml;type=entry
Content-Length: ###
Content-ID: 2
Content-Type: application/http
Content-Transfer-Encoding: binary
POST $1/$links/SOME_NAV_ID_HERE HTTP/1.1
Content-Type: application/json
You're basically wanting the Gateway framework to understand that Customers is linked to Addresses ( Content ID 1 and Content ID ) and we should create a deep insert if this is sent in a payload.
POST $1/$links/SOME_NAV_ID_HERE HTTP/1.1
This line is the most interesting, as when the standard SAP method check_content_reference is called, it will ALWAYS raise an exception as the line starts with "$". This is the link between the two objects in the payload and the exception tells me content ID referencing is not supported.
Do we have some definitive statements on when/if/why this will be supported?
Cheers
Leigh