We use cookie to ensure that we give you best experience on our website. With further use of this website you accept the application of cookies.  mehr...  I agree  reject

Beispiel ABAP Code zum Aufruf des BEMACON I/O-Dispatchers

The following ABAP Code demonstrates, how the BEMACON I/O-Dispatcher can be called from a SAP®-System via SOAP (RPC-Style)
as Web-Service to communicate with an I/O-Module.

The ASCII command #0100FF in the example sets all output channels to ON.

ADAM ASCII command



DATA:
  gro_exc    TYPE REF TO cx_root,
  gf_errtxt  TYPE string,
  gs_input   TYPE zbema_send_asc_cmd,
  gs_output  TYPE zbema_send_asc_cmd_response,
  gro_iom    TYPE REF TO zbema_co_get_iom_port_type.


CREATE OBJECT gro_iom
  EXPORTING
    logical_port_name = 'ZP1'.

gs_input-protocol = 'ADAM'.
gs_input-host     = '169.254.42.199'.
gs_input-port     = 502.
gs_input-cmd      = '#0100FF'.

CLEAR gro_exc.
TRY.
    CALL METHOD gro_iom->send_asc_cmd
      EXPORTING
        input  = gs_input
      IMPORTING
        output = gs_output.

  CATCH cx_ai_system_fault INTO gro_exc.
  CATCH cx_ai_application_fault INTO gro_exc.
ENDTRY.

IF ( gro_exc IS INITIAL ).

  IF ( gs_output-error IS INITIAL ).
    IF ( gs_output-answer = '>01' ).
      WRITE: / 'Switched all channels ON'.
    ELSE.
      WRITE: / 'Error:' , gs_output-answer.
    ENDIF.
  ELSE.
    WRITE: / 'Error:' , gs_output-error.
  ENDIF.

ELSE.
  gf_errtxt = gro_exc->if_message~get_text( ).
  WRITE: / 'SOAP-Error:' , gf_errtxt.
ENDIF.





All names of products and services are trademarks of their respective companies.