Communication Scenarios - Der umfassende Guide

kategorie
Integration
Veröffentlicht
autor
Johannes

Communication Scenarios sind das zentrale Konzept für die Konfiguration von Schnittstellen in ABAP Cloud. Sie definieren, welche Dienste ein ABAP-System konsumieren (Outbound) oder bereitstellen (Inbound) kann, und ermöglichen eine saubere Trennung zwischen Entwicklung und Administration.

Das Communication Management Konzept

In ABAP Cloud ersetzt das Communication Management die klassischen Konfigurationsansätze wie SM59-Destinationen, SOAMANAGER oder SICF-Dienste. Es besteht aus vier Hauptkomponenten:

┌──────────────────────────────────────────────────────────────────────────┐
│ Communication Management - Übersicht │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ Communication Scenario │ │ Communication System │ │
│ │ (Entwickler) │ │ (Administrator) │ │
│ │ │ │ │ │
│ │ - Definiert Services │ │ - Repräsentiert │ │
│ │ - Inbound/Outbound │ │ Zielsystem │ │
│ │ - Authentifizierungs- │ │ - Host, Port, URL │ │
│ │ methoden │ │ - Zertifikate │ │
│ └────────────┬────────────┘ └────────────┬────────────┘ │
│ │ │ │
│ └───────────┬───────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ Communication │ │
│ │ Arrangement │ │
│ │ (Administrator) │ │
│ │ │ │
│ │ - Verbindet Scenario │ │
│ │ mit System │ │
│ │ - Aktiviert Services │ │
│ │ - Credentials │ │
│ └────────────┬────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ Communication User │ │
│ │ (Administrator) │ │
│ │ │ │
│ │ - Technischer Benutzer │ │
│ │ - Authentifizierung │ │
│ └─────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

Rollentrennung

RolleVerantwortungArtefakte
EntwicklerDefiniert benötigte SchnittstellenCommunication Scenario
AdministratorKonfiguriert VerbindungenSystem, User, Arrangement
SecurityVerwaltet CredentialsZertifikate, OAuth-Clients

Communication Scenario

Das Communication Scenario ist das Herzstück des Communication Managements. Es wird vom Entwickler erstellt und definiert, welche Services das ABAP-System nutzen oder anbieten kann.

Scenario-Typen

Es gibt zwei grundlegende Typen von Communication Scenarios:

┌──────────────────────────────────────────────────────────────────────────┐
│ Outbound Scenario Inbound Scenario │
│ (ABAP ruft externes System) (Externes System ruft ABAP) │
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐│
│ │ ABAP Cloud │────>│ Externes │ │ Externes │────>│ ABAP Cloud ││
│ │ │ │ System │ │ System │ │ ││
│ └────────────┘ └────────────┘ └────────────┘ └────────────┘│
│ │
│ Beispiele: Beispiele: │
│ - REST API aufrufen - OData Service exponieren │
│ - RFC zu S/4HANA - Webhook empfangen │
│ - SOAP Service konsumieren - Event Handler │
│ - Event Mesh publizieren - API für externe Apps │
└──────────────────────────────────────────────────────────────────────────┘

Standard-Scenarios von SAP

SAP liefert zahlreiche vorgefertigte Communication Scenarios aus:

Scenario IDBeschreibungTyp
SAP_COM_0008OData Service ExposureInbound
SAP_COM_0276Destination Service IntegrationOutbound
SAP_COM_0109SAP Event Mesh IntegrationOutbound
SAP_COM_0193SOAP Service ConsumptionOutbound
SAP_COM_0636SAP Forms Service by AdobeOutbound

Eigenes Communication Scenario erstellen

Für eigene Integrationen können Sie ein Custom Communication Scenario in ADT anlegen:

Schritt 1: Neues Scenario in ADT

Rechtsklick auf Package → New → Other ABAP Repository Object
→ Cloud Communication Management → Communication Scenario

Schritt 2: Scenario konfigurieren

┌──────────────────────────────────────────────────────────────────────────┐
│ Communication Scenario: Z_EXTERNAL_CRM │
├──────────────────────────────────────────────────────────────────────────┤
│ ID: Z_EXTERNAL_CRM │
│ Description: Integration mit externem CRM-System │
│ Scenario Type: Customer │
│ │
│ ┌── Outbound Services ────────────────────────────────────────────────┐ │
│ │ Service ID Service Type Description │ │
│ │ Z_CRM_REST HTTP REST API für Kundendaten │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── Supported Authentication Methods ─────────────────────────────────┐ │
│ │ [x] Basic Authentication │ │
│ │ [x] OAuth 2.0 Client Credentials │ │
│ │ [ ] X.509 Certificate │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────┘

Schritt 3: Scenario als XML

Das Communication Scenario wird als XML-Datei im Repository gespeichert:

<?xml version="1.0" encoding="utf-8"?>
<communicationScenario id="Z_EXTERNAL_CRM"
scenarioType="customer">
<description>Integration mit externem CRM-System</description>
<outboundServices>
<service id="Z_CRM_REST">
<description>REST API für Kundendaten</description>
<serviceType>http</serviceType>
</service>
</outboundServices>
<supportedAuthenticationMethods>
<method>basic</method>
<method>oauth2_client_credentials</method>
</supportedAuthenticationMethods>
</communicationScenario>

Communication System

Das Communication System repräsentiert das externe System, mit dem kommuniziert wird. Es enthält technische Verbindungsdetails wie Host, Port und Zertifikate.

System anlegen (Fiori App)

┌──────────────────────────────────────────────────────────────────────────┐
│ Maintain Communication Systems │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ System ID: EXTERNAL_CRM_PROD │
│ System Name: Externes CRM Produktivsystem │
│ │
│ ┌── General ────────────────────────────────────────────────────────┐ │
│ │ Host Name: api.crm-vendor.com │ │
│ │ Port: 443 │ │
│ │ HTTPS: [x] │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── Technical Data ─────────────────────────────────────────────────┐ │
│ │ [ ] Cloud Connector │ │
│ │ [x] Internet │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── OAuth 2.0 Settings ─────────────────────────────────────────────┐ │
│ │ Token Endpoint: https://auth.crm-vendor.com/oauth/token │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

System-Typen

Proxy TypeBeschreibungVerwendung
InternetDirekter InternetzugangÖffentliche APIs, Cloud-Services
OnPremiseVia SAP Cloud ConnectorInterne Systeme hinter Firewall

Zertifikate hinterlegen

Für Client Certificate Authentication oder Server-Zertifikatsvalidierung:

┌── SSL Client Certificate ────────────────────────────────────────────────┐
│ Certificate: [Upload .p12 / .pem] │
│ Private Key Password: ******** │
│ │
│ Subject: CN=abap-cloud-client, O=MyCompany │
│ Issuer: CN=MyCompany CA │
│ Valid until: 2027-01-15 │
└──────────────────────────────────────────────────────────────────────────┘

Communication User

Der Communication User ist ein technischer Benutzer für die Authentifizierung bei eingehenden Anfragen (Inbound-Szenarien).

User anlegen

┌──────────────────────────────────────────────────────────────────────────┐
│ Maintain Communication Users │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ User Name: CRM_INTEGRATION_USER │
│ Description: Technischer User für CRM-Integration │
│ │
│ ┌── Authentication Method ──────────────────────────────────────────┐ │
│ │ ( ) User ID and Password │ │
│ │ (x) SSL Client Certificate │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── For Password Authentication ────────────────────────────────────┐ │
│ │ Password: ******** │ │
│ │ Confirm Password: ******** │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

User-Typen

MethodeSicherheitVerwaltungsaufwand
User/PasswordMittelPasswort-Rotation
Client CertificateHochZertifikats-Erneuerung
OAuth 2.0HochToken-Management automatisch

Communication Arrangement

Das Communication Arrangement verbindet alle Komponenten und aktiviert die Kommunikation.

Arrangement anlegen

┌──────────────────────────────────────────────────────────────────────────┐
│ Communication Arrangement │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ Arrangement ID: Z_CRM_PROD_ARRANGEMENT │
│ │
│ ┌── Scenario ───────────────────────────────────────────────────────┐ │
│ │ Communication Scenario: Z_EXTERNAL_CRM │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── Communication System ───────────────────────────────────────────┐ │
│ │ Communication System: EXTERNAL_CRM_PROD │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── Outbound Services ──────────────────────────────────────────────┐ │
│ │ Service Status Path │ │
│ │ Z_CRM_REST Active /api/v2 │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── Authentication ─────────────────────────────────────────────────┐ │
│ │ Method: OAuth 2.0 Client Credentials │ │
│ │ Client ID: crm-integration-client │ │
│ │ Client Secret: ******** │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

Inbound vs. Outbound im Detail

Outbound-Szenario: ABAP ruft externes System

Bei Outbound-Szenarien initiiert ABAP Cloud die Kommunikation zu einem externen System.

CLASS zcl_crm_client DEFINITION
PUBLIC FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
TYPES:
BEGIN OF ty_customer,
id TYPE string,
name TYPE string,
email TYPE string,
END OF ty_customer.
METHODS get_customer
IMPORTING iv_customer_id TYPE string
RETURNING VALUE(rs_result) TYPE ty_customer
RAISING cx_http_dest_provider_error
cx_web_http_client_error.
PRIVATE SECTION.
METHODS get_destination
RETURNING VALUE(ro_destination) TYPE REF TO if_http_destination
RAISING cx_http_dest_provider_error.
ENDCLASS.
CLASS zcl_crm_client IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
TRY.
DATA(ls_customer) = get_customer( '12345' ).
out->write( |Kunde: { ls_customer-name } ({ ls_customer-email })| ).
CATCH cx_http_dest_provider_error INTO DATA(lx_dest).
out->write( |Destination-Fehler: { lx_dest->get_text( ) }| ).
CATCH cx_web_http_client_error INTO DATA(lx_http).
out->write( |HTTP-Fehler: { lx_http->get_text( ) }| ).
ENDTRY.
ENDMETHOD.
METHOD get_destination.
" Destination über Communication Arrangement abrufen
ro_destination = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = 'Z_EXTERNAL_CRM'
service_id = 'Z_CRM_REST' ).
ENDMETHOD.
METHOD get_customer.
" 1. Destination abrufen
DATA(lo_destination) = get_destination( ).
" 2. HTTP-Client erstellen
DATA(lo_client) = cl_web_http_client_manager=>create_by_http_destination(
i_destination = lo_destination ).
" 3. Request konfigurieren
DATA(lo_request) = lo_client->get_http_request( ).
lo_request->set_uri_path( |/customers/{ iv_customer_id }| ).
lo_request->set_header_field(
i_name = 'Accept'
i_value = 'application/json' ).
" 4. Request ausführen
DATA(lo_response) = lo_client->execute( if_web_http_client=>get ).
DATA(lv_status) = lo_response->get_status( )-code.
IF lv_status = 200.
DATA(lv_json) = lo_response->get_text( ).
/ui2/cl_json=>deserialize(
EXPORTING json = lv_json
CHANGING data = rs_result ).
ELSE.
RAISE EXCEPTION TYPE cx_web_http_client_error.
ENDIF.
lo_client->close( ).
ENDMETHOD.
ENDCLASS.

Inbound-Szenario: Externes System ruft ABAP

Bei Inbound-Szenarien stellt ABAP Cloud Services bereit, die von externen Systemen aufgerufen werden.

OData Service exponieren:

  1. RAP Business Object erstellen
  2. Service Definition und Service Binding anlegen
  3. Inbound Communication Scenario erstellen oder SAP_COM_0008 nutzen
  4. Communication Arrangement für den Aufrufer einrichten
┌──────────────────────────────────────────────────────────────────────────┐
│ Inbound Communication Scenario: Z_CUSTOMER_API │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌── Inbound Services ───────────────────────────────────────────────┐ │
│ │ Service ID Service Type Service Binding │ │
│ │ Z_CUSTOMER_ODATA OData V4 ZSB_CUSTOMER_V4 │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── Supported Authentication ───────────────────────────────────────┐ │
│ │ [x] User ID and Password │ │
│ │ [x] OAuth 2.0 Client Credentials │ │
│ │ [x] X.509 Certificate │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

Authentifizierungsmethoden

Basic Authentication

Die einfachste Methode - Benutzername und Passwort werden im HTTP-Header übertragen:

" Bei Communication Arrangement mit Basic Auth:
" - Im Arrangement werden Client ID und Secret hinterlegt
" - Der HTTP-Client fügt den Authorization-Header automatisch hinzu
DATA(lo_destination) = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = 'Z_EXTERNAL_CRM'
service_id = 'Z_CRM_REST' ).
" Authentifizierung erfolgt automatisch basierend auf Arrangement-Konfiguration

OAuth 2.0 Client Credentials

Für Machine-to-Machine-Kommunikation empfohlen:

┌──────────────────────────────────────────────────────────────────────────┐
│ OAuth 2.0 Flow (Client Credentials) │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ 1. ABAP Cloud ───────> OAuth Server │
│ POST /oauth/token │
│ grant_type=client_credentials │
│ client_id=xxx │
│ client_secret=yyy │
│ │
│ 2. OAuth Server ───────> ABAP Cloud │
│ { "access_token": "eyJ...", "expires_in": 3600 } │
│ │
│ 3. ABAP Cloud ───────> Ziel-API │
│ Authorization: Bearer eyJ... │
│ │
│ Das Token wird automatisch gecacht und vor Ablauf erneuert. │
└──────────────────────────────────────────────────────────────────────────┘

Im Communication System die OAuth-Einstellungen konfigurieren:

Token Service URL: https://auth.crm-vendor.com/oauth/token
Token Service URL Type: Dedicated
Im Communication Arrangement:
Client ID: crm-integration-client
Client Secret: ********

X.509 Client Certificate

Höchste Sicherheitsstufe für kritische Integrationen:

┌──────────────────────────────────────────────────────────────────────────┐
│ Certificate Authentication Flow │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ 1. TLS-Handshake mit Client-Zertifikat │
│ ABAP Cloud präsentiert sein Zertifikat │
│ │
│ 2. Server validiert Zertifikat │
│ - Gültigkeit (Datum) │
│ - Aussteller (CA) │
│ - CN/Subject │
│ │
│ 3. Verschlüsselte Kommunikation │
│ Alle Daten mit TLS verschlüsselt │
└──────────────────────────────────────────────────────────────────────────┘

Vollständiges Beispiel: Eigenes Communication Scenario

Anforderung

Ein Custom Communication Scenario für die Integration mit einem externen Lagerverwaltungssystem (WMS):

  • REST-API-Aufruf für Bestandsabfrage
  • SOAP-Service für Warenbewegungen
  • OAuth 2.0 Authentifizierung

Schritt 1: Communication Scenario anlegen

In ADT: Rechtsklick auf Package → New → Other ABAP Repository Object → Communication Scenario

<?xml version="1.0" encoding="utf-8"?>
<communicationScenario id="Z_WMS_INTEGRATION"
scenarioType="customer">
<description>Integration mit Warehouse Management System</description>
<outboundServices>
<service id="Z_WMS_REST_STOCK">
<description>Bestandsabfrage REST</description>
<serviceType>http</serviceType>
</service>
<service id="Z_WMS_SOAP_MOVEMENT">
<description>Warenbewegung SOAP</description>
<serviceType>soap</serviceType>
</service>
</outboundServices>
<supportedAuthenticationMethods>
<method>oauth2_client_credentials</method>
</supportedAuthenticationMethods>
</communicationScenario>

Schritt 2: Implementierung der API-Klasse

