This is a test message to test the length of the message box.
ABAP Quick Processing in a new task
Created by Software-Heroes

ABAP Quick - Processing in a new task


This tip is about asynchronous processing in a new process and what to look out for.

In some cases you want to execute a computationally heavy process asynchronously, an additional process should be started and the whole thing should not have any performance impact on the current process. To do this, you use an asynchronous task that runs in its own LUW and, in contrast to the main process, can take its time. In this article, we'll go into the prerequisites and show you how to start the process.



So that we can execute a process asynchronously, we need a function module in the first step. In addition, it must also be RFC-enabled. The function module should run in a separate process, similar to an update module. There are therefore the following additional requirements for the function block:

  • RFC-enabled function module
  • Only parameters with VALUE data transfer
  • No parameters with exporting or changing



Such a function module could now look like this, using three importing parameters that we will work with later.


  " Implement some code


If you work with Eclipse, you should not forget to mark the function module as RFC-enabled. To do this, you will find the "Specific" tab on the "Properties" view. Here you can set the Processing Type to RFC.



To call the function module in your processing, a simple CALL FUNCTION is sufficient, as you do with normal function modules. You must also specify the addition IN BACKGROUND TASK so that the RFC function module is started in the background and assigned to its own LUW with AS SEPERATE UNIT. The use of the addition DESTINATION is optional; if no value is specified, the destination NONE is used.

    id_user   = sy-uname
    id_number = 23
    id_text   = `Some example text`.



Depending on where you are in your process, you may need to issue a COMMIT to start the process. If you call the function module as above, it will first be registered for processing, but no processing will take place yet. The next COMMIT WORK then starts processing and the process.

Here are a few examples of how it could be solved:

  • BADI implementation - A commit is set here after successful processing and a rollback is processed in the event of an error. No additional commit has to be implemented or a commit can lead to an error in the processing of the standard.
  • OData Service - During the execution of a function, an asynchronous process should also be started; a commit must be set for this after the call.


Hint: If you test the OData via the SAP Gateway Client without a commit, the processing will work, if it is called via a Fiori application it will no longer work. So it's best to always implement a COMMIT WORK here.



Since the function module starts in its own LUW, you can no longer access the data of the original session, but you can use all importing parameters and read your own data. Your commit or rollback only affects your data, so that you can work normally from standard processes. However, you should note that if the original process should then roll back, your process will not notice it.



With our little tip, you should now be able to implement asynchronous processing from your own programs and from the standard. So that processing starts properly, always think of a commit work and whether it makes sense at this point.

Included topics:
QuickNEW TASKAsynchronous processing
Comments (0)

And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.

ABAP Quick - RFC Error handling

Category - ABAP

How do you actually handle errors when communicating via a destination in the function module? More about this in our tip.


ABAP Quick - CLEAR right

Category - ABAP

Delete correctly? In this article we want to take a look at when it makes sense to delete and how you can do it effectively.


ABAP Quick - Performance chained statements

Category - ABAP

Let's take a look at the performance when creating chained statements with DATA and FIELD-SYMBOL. Which variant will be ahead in terms of performance?


ABAP - ALV still relevant in 2022?

Category - ABAP

Today the joking question, do we still need reports that generate ALV outputs in 2022? In this article, we want to look into this question.


ABAP in Change

Category - ABAP

The programming language ABAP has been changing for years and is being modernized in various concepts. In this article, we'll look at it in detail.