Communication Scenarios - Le guide complet

Catégorie
Integration
Publié
Auteur
Johannes

Les Communication Scenarios sont le concept central pour la configuration des interfaces dans ABAP Cloud. Ils définissent quels services un système ABAP peut consommer (Outbound) ou fournir (Inbound), et permettent une séparation propre entre le développement et l’administration.

Le concept de Communication Management

Dans ABAP Cloud, le Communication Management remplace les approches de configuration classiques comme les destinations SM59, SOAMANAGER ou les services SICF. Il se compose de quatre composants principaux :

┌──────────────────────────────────────────────────────────────────────────┐
│ Communication Management - Vue d'ensemble │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ Communication Scenario │ │ Communication System │ │
│ │ (Développeur) │ │ (Administrateur) │ │
│ │ │ │ │ │
│ │ - Définit les services │ │ - Représente le │ │
│ │ - Inbound/Outbound │ │ système cible │ │
│ │ - Méthodes │ │ - Host, Port, URL │ │
│ │ d'authentification │ │ - Certificats │ │
│ └────────────┬────────────┘ └────────────┬────────────┘ │
│ │ │ │
│ └───────────┬───────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ Communication │ │
│ │ Arrangement │ │
│ │ (Administrateur) │ │
│ │ │ │
│ │ - Connecte Scenario │ │
│ │ avec System │ │
│ │ - Active les services │ │
│ │ - Credentials │ │
│ └────────────┬────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ Communication User │ │
│ │ (Administrateur) │ │
│ │ │ │
│ │ - Utilisateur technique│ │
│ │ - Authentification │ │
│ └─────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

Séparation des rôles

RôleResponsabilitéArtefacts
DéveloppeurDéfinit les interfaces requisesCommunication Scenario
AdministrateurConfigure les connexionsSystem, User, Arrangement
SécuritéGère les credentialsCertificats, clients OAuth

Communication Scenario

Le Communication Scenario est le coeur du Communication Management. Il est créé par le développeur et définit quels services le système ABAP peut utiliser ou fournir.

Types de scénarios

Il existe deux types fondamentaux de Communication Scenarios :

┌──────────────────────────────────────────────────────────────────────────┐
│ Scénario Outbound Scénario Inbound │
│ (ABAP appelle système externe) (Système externe appelle ABAP) │
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐│
│ │ ABAP Cloud │────>│ Système │ │ Système │────>│ ABAP Cloud ││
│ │ │ │ externe │ │ externe │ │ ││
│ └────────────┘ └────────────┘ └────────────┘ └────────────┘│
│ │
│ Exemples : Exemples : │
│ - Appeler une API REST - Exposer un service OData │
│ - RFC vers S/4HANA - Recevoir un webhook │
│ - Consommer service SOAP - Gestionnaire d'événements │
│ - Publier vers Event Mesh - API pour apps externes │
└──────────────────────────────────────────────────────────────────────────┘

Scénarios standard de SAP

SAP fournit de nombreux Communication Scenarios prédéfinis :

Scenario IDDescriptionType
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

Créer votre propre Communication Scenario

Pour vos propres intégrations, vous pouvez créer un Communication Scenario personnalisé dans ADT :

Étape 1 : Nouveau Scenario dans ADT

Clic droit sur Package → New → Other ABAP Repository Object
→ Cloud Communication Management → Communication Scenario

Étape 2 : Configurer le Scenario

┌──────────────────────────────────────────────────────────────────────────┐
│ Communication Scenario : Z_EXTERNAL_CRM │
├──────────────────────────────────────────────────────────────────────────┤
│ ID : Z_EXTERNAL_CRM │
│ Description : Intégration avec système CRM externe │
│ Scenario Type : Customer │
│ │
│ ┌── Outbound Services ────────────────────────────────────────────────┐ │
│ │ Service ID Service Type Description │ │
│ │ Z_CRM_REST HTTP API REST pour données clients │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── Supported Authentication Methods ─────────────────────────────────┐ │
│ │ [x] Basic Authentication │ │
│ │ [x] OAuth 2.0 Client Credentials │ │
│ │ [ ] X.509 Certificate │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────┘

