logo

Are you need IT Support Engineer? Free Consultant

Integrate and Automate: Calling SAP Integrated Pro…

  • By Sanjay
  • 24/06/2026
  • 1 Views


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:

    1. Start transaction SE80 and select your package.
    2. Right-click on the package name and choose Create / Others / OAuth2 Client Profile.
    3. Enter a client profile name.
    4. Enter HANA_CLOUD_PLATFORM as the type.
    5. Leave scope empty.
    6. Check Administration / No authorization check if required.
    7. 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:

    1. Run transaction SOAUTH2_CLIENT.
    2. Choose Create.
    3. Enter the client profile name you created previously.
    4. Enter the client ID uaa:clientid from service key.
    5. Choose OK.
    6. In General Settings, enter Token endpoint uaa:url, append /oauth/token.
    7. In Client Authentication, enter the client secret uaa:clientsecret from service key.
    8. Save.

 

We don't want to hardcode the connection destails in our code but create an HTTP destination instead:

    1. Start transaction SM59
    2. Choose Create.
    3. Enter a name for the destination.
    4. Select G HTTP connection to external server as the connection type.
    5. 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.
    6. On the Logon & Security tab choose OAuth Settings and select the OAuth profile you created.
    7. Enable SSL with ANONYM SSL Client (Anonymous).
    8. 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 AppView created Collaboration in My Collaborations App

 

 

 



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *