cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Async MaterialDocumentCreateRequest_Async_In API response

Tisha_Haria
Explorer
0 Kudos
87

Hello All, 

Currently we are using asynchronous soap API MaterialDocumentCreateRequest_Async_In to post the material document in SAP S4HANA system from BTP ABAP.

Code looks like below:

      TRY.
          DATA(destination) = cl_soap_destination_provider=>create_by_comm_arrangement(
            comm_scenario  = 'comm_s'
            service_id     = 'obs_Serv'
            comm_system_id = 'CORE_ERP_SOAP'
          ).

          DATA(lv_lp) = destination->get_logical_port_name( iv_proxy_name = 'ZCO_MATERIAL_DOCUMENT_CREATE_R' ).
          DATA(proxy) = NEW zco_material_document_create_r( destination = destination ).

          " fill request
          DATA(request) = VALUE zmaterial_document_create_req1( ).

*--prepare the data for request
          DATA(ls_message_ip) = update-ziapirsilocipmsgs[ 1 ] .
*        prepare_request( EXPORTING is_message_ip = ls_message_ip  CHANGING cs_request = request ) .

          request-material_document_create_reque-material_document-goods_movement_code = '04'.
          request-material_document_create_reque-material_document-posting_date = cl_abap_context_info=>get_system_date(  ).
          request-material_document_create_reque-material_document-material_document_item
                                          = VALUE #( (  material_document_line = 1
                                                     goods_movement_type  = 309
                                                     quantity_in_base_unit =  CORRESPONDING #(  ls_message_ip  MAPPING content = quantity )
                                                     quantity_in_entry_unit =  CORRESPONDING #(  ls_message_ip  MAPPING content = quantity )
                                                     material = ls_message_ip-Material
                                                     batch = ls_message_ip-batch
                                                     plant = ls_message_ip-plant ) )             .




          proxy->material_document_create_reque(
            EXPORTING
              input = request
          ).
        CATCH cx_soap_destination_error INTO DATA(lx_soap_error).
          " handle error
        CATCH cx_ai_system_fault INTO DATA(lx_system).
          " handle error
      ENDTRY.

Currently challenge that I am facing is to how to capture the response sent via soap service MaterialDocumentCreateConfirmation_Async_Out_V2 in my code in BTP ABAP system. 

Has anyone worked on similar requirement? or Does anyone have idea how to achieve this requriement?

Accepted Solutions (0)

Answers (1)

Answers (1)

ArunJacob
Active Participant
0 Kudos

To capture the response from MaterialDocumentCreateConfirmation_Async_Out_V2, you need to implement an inbound service interface in your BTP ABAP system (which acts like a service provider for S/4HANA’s outbound call).

1. Expose an Inbound Service in BTP ABAP

You need to generate a proxy for the confirmation WSDL in BTP ABAP, and then implement it to receive the async confirmation.

  • Go to your BTP ABAP Environment project (or ADT).

  • Create a new service consumption model using the WSDL for MaterialDocumentCreateConfirmation_Async_Out_V2.

    • Use Service Consumption Model → Create from WSDL.

  • This generates an interface and data types.

  • Implement a class that implements the generated interface.


2. Register the Inbound Interface in Communication Arrangement

You must configure this in Communication Arrangement in BTP ABAP (e.g., /n/SAP/COMM app).

  • Add your inbound service (MaterialDocumentCreateConfirmation_Async_Out_V2) as the receiver.

  • Make sure it’s available to S/4HANA (via Cloud Connector if on-prem).


3. S/4HANA: Set BTP Endpoint as the Consumer

In the S/4 system:

  • Use transaction SOAMANAGER.

  • Open the Consumer Proxy for MaterialDocumentCreateConfirmation_Async_Out_V2.

  • Set the endpoint URL of your BTP ABAP receiver (which will receive the response).

  • This endpoint is the one exposed via BTP ABAP Runtime.