SAP Integrated Product Development (SAP IPD) is a cloud-based Product Lifecycle Management solution running on SAP Business Technology Platform (BTP). It provides a rich set of Collaboration APIs that allow external systems, e.g. SAP S/4HANA landscapes, to interact programmatically with collaboration objects, like Documents, Reference Objects, or Workflows. Setting up the initial connection requires five easy steps:
You do have an active SAP IPD subscription on SAP BTP. Add a new service instance for SAP IPD Collaboration or choose an existing one. Create a Service Key for the new Connection, e.g. use the calling system's name as name for the key. Note properties endpoints:collab-service-url:url and uaa:clientid, uaa:clientsecret, and uaa:url.
For Authentication and Authorization a client profile is required. This has to be created only once and can be reused for all connections. Create an OAuth2 client profile like this:
- Start transaction SE80 and select your package.
- Right-click on the package name and choose Create / Others / OAuth2 Client Profile.
- Enter a client profile name.
- Enter HANA_CLOUD_PLATFORM as the type.
- Leave scope empty.
- Check Administration / No authorization check if required.
- Save and activate.
Configure OAuth2 settings as describe din the following section. We are using client credentials identifying the API as TECHNICAL-USER in SAP IPD Collaboration:
- Run transaction SOAUTH2_CLIENT.
- Choose Create.
- Enter the client profile name you created previously.
- Enter the client ID uaa:clientid from service key.
- Choose OK.
- In General Settings, enter Token endpoint uaa:url, append /oauth/token.
- In Client Authentication, enter the client secret uaa:clientsecret from service key.
- Save.
We don't want to hardcode the connection destails in our code but create an HTTP destination instead:
- Start transaction SM59
- Choose Create.
- Enter a name for the destination.
- Select G HTTP connection to external server as the connection type.
- On the Technical Settings tab, enter the URL without schema from service key endpoints:collab-service-url:url in the Host field, set Port 443.
- On the Logon & Security tab choose OAuth Settings and select the OAuth profile you created.
- Enable SSL with ANONYM SSL Client (Anonymous).
- Save.
For our example we are using the POST Collaboration endpoint to create a new Collaboration. Use this sample code as reference:
*&---------------------------------------------------------------------*
*& ABAP Example: Create Collaboration via EPD_COLLABORATION OData V4 API
*& API: POST /odata/v4/CollaborationService_v1/Collaboration
*& Auth: OAuth 2.0 handled automatically via BTP Destination
*&---------------------------------------------------------------------*
PROGRAM ZMBIPD.
DATA: lo_http_client TYPE REF TO if_http_client,
lv_json_body TYPE string,
lv_response_body TYPE string,
lv_status_code TYPE i,
lv_status_text TYPE string.
*----------------------------------------------------------------------*
* STEP 1: Create HTTP Client via Named Destination 'IPD_COLLABORATION'
* The destination must be configured in SM59 / BTP Cockpit,
* no hardcoded credentials or URLs required in ABAP source code.
*----------------------------------------------------------------------*
cl_http_client=>create_by_destination(
EXPORTING
destination = 'IPD_COLLABORATION'
IMPORTING
client = lo_http_client
EXCEPTIONS
argument_not_found = 1
destination_not_found = 2
destination_no_authority = 3
plugin_not_active = 4
internal_error = 5
OTHERS = 6 ).
IF sy-subrc <> 0 OR lo_http_client IS NOT BOUND.
WRITE: / 'Error creating HTTP client from destination IPD_COLLABORATION.'.
WRITE: / 'SY-SUBRC:', sy-subrc.
RETURN.
ENDIF.
*----------------------------------------------------------------------*
* STEP 2: Set Request Path for OData V4 Collaboration Entity
* The base URL is defined in the destination config.
* Only the relative resource path is appended here.
*----------------------------------------------------------------------*
lo_http_client->request->set_method( if_http_request=>co_request_method_post ).
lo_http_client->request->set_header_field(
name="~request_uri"
value="/odata/v4/CollaborationService_v1/Collaboration" ).
lo_http_client->request->set_header_field(
name="Content-Type"
value="application/json" ).
lo_http_client->request->set_header_field(
name="Accept"
value="application/json" ).
*----------------------------------------------------------------------*
* STEP 3: Build JSON Request Body
* Adjust field names to match the Collaboration entity
* schema as published on SAP Business Accelerator Hub.
* Replace placeholder values with actual runtime data.
*----------------------------------------------------------------------*
lv_json_body = '{' &&
'"name": "My Collaboration",' &&
'"description": "Created via ABAP OData V4 call",' &&
'"collaborationType": "DFLT"' &&
'}'.
lo_http_client->request->set_cdata( lv_json_body ).
*----------------------------------------------------------------------*
* STEP 4: Send Request and Receive Response
*----------------------------------------------------------------------*
lo_http_client->send(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
WRITE: / 'Error sending HTTP request.'.
WRITE: / 'SY-SUBRC:', sy-subrc.
lo_http_client->close( ).
RETURN.
ENDIF.
lo_http_client->receive(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
WRITE: / 'Error receiving HTTP response.'.
WRITE: / 'SY-SUBRC:', sy-subrc.
lo_http_client->close( ).
RETURN.
ENDIF.
*----------------------------------------------------------------------*
* STEP 5: Handle Response
* HTTP 201 = Collaboration created successfully
*----------------------------------------------------------------------*
lo_http_client->response->get_status(
IMPORTING
code = lv_status_code
reason = lv_status_text ).
lv_response_body = lo_http_client->response->get_cdata( ).
WRITE: / 'HTTP Status Code:', lv_status_code.
WRITE: / 'Status Text:', lv_status_text.
IF lv_status_code = 201.
WRITE: / 'Collaboration created successfully.'.
WRITE: / 'Response:', lv_response_body.
ELSE.
WRITE: / 'Error creating Collaboration:'.
WRITE: / lv_response_body.
ENDIF.
*----------------------------------------------------------------------*
* STEP 6: Close HTTP Connection
*----------------------------------------------------------------------*
lo_http_client->close(
EXCEPTIONS
http_invalid_state = 1
OTHERS = 2 ).Executing above code will create a new Collaboration of type DFLT. In case of success it will return status HTTP 201 Created with message Collaboration created successfully.
View created Collaboration in My Collaborations App



