SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Forward MQTT and AMC Messages Using an ABAP Daemon

Forward MQTT and AMC Messages using an ABAP Daemon.

Overview

🎓 intermediate 15 min. ABAP DevelopmentIntermediate

You will learn

  • โœ”How to use ABAP Messaging Channels (AMC)
  • โœ”How to combine MQTT, AMC and ABAP Daemons
Unknown U Unknown April 18, 2023
Created by March 9, 2023
Contributors

Prerequisites

Prerequisites

  • The ABAP MQTT Client is available on ABAP Platform 1809 and above.
    • You need to use ABAP Development Tools.

Steps

Time to Complete

25 Min.


Intro

In this tutorial, you will create an ABAP Daemon that should act as a bi-directional protocol converter between MQTT and AMC. The daemon should receive MQTT messages, convert them to PCP messages, and forward them via an ABAP Messaging Channel (AMC) to other applications. Forwarding also works in the reverse direction.

Step 1 Create an ABAP Daemon class
โ€”

Create a new ABAP class ZCL_TUTORIAL_MQTT_DAEMON extending the base class CL_ABAP_DAEMON_EXT_BASE.

As you can see, there is an error in line 1 since the necessary abstract methods have not been implemented yet. Click on the light bulb next to the line number and select Add 9 unimplemented methods to resolve this:

Add unimplemented methods in ABAP Development Tools
Add unimplemented methods in ABAP Development Tools

Add the following variables to the PRIVATE SECTION of your class definition:

ABAP
DATA: mv_subscription_topic TYPE string,
      mv_publish_topic      TYPE string,
      mo_client             TYPE REF TO if_mqtt_client.

You will need them later.

Step 2 Create an ABAP Messaging Channel
+
Step 3 Implement ABAP Daemon events
+
Step 4 Implement static methods
+
Step 5 Handle incoming MQTT messages
+
Step 6 Handle AMC messages
+
Step 7 Run the ABAP Daemon
+
Step 8 Prepare interaction with the ABAP Daemon
+
Step 9 Interact with the ABAP Daemon
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 9
1. Create an ABAP Daemon class 2. Create an ABAP Messaging Channel 3. Implement ABAP Daemon events 4. Implement static methods 5. Handle incoming MQTT messages 6. Handle AMC messages 7. Run the ABAP Daemon 8. Prepare interaction with the ABAP Daemon 9. Interact with the ABAP Daemon

Learn more →