CLASS zcl_wms_api DEFINITION
PUBLIC FINAL
CREATE PUBLIC.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_stock_item,
material_id TYPE string,
warehouse TYPE string,
quantity TYPE decfloat16,
unit TYPE string,
END OF ty_stock_item,
tt_stock_items TYPE STANDARD TABLE OF ty_stock_item WITH EMPTY KEY.
TYPES:
BEGIN OF ty_movement,
document_id TYPE string,
material_id TYPE string,
quantity TYPE decfloat16,
movement_type TYPE string,
END OF ty_movement.
" Bestandsabfrage über REST
METHODS get_stock
IMPORTING iv_material_id TYPE string
RETURNING VALUE(rt_result) TYPE tt_stock_items
RAISING cx_http_dest_provider_error
cx_web_http_client_error.
" Warenbewegung über REST
METHODS post_movement
IMPORTING is_movement TYPE ty_movement
RETURNING VALUE(rv_doc_id) TYPE string
RAISING cx_http_dest_provider_error
cx_web_http_client_error.
PRIVATE SECTION.
CONSTANTS:
c_scenario TYPE if_com_scenario_factory=>ty_cscn_id VALUE 'Z_WMS_INTEGRATION',
c_service_stock TYPE if_com_scenario_factory=>ty_cscn_outb_srv_id VALUE 'Z_WMS_REST_STOCK',
c_service_move TYPE if_com_scenario_factory=>ty_cscn_outb_srv_id VALUE 'Z_WMS_SOAP_MOVEMENT'.
METHODS get_http_destination
IMPORTING iv_service_id TYPE if_com_scenario_factory=>ty_cscn_outb_srv_id
RETURNING VALUE(ro_destination) TYPE REF TO if_http_destination
RAISING cx_http_dest_provider_error.
ENDCLASS.
CLASS zcl_wms_api IMPLEMENTATION.
METHOD get_http_destination.
" Destination aus Communication Arrangement abrufen
ro_destination = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = c_scenario
service_id = iv_service_id ).
ENDMETHOD.
METHOD get_stock.
" 1. Destination für Stock-Service abrufen
DATA(lo_destination) = get_http_destination( c_service_stock ).
" 2. HTTP-Client erstellen
DATA(lo_client) = cl_web_http_client_manager=>create_by_http_destination(
i_destination = lo_destination ).
TRY.
" 3. Request konfigurieren
DATA(lo_request) = lo_client->get_http_request( ).
lo_request->set_uri_path( |/stock?material={ iv_material_id }| ).
lo_request->set_header_field(
i_name = 'Accept'
i_value = 'application/json' ).
" 4. Request ausführen
DATA(lo_response) = lo_client->execute( if_web_http_client=>get ).
DATA(lv_status) = lo_response->get_status( )-code.
IF lv_status = 200.
DATA(lv_json) = lo_response->get_text( ).
/ui2/cl_json=>deserialize(
EXPORTING json = lv_json
CHANGING data = rt_result ).
ENDIF.
CLEANUP.
lo_client->close( ).
ENDTRY.
ENDMETHOD.
METHOD post_movement.
DATA(lo_destination) = get_http_destination( c_service_stock ).
DATA(lo_client) = cl_web_http_client_manager=>create_by_http_destination(
i_destination = lo_destination ).
TRY.
DATA(lo_request) = lo_client->get_http_request( ).
lo_request->set_uri_path( '/movements' ).
" JSON-Body erstellen
DATA(lv_json) = /ui2/cl_json=>serialize(
data = is_movement
compress = abap_true
pretty_name = /ui2/cl_json=>pretty_mode-camel_case ).
lo_request->set_text( lv_json ).
lo_request->set_header_field(
i_name = 'Content-Type'
i_value = 'application/json' ).
" POST ausführen
DATA(lo_response) = lo_client->execute( if_web_http_client=>post ).
IF lo_response->get_status( )-code = 201.
" Document-ID aus Response extrahieren
DATA: BEGIN OF ls_response,
document_id TYPE string,
END OF ls_response.
/ui2/cl_json=>deserialize(
EXPORTING json = lo_response->get_text( )
CHANGING data = ls_response ).
rv_doc_id = ls_response-document_id.
ENDIF.
CLEANUP.
lo_client->close( ).
ENDTRY.
ENDMETHOD.
ENDCLASS.

Schritt 3: Administrator-Konfiguration

Nach dem Transport des Communication Scenarios kann der Administrator die Verbindung einrichten:

  1. Communication System anlegen:

  2. Communication Arrangement anlegen:

    • Scenario: Z_WMS_INTEGRATION
    • System: WMS_PROD
    • OAuth Client ID und Secret hinterlegen
    • Services aktivieren

Troubleshooting

Häufige Fehler und Lösungen

1. “No Communication Arrangement found”

Fehler: CX_HTTP_DEST_PROVIDER_ERROR
No Communication Arrangement found for scenario Z_EXTERNAL_CRM

Ursachen und Lösungen:

