cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

API Journal Entry-Clearing (asynchronous) the interface call failed;

lemon-xue
Participant
0 Likes
575

Question:SAP S/4HANA Cloud Public Edition
Calling SOAP Journal Entry-Clearing (asynchronous) API, how to pass in parameters in ABAP Development Tools, and the interface call failed? The call attempts the following three ways, all of which report errors, as follows:
Situation 1:
Use standard SAP_COM_0002, and use service _ id: journalentryBulkclearingrequest _ in.
Error in calling asynchronous SOAP interface: The communication protocol does not exist.

1-11-11-21-2Situation 2:
Use standard SAP_COM_0002, and use service _ id: journalentryburkclearningquestions _ webi.
Error in calling asynchronous SOAP interface: The communication protocol does not exist.

图片2-1.png图片2-2.pngSituation 3:
Use standard SAP_COM_0002 and service _ id: co _ fins _ journal _ entry _ bulk _ cle _ sprx. Error in calling asynchronous SOAP interface: Logical port does not belong to consumer agent.

图片3-1.png图片3-2.png

Accepted Solutions (0)

Answers (1)

Answers (1)

HenrikeGroetecke
Product and Topic Expert
Product and Topic Expert

Hello,

Thank you very much for your question. I asked our internal chatbot for support and hope that you find the response useful. Please check whether the AI-generated information helps you solve your issue.

Kind regards, Henrike

For more information, see Journal Entry – Clearing (Asynchronous).

Based on your three error scenarios, here are the solutions:

Situation 1 & 2: "The communication protocol does not exist"

This error occurs when the logical port or service ID is misconfigured.

Solution:

  1. Verify the correct Service ID in transaction SOAMANAGER:

    • Go to SOAMANAGER → Select the correct system
    • Check available Web Service definitions
    • The correct service ID should be something like: JournalEntryBulkClearingRequest_In (case-sensitive)
  2. Check Logical Port Configuration:

    Transaction: SOAMANAGER
    → Web Service Configuration
    → Logical Ports
    → Verify port exists and is active
  3. Correct Code Implementation:

    DATA: lo_client TYPE REF TO cl_soap_client.
    
    TRY.
        CALL METHOD cl_soap_client=>create
          EXPORTING
            logical_port_name = 'YOUR_LOGICAL_PORT_NAME'
          IMPORTING
            client = lo_client.
    
        "Set up request
        lo_client->request = ...
        
        CALL METHOD lo_client->invoke.
        
    CATCH cx_soap_fault INTO DATA(ls_fault).
        MESSAGE e000(SO) WITH ls_fault->get_text( ).
    ENDTRY.

Situation 3: "Logical port does not belong to consumer agent"

This error means the logical port is not assigned to your consumer proxy.

Solution:

  1. Verify Consumer Proxy Configuration:

    Transaction: SOAMANAGER
    → Web Service Consumer
    → Select correct service/proxy
    → Check "Logical Port Assignment"
  2. Correct Service ID Format:

    • Use: co_fins_journal_entry_bulk_cle_srp (remove extra characters)
    • Or check the exact name in: TRANSACTION SE80 → Service Implementation
  3. Proper Code with Error Handling:

    DATA: lo_proxy TYPE REF TO z_journal_entry_proxy.  "Your proxy class
    
    TRY.
        CREATE OBJECT lo_proxy
          EXPORTING
            logical_port_name = 'JOURNAL_ENTRY_PORT'.
        
        CALL METHOD lo_proxy->journal_entry_bulk_clearing_request
          EXPORTING
            request = ls_request_data
          IMPORTING
            response = ls_response_data.
    
    CATCH cx_ai_system_fault INTO DATA(ls_sysfault).
        MESSAGE e000(SO) WITH ls_sysfault->get_text( ).
    
    ENDTRY.

Recommended Troubleshooting Steps:

  1. List all available logical ports:

    CALL FUNCTION 'SOAMANAGER_GET_LOGICAL_PORTS'
      IMPORTING
        lt_ports = DATA(lt_ports).
  2. Verify Web Service is active:

    • SOAMANAGER → Check activation status
    • Ensure service is in "Active" state
  3. Check Consumer Proxy Namespace:

    • Transaction SE80 → Select your proxy
    • Verify all configurations are saved
  4. Test with Transaction SOAMANAGER directly before coding


Additional Notes:

  • Is this S/4HANA or ECC? (affects service naming)
  • Verify user authorization for Web Service consumption
  • Check if the service requires SSL/TLS (protocol settings)

Would you like help with any specific step or the exact code for your scenario?

 
 
 

Can you please help this SAP S/4HANA Cloud Public Edition partner? Calling SOAP Journal Entry-Clearing (asynchronous) API, how to pass in parameters in ABAP Development Tools, and the interface call failed? The call attempts the following three ways, all of which report errors, as follows: Situation 1: Use standard SAP_COM_0002, and use service _ id: journalentryBulkclearingrequest _ in. Error in calling asynchronous SOAP interface: The communication protocol does not exist.

1-1 1-1 1-2 1-2 Situation 2: Use standard SAP_COM_0002, and use service _ id: journalentryburkclearningquestions _ webi. Error in calling asynchronous SOAP interface: The communication protocol does not exist.

图片2-1.png图片2-2.pngSituation 3: Use standard SAP_COM_0002 and service _ id: co _ fins _ journal _ entry _ bulk _ cle _ sprx. Error in calling asynchronous SOAP interface: Logical port does not belong to consumer agent.

图片3-1.png图片3-2.png

 
 
 

SOAP Journal Entry-Clearing API - S/4HANA Cloud Public Edition Solution

Since this is S/4HANA Cloud Public Edition, the issue is fundamentally different from on-premise. Here's the correct approach:


