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

Create a Simple ABAP Daemon

Learn how to create ABAP Daemons and interact with them using PCP messages.

Overview

🎓 intermediate 15 min. ABAP DevelopmentIntermediate

You will learn

  • โœ”How to create and run an ABAP Daemon
  • โœ”How to send PCP messages to an ABAP Daemon
Unknown U Unknown April 18, 2023
Created by March 9, 2023
Contributors

Prerequisites

Prerequisites

  • Your system needs to be based on SAP NetWeaver 7.52 or higher.
  • You need to use ABAP Development Tools.

Steps

Introduction to ABAP Daemons

ABAP Daemons are provided by the ABAP Daemon Framework (ADF). They are used to handle events in a reliable way by running in sessions with unlimited lifetime. ABAP programs can communicate with the daemons by sending messages to them using ABAP Messaging Channels and message type Push Channel Protocol.

Intro

You can make yourself more familiar with the ABAP Daemon Framework by reading the official documentation.

Push Channel Protocol (PCP) is a communications format similar to a simple HTTP message. It consists of header fields (name-value pairs) for metadata and a message body. For further information, have a look at the Specification of the Push Channel Protocol.

Time to Complete

20 Min.

Step 1 Create a new ABAP Daemon class
โ€”

ABAP Daemons are instances of an ABAP Daemon class that extend the base class CL_ABAP_DAEMON_EXT_BASE.

First, create a new ABAP class ZCL_TUTORIAL_SIMPLE_DAEMON and set CL_ABAP_DAEMON_EXT_BASE as its superclass.

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

Step 2 Implement ON_ACCEPT method
+
Step 3 Implement ON_START method
+
Step 4 Implement ON_TIMEOUT method
+
Step 5 Implement ON_MESSAGE method
+
Step 6 Implement the static method START
+
Step 7 Implement the static method SEND
+
Step 8 Run the ABAP Daemon
+
Step 9 Send messages to the ABAP Daemon
+
Step 10 Stop the ABAP Daemon
+
Step 11 Test your application
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 11
1. Create a new ABAP Daemon class 2. Implement ON_ACCEPT method 3. Implement ON_START method 4. Implement ON_TIMEOUT method 5. Implement ON_MESSAGE method 6. Implement the static method START 7. Implement the static method SEND 8. Run the ABAP Daemon 9. Send messages to the ABAP Daemon 10. Stop the ABAP Daemon 11. Test your application

Learn more →