UrsacheLösung
Arrangement nicht angelegtFiori App “Maintain Communication Arrangements” öffnen
Scenario-ID falschExact match prüfen (case-sensitive)
Service nicht aktiviertIm Arrangement den Service aktivieren
Arrangement nicht aktivStatus auf “Active” setzen

2. “Authentication failed”

Fehler: HTTP 401 Unauthorized

Checkliste:

  • Credentials im Arrangement korrekt hinterlegt?
  • Bei OAuth: Token-URL erreichbar?
  • Client ID und Secret korrekt?
  • Bei Certificate: Zertifikat noch gültig?
  • Bei Basic Auth: Passwort nicht abgelaufen?

3. “Connection refused / Timeout”

Fehler: CX_WEB_HTTP_CLIENT_ERROR
Connection refused

Prüfpunkte:

┌── Connectivity Checklist ────────────────────────────────────────────────┐
│ │
│ 1. Host erreichbar? │
│ - DNS-Auflösung funktioniert? │
│ - Port offen (443 für HTTPS)? │
│ │
│ 2. Cloud Connector (bei OnPremise)? │
│ - Cloud Connector läuft? │
│ - Virtual Host korrekt konfiguriert? │
│ - Resource Path freigegeben? │
│ │
│ 3. SSL/TLS? │
│ - Server-Zertifikat gültig? │
│ - CA im Trust Store? │
│ │
│ 4. Firewall? │
│ - Ausgehende Verbindung erlaubt? │
│ - IP-Whitelist auf Zielseite? │
└──────────────────────────────────────────────────────────────────────────┘

4. “Service ID not found”

Fehler: Service 'Z_MY_SERVICE' not found in scenario 'Z_MY_SCENARIO'

Lösung:

  1. Communication Scenario in ADT öffnen
  2. Outbound Services prüfen
  3. Service-ID exakt übernehmen
  4. Scenario aktivieren und transportieren

Debugging-Tipps

1. Destination testen:

TRY.
DATA(lo_dest) = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = 'Z_EXTERNAL_CRM'
service_id = 'Z_CRM_REST' ).
" Destination-Details ausgeben
DATA(lv_url) = lo_dest->get_uri( ).
out->write( |URL: { lv_url }| ).
CATCH cx_http_dest_provider_error INTO DATA(lx_error).
out->write( |Fehler: { lx_error->get_text( ) }| ).
ENDTRY.

2. HTTP-Response analysieren:

DATA(lo_response) = lo_client->execute( if_web_http_client=>get ).
" Status und Reason
DATA(ls_status) = lo_response->get_status( ).
out->write( |Status: { ls_status-code } { ls_status-reason }| ).
" Response-Header
DATA(lt_headers) = lo_response->get_header_fields( ).
LOOP AT lt_headers INTO DATA(ls_header).
out->write( |{ ls_header-name }: { ls_header-value }| ).
ENDLOOP.
" Response-Body (bei Fehlern oft hilfreich)
DATA(lv_body) = lo_response->get_text( ).
out->write( lv_body ).

3. Application Logging nutzen:

" Logging für Troubleshooting einbauen
DATA(lo_log) = cl_bali_log=>create_with_header(
header = cl_bali_header_setter=>create( )->set_object( 'ZCOMM_MGMT' )
->set_subobject( 'DEBUG' ) ).
lo_log->add_item( cl_bali_message_setter=>create(
severity = if_bali_constants=>c_severity_status
id = 'ZCOMM_MSG'
number = '001' )->set_text( |Calling { lv_url }| ) ).
cl_bali_log_db=>get_instance( )->save_log( lo_log ).

Best Practices

ThemaEmpfehlung
NamenskonventionZ_{SYSTEM}_{FUNKTION} für Scenarios
AuthentifizierungOAuth 2.0 für neue Integrationen, Certificate für hochkritische
UmgebungenSeparate Arrangements für DEV/QA/PROD
CredentialsNie im Code, immer im Arrangement
FehlerbehandlungSpezifische Exceptions für Destination vs. HTTP-Fehler
MonitoringApplication Logging für alle API-Aufrufe
DokumentationScenario-Beschreibung und Abhängigkeiten dokumentieren

Weiterführende Themen