Key Issue: SAP_COM_0002 vs. Actual Communication Arrangement

In S/4HANA Cloud Public Edition, you cannot use standard SAP_COM_0002. You must use the actual communication arrangement created in your system.

Correct Steps:

Step 1: Identify the Correct Communication Arrangement

  1. Go to SAP Fiori Launchpad → Search: "Communication Arrangements"

  2. Look for arrangements related to Journal Entry clearing:

    • SAP_COM_0545 (Journal Entry Bulk Clearing - Inbound)
    • Or custom arrangement created by your system administrator
  3. Note the Service ID shown (e.g., JournalEntryBulkClearingRequest_In_V1)


Step 2: Verify Communication Settings

Fiori → Communication Arrangements
→ Find Journal Entry Clearing arrangement
→ Check:
   ✓ Status: Active
   ✓ Inbound Service: Enabled
   ✓ Protocol: REST or SOAP
   ✓ Authentication: OAuth 2.0 or Basic Auth

Step 3: Correct ABAP Code for S/4HANA Cloud

Since Journal Entry Clearing is typically asynchronous, use this approach:

*&---------------------------------------------------------------------*
*& Report: Call Journal Entry Bulk Clearing (Async)
*&---------------------------------------------------------------------*
REPORT z_journal_entry_clearing.

DATA: lv_url TYPE string.
DATA: lv_response TYPE string.
DATA: lv_request_body TYPE string.

DATA: lo_http_client TYPE REF TO if_http_client.
DATA: lv_status_code TYPE i.
DATA: lv_reason_phrase TYPE string.

START-OF-SELECTION.

  " 1. Build the request payload
  lv_request_body = build_journal_entry_request( ).
  
  " 2. Get the service endpoint (from Communication Arrangement)
  lv_url = 'https://[your-s4hc-system]/sap/opu/odata/sap/C_JOURNALENTRYITEM_SRV'.
  
  " 3. Create HTTP client
  TRY.
      cl_http_client=>create_by_url(
        EXPORTING
          url                = lv_url
        IMPORTING
          client             = lo_http_client
      ).
      
      " 4. Set authentication (OAuth token or Basic)
      lo_http_client->request->set_header_field(
        name  = 'Authorization'
        value = 'Bearer ' && get_oauth_token( )  "Or use Basic Auth
      ).
      
      " 5. Set Content-Type
      lo_http_client->request->set_header_field(
        name  = 'Content-Type'
        value = 'application/json'
      ).
      
      " 6. Send request
      lo_http_client->request->set_cdata( lv_request_body ).
      lo_http_client->send( ).
      
      " 7. Get response
      lv_status_code = lo_http_client->response->get_status( ).
      lv_reason_phrase = lo_http_client->response->get_reason_phrase( ).
      lv_response = lo_http_client->response->get_cdata( ).
      
      IF lv_status_code = 202 OR lv_status_code = 200.
          MESSAGE 'Request submitted successfully (Async)' TYPE 'S'.
      ELSE.
          MESSAGE 'Error: ' && lv_reason_phrase TYPE 'E'.
      ENDIF.
      
  CATCH cx_http_client_error INTO DATA(lx_error).
      MESSAGE lx_error->get_text( ) TYPE 'E'.
      
  ENDTRY.

*&---------------------------------------------------------------------*
*& Form: Build Request Payload
*&---------------------------------------------------------------------*
FORM build_journal_entry_request CHANGING cv_payload TYPE string.

  " Build JSON payload for Journal Entry Clearing
  " Example structure (adjust to your API):
  cv_payload = |{
    "JournalEntryBulkClearingRequest": {
      "JournalEntry": [
        {
          "CompanyCode": "1000",
          "JournalEntryNumber": "100001",
          "FiscalYear": "2024",
          "DocumentDate": "2024-01-15"
        }
      ]
    }
  }|.

ENDFORM.

*&---------------------------------------------------------------------*
*& Form: Get OAuth Token
*&---------------------------------------------------------------------*
FORM get_oauth_token CHANGING cv_token TYPE string.

  " Implementation depends on your OAuth setup
  " Usually retrieved from Communication Arrangement credentials
  cv_token = 'YOUR_OAUTH_TOKEN_HERE'.

ENDFORM.

Why Your Previous Attempts Failed

Situation Root Cause Solution
Situations 1 & 2Wrong Service ID format; SAP_COM_0002 doesn't support Journal Entry ClearingUse actual communication arrangement ID
Situation 3co_fins_journal_entry_bulk_cle_sprx doesn't exist in Cloud EditionUse OData/REST endpoint instead

Alternative: Use OData Service (Recommended for Cloud)

S/4HANA Cloud prefers OData v4 over SOAP:

DATA: lo_client_proxy TYPE REF TO /iwbep/if_cp_client_proxy.
DATA: ls_request_uri TYPE /iwbep/if_cp_request_uri=>ty_uri.

TRY.
    lo_client_proxy = /iwbep/cl_cp_factory=>create_v4_remote_proxy(
      EXPORTING
        service_id      = 'C_JOURNALENTRYITEM_SRV'  "Actual service name
        logical_port_name = 'JOURNAL_ENTRY_CLEAR'
    ).
    
    " Create request
    DATA(lo_request) = lo_client_proxy->create_resource_for_entity_set(
      'JournalEntry'
    )->create_request_for_action(
      'JournalEntryClearingAction'
    ).
    
    " Execute
    DATA(ls_response) = lo_request->execute( ).
    
CATCH /iwbep/cx_gateway INTO DATA(lx_error).
    MESSAGE lx_error->get_longtext( ) TYPE 'E'.
ENDTRY.