Étape 3 : Scenario en XML

Le Communication Scenario est sauvegardé comme fichier XML dans le repository :

<?xml version="1.0" encoding="utf-8"?>
<communicationScenario id="Z_EXTERNAL_CRM"
scenarioType="customer">
<description>Intégration avec système CRM externe</description>
<outboundServices>
<service id="Z_CRM_REST">
<description>API REST pour données clients</description>
<serviceType>http</serviceType>
</service>
</outboundServices>
<supportedAuthenticationMethods>
<method>basic</method>
<method>oauth2_client_credentials</method>
</supportedAuthenticationMethods>
</communicationScenario>

Communication System

Le Communication System représente le système externe avec lequel on communique. Il contient les détails de connexion technique comme l’hôte, le port et les certificats.

Créer un System (App Fiori)

┌──────────────────────────────────────────────────────────────────────────┐
│ Maintain Communication Systems │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ System ID : EXTERNAL_CRM_PROD │
│ System Name : Système CRM externe Production │
│ │
│ ┌── 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 │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

Types de systèmes

Proxy TypeDescriptionUtilisation
InternetAccès Internet directAPIs publiques, services cloud
OnPremiseVia SAP Cloud ConnectorSystèmes internes derrière firewall

Déposer des certificats

Pour l’authentification par certificat client ou la validation de certificat serveur :

┌── 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

Le Communication User est un utilisateur technique pour l’authentification des requêtes entrantes (scénarios Inbound).

Créer un User

┌──────────────────────────────────────────────────────────────────────────┐
│ Maintain Communication Users │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ User Name : CRM_INTEGRATION_USER │
│ Description : Utilisateur technique pour intégration CRM │
│ │
│ ┌── Authentication Method ──────────────────────────────────────────┐ │
│ │ ( ) User ID and Password │ │
│ │ (x) SSL Client Certificate │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌── For Password Authentication ────────────────────────────────────┐ │
│ │ Password : ******** │ │
│ │ Confirm Password : ******** │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

Types d’utilisateurs

MéthodeSécuritéEffort de gestion
User/PasswordMoyenRotation de mot de passe
Client CertificateÉlevéRenouvellement de certificat
OAuth 2.0ÉlevéGestion de tokens automatique

Communication Arrangement

Le Communication Arrangement connecte tous les composants et active la communication.

Créer un Arrangement

┌──────────────────────────────────────────────────────────────────────────┐
│ 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 en détail

Scénario Outbound : ABAP appelle un système externe

Dans les scénarios Outbound, ABAP Cloud initie la communication vers un système externe.

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( |Client : { ls_customer-name } ({ ls_customer-email })| ).
CATCH cx_http_dest_provider_error INTO DATA(lx_dest).
out->write( |Erreur destination : { lx_dest->get_text( ) }| ).
CATCH cx_web_http_client_error INTO DATA(lx_http).
out->write( |Erreur HTTP : { lx_http->get_text( ) }| ).
ENDTRY.
ENDMETHOD.
METHOD get_destination.
" Récupérer la destination via Communication Arrangement
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. Récupérer la destination
DATA(lo_destination) = get_destination( ).
" 2. Créer le client HTTP
DATA(lo_client) = cl_web_http_client_manager=>create_by_http_destination(
i_destination = lo_destination ).
" 3. Configurer la requête
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. Exécuter la requête
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.

Scénario Inbound : Un système externe appelle ABAP

Dans les scénarios Inbound, ABAP Cloud fournit des services qui sont appelés par des systèmes externes.

Exposer un service OData :

  1. Créer un RAP Business Object
  2. Créer Service Definition et Service Binding
  3. Créer un Inbound Communication Scenario ou utiliser SAP_COM_0008
  4. Configurer un Communication Arrangement pour l’appelant
