This is a test message to test the length of the message box.
Login
BTP Application Job
Created by Software-Heroes

BTP - Application Job (v2)

574

The Application Job has received a new version and with it new functions in the ABAP Environment. In this article we look at the differences.



In this article we will look at the new Application Job in the ABAP Environment, what differences there are and how you can use the new type for yourself.

 

Introduction

The Application Job is the new job for creating background processing in ABAP Cloud. With release 2411 for the ABAP Environment, a new version has now been rolled out that makes integration into the system easier. And brings with it other advantages that we want to look at in more detail in this article.

 

Creation

Before we create the job catalog, the first step is to define a class. To do this, we define a normal class with the new interface IF_APJ_RT_RUN.

CLASS zcl_bs_demo_job_execute_v2 DEFINITION
  PUBLIC FINAL
  CREATE PUBLIC.

  PUBLIC SECTION.
    INTERFACES if_apj_rt_run.
ENDCLASS.


CLASS zcl_bs_demo_job_execute_v2 IMPLEMENTATION.
  METHOD if_apj_rt_run~execute.
  ENDMETHOD.
ENDCLASS.

 

The new interface has the method EXECUTE, which is started when the job is executed. In order to create attributes for the selection screen in the next step, we do not define a structure in the job, but rather public attributes in the class. To do this, we create various attributes that we want to test afterwards.

CLASS zcl_bs_demo_job_execute_v2 DEFINITION
  PUBLIC FINAL
  CREATE PUBLIC.

  PUBLIC SECTION.
    INTERFACES if_apj_rt_run.

    TYPES tt_r_range TYPE RANGE OF zbs_demo_job_system.

    DATA md_user     TYPE c LENGTH 10.
    DATA mt_system   TYPE tt_r_range.
    DATA md_test     TYPE abap_boolean.
    DATA md_edate    TYPE d.
    DATA md_etime    TYPE t.
    DATA md_radio_de TYPE abap_boolean.
    DATA md_radio_en TYPE abap_boolean.
    DATA md_radio_fr TYPE abap_boolean.
ENDCLASS.


CLASS zcl_bs_demo_job_execute_v2 IMPLEMENTATION.
  METHOD if_apj_rt_run~execute.
  ENDMETHOD.
ENDCLASS.

 

Now we can create the new "Application Job Catalog Entry". You can easily create this via the Project Explorer using the context menu on the package.

 

In the next step we give the entry a name and specify our job class that we created in the previous step.

 

As a result, we get a new input mask where our attributes that we defined in the class are displayed and where additional classes can be stored. The upper part should therefore look familiar to you, the lower part of the configuration is particularly new.

 

In the last step we create an Application Job Template, this is mainly used to store default values and is stored in the "Application Job" App is used to start the job.

 

You can define and save the default values for the parameters or multiple selections using the input.

 

If we look at the current status of the selection in the app, we already get input assistance for the date and time. Otherwise, texts are currently missing and the special fields are not defined either.

 

Design

Using the job catalog, we now have the option of defining the fields and changing their appearance and behavior. In one case, we also use a data element, but the texts are not used automatically.

 

Fields

When we edit the individual fields, we have numerous options for settings. We can maintain the text for the element, change the properties of the field, enter a value help or assign it to groups. You can find further information in the SAP Help documentation linked below, where the individual fields and properties are described.

 

Sections and groups

You can use sections and groups to arrange the fields on the screen. If you do not use sections or groups, all parameters are assigned to a general group. A group represents a heading, similar to a field group. You can assign multiple groups to a section.

 

Appearance

In the last image we listed the current properties and areas; the final result of the selection now looks like this.

 

Value Helps

With the new job catalogs, proper input aids are now finally available. By default, you can use fixed values from domains or assign Core Data Services.

 

Domain

For our example, we defined our own data element and a domain with fixed values. If we store this in the configuration of the MD_SYSTEM field, we will receive it in the app.

 

The search help call now looks like this, the values are displayed accordingly.

 

Core Data Service

For the example, we define a Core Data Service that should be available for our search. You should look at the documentation (linked below) to see which annotations are required for the search help.

@EndUserText.label: 'Business Partner (Value Help)'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.dataCategory: #VALUE_HELP
@Search.searchable: true
define view entity ZBS_I_DMOPartnerVH
  as select from I_BusinessPartnerVH
{
      @Search.defaultSearchElement : true
      @ObjectModel.text.element: [ 'FirstName' ]
  key BusinessPartner,
      BusinessPartnerName,
      @Search.defaultSearchElement : true
      FirstName,
      @Search.defaultSearchElement : true
      LastName
}

 

We store the search help in the configuration of the MD_USER field. In addition, we set the output to "List Box". You should normally do this if you have fewer than 500 values, as only the first 500 are loaded.

 

The output of the field now looks like this; we can also narrow down the search by name. The key is hidden in this setting and only the text is displayed.

 

Debugging

The job template now offers the option of starting and debugging the application job. The template's default values are used when the job is started. You can find the "Execute" button in the template in the action bar.

 

You should also set a breakpoint in the class for this. If the breakpoint is not passed through and the debugger does not start, then you should check the system settings for debugging. The flag for "Allow debugging of tool requests" must be set here.

 

In principle, the mandatory fields are also checked before starting if they are not set in your variant.

 

Translation

Texts can be created via the job catalog; a stored data element in the attributes of the class is currently ignored. After we created a translation project in the system and downloaded the texts, we discovered that the job catalog is not available for translation. This means that multilingualism in the job selection screen is currently not possible.

 

Complete example

You can find the complete example from this article in this GitHub repository, where all objects are synchronized and can be viewed again. The corresponding commit contains the current changes.

 

Overview

Here again the differences to the old application job summarized in a short list:

  • New interface for job creation IF_APJ_RT_RUN
  • Creation of the selection screen via public attributes of the class 
  • The appearance can be designed more freely
  • Value help is available for input
  • Jobs can be debugged

 

Conclusion

The new Application Job has many advantages and is easier to use. New jobs in the ABAP Environment are automatically created this way. If you want to have the functions in the old job, you must first migrate the objects.

 

Source:
Customer & Partner Roundtable #18
SAP Help - Editing Application Job Catalog
SAP Help - CDS Value Help


Included topics:
BTPApplication JobVersion 2ABAP Environment
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.


RAP - Semantic Key

Category - ABAP

What do you need the semantic key for and how is it represented in the ABAP RESTful Programming Model? You can find out more here.

12/13/2024

RAP - File Upload (Stream)

Category - ABAP

How can you easily load files into your RAP object and make them available in ABAP? Let's take a look at the details.

12/10/2024

RAP - Report Pattern

Category - ABAP

How is the Report Pattern structured in RAP and what can you do with it? Read more in this ABAP article.

12/06/2024

ABAP Environment - The right size (sizing)

Category - ABAP

In this article we look at how to get the SAP BTP ABAP Environment to the right size for you.

12/03/2024

BTP - Central ATC

Category - ABAP

How can you configure the ABAP Test Cockpit in the BTP? What are the stumbling blocks and what can you do with them in the end? Read more in this article.

10/25/2024