┌──────────────────────────────────────────────────────────────────────────┐
│ 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 │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘

Méthodes d’authentification

Basic Authentication

La méthode la plus simple - nom d’utilisateur et mot de passe sont transmis dans l’en-tête HTTP :

" Avec Communication Arrangement configuré en Basic Auth :
" - Dans l'Arrangement, Client ID et Secret sont déposés
" - Le client HTTP ajoute automatiquement l'en-tête Authorization
DATA(lo_destination) = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = 'Z_EXTERNAL_CRM"
service_id = 'Z_CRM_REST' ).
" L'authentification se fait automatiquement basée sur la configuration de l'Arrangement

OAuth 2.0 Client Credentials

Recommandé pour la communication machine-à-machine :

┌──────────────────────────────────────────────────────────────────────────┐
│ 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 ───────> API Cible │
│ Authorization: Bearer eyJ... │
│ │
│ Le token est automatiquement mis en cache et renouvelé avant expiration.│
└──────────────────────────────────────────────────────────────────────────┘

Configurer les paramètres OAuth dans le Communication System :

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

X.509 Client Certificate

Niveau de sécurité le plus élevé pour les intégrations critiques :

┌──────────────────────────────────────────────────────────────────────────┐
│ Certificate Authentication Flow │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ 1. Handshake TLS avec certificat client │
│ ABAP Cloud présente son certificat │
│ │
│ 2. Le serveur valide le certificat │
│ - Validité (date) │
│ - Émetteur (CA) │
│ - CN/Subject │
│ │
│ 3. Communication chiffrée │
│ Toutes les données chiffrées avec TLS │
└──────────────────────────────────────────────────────────────────────────┘

Exemple complet : Communication Scenario personnalisé

Exigence

Un Communication Scenario personnalisé pour l’intégration avec un système de gestion d’entrepôt externe (WMS) :

  • Appel API REST pour requête de stock
  • Service SOAP pour mouvements de marchandises
  • Authentification OAuth 2.0

Étape 1 : Créer le Communication Scenario

Dans ADT : Clic droit sur Package → New → Other ABAP Repository Object → Communication Scenario

<?xml version="1.0" encoding="utf-8"?>
<communicationScenario id="Z_WMS_INTEGRATION"
scenarioType="customer">
<description>Intégration avec Warehouse Management System</description>
<outboundServices>
<service id="Z_WMS_REST_STOCK">
<description>Requête stock REST</description>
<serviceType>http</serviceType>
</service>
<service id="Z_WMS_SOAP_MOVEMENT">
<description>Mouvement marchandises SOAP</description>
<serviceType>soap</serviceType>
</service>
</outboundServices>
<supportedAuthenticationMethods>
<method>oauth2_client_credentials</method>
</supportedAuthenticationMethods>
</communicationScenario>

Étape 2 : Implémentation de la classe API

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.
" Requête stock via 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.
" Mouvement marchandises via 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.
" Récupérer destination depuis Communication Arrangement
ro_destination = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = c_scenario
service_id = iv_service_id ).
ENDMETHOD.
METHOD get_stock.
" 1. Récupérer destination pour service Stock
DATA(lo_destination) = get_http_destination( c_service_stock ).
" 2. Créer client HTTP
DATA(lo_client) = cl_web_http_client_manager=>create_by_http_destination(
i_destination = lo_destination ).
TRY.
" 3. Configurer requête
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. Exécuter requête
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' ).
" Créer body JSON
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' ).
" Exécuter POST
DATA(lo_response) = lo_client->execute( if_web_http_client=>post ).
IF lo_response->get_status( )-code = 201.
" Extraire Document-ID de la réponse
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.

Étape 3 : Configuration administrateur

Après le transport du Communication Scenario, l’administrateur peut configurer la connexion :

  1. Créer Communication System :

  2. Créer Communication Arrangement :

    • Scenario : Z_WMS_INTEGRATION
    • System : WMS_PROD
    • Déposer OAuth Client ID et Secret
    • Activer les services

Dépannage

Erreurs fréquentes et solutions

1. “No Communication Arrangement found”

Erreur : CX_HTTP_DEST_PROVIDER_ERROR
No Communication Arrangement found for scenario Z_EXTERNAL_CRM

Causes et solutions :

CauseSolution
Arrangement non crééOuvrir l’app Fiori “Maintain Communication Arrangements”
Scenario-ID incorrectVérifier la correspondance exacte (sensible à la casse)
Service non activéActiver le service dans l’Arrangement
Arrangement non actifDéfinir le statut sur “Active”

2. “Authentication failed”

Erreur : HTTP 401 Unauthorized

Checklist :

  • Credentials correctement déposés dans l’Arrangement ?
  • Pour OAuth : URL du token accessible ?
  • Client ID et Secret corrects ?
  • Pour Certificate : Certificat encore valide ?
  • Pour Basic Auth : Mot de passe non expiré ?

3. “Connection refused / Timeout”

Erreur : CX_WEB_HTTP_CLIENT_ERROR
Connection refused

Points de vérification :

┌── Checklist Connectivité ────────────────────────────────────────────────┐
│ │
│ 1. Hôte accessible ? │
│ - Résolution DNS fonctionne ? │
│ - Port ouvert (443 pour HTTPS) ? │
│ │
│ 2. Cloud Connector (pour OnPremise) ? │
│ - Cloud Connector en fonctionnement ? │
│ - Virtual Host correctement configuré ? │
│ - Resource Path autorisé ? │
│ │
│ 3. SSL/TLS ? │
│ - Certificat serveur valide ? │
│ - CA dans le Trust Store ? │
│ │
│ 4. Firewall ? │
│ - Connexion sortante autorisée ? │
│ - Whitelist IP côté cible ? │
└──────────────────────────────────────────────────────────────────────────┘

4. “Service ID not found”

Erreur : Service 'Z_MY_SERVICE' not found in scenario 'Z_MY_SCENARIO"

Solution :

  1. Ouvrir Communication Scenario dans ADT
  2. Vérifier Outbound Services
  3. Reprendre exactement le Service-ID
  4. Activer et transporter le Scenario

Conseils de débogage

1. Tester la destination :

TRY.
DATA(lo_dest) = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = 'Z_EXTERNAL_CRM"
service_id = 'Z_CRM_REST' ).
" Afficher détails de destination
DATA(lv_url) = lo_dest->get_uri( ).
out->write( |URL : { lv_url }| ).
CATCH cx_http_dest_provider_error INTO DATA(lx_error).
out->write( |Erreur : { lx_error->get_text( ) }| ).
ENDTRY.

2. Analyser la réponse HTTP :

DATA(lo_response) = lo_client->execute( if_web_http_client=>get ).
" Status et 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 (souvent utile pour les erreurs)
DATA(lv_body) = lo_response->get_text( ).
out->write( lv_body ).

3. Utiliser Application Logging :

" Intégrer logging pour le dépannage
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( |Appel { lv_url }| ) ).
cl_bali_log_db=>get_instance( )->save_log( lo_log ).

Bonnes pratiques

ThèmeRecommandation
Convention de nommageZ_{SYSTEM}_{FONCTION} pour les Scenarios
AuthentificationOAuth 2.0 pour les nouvelles intégrations, Certificate pour les plus critiques
EnvironnementsArrangements séparés pour DEV/QA/PROD
CredentialsJamais dans le code, toujours dans l’Arrangement
Gestion des erreursExceptions spécifiques pour erreurs Destination vs. HTTP
MonitoringApplication Logging pour tous les appels API
DocumentationDocumenter description et dépendances du Scenario

Sujets connexes