Skip to Content
Author's profile photo Former Member

Scheduling CJ45 Server Group option with custom code in Background mode

Application of Shared Memory

Running CJ45 Server Group option with custom code in Background mode

Most of you working in SAP ECC 6.0 version would have heard about “Shared Objects” and its wonderful features. You can get a nice materials and blogs about this topic in

  • In this BLOG I am going to explain how we can execute the transaction CJ45 in Background mode with Server Group option which will also include custom code logic implemented in the user exit

 Business requirement:

I got a tricky requirement; as I need to execute my set of enhanced code by this option and my enhanced code is exists in the user exit EXIT_SAPLKASC_001. 

It’s quite normal to choose this option but it’s tricky to execute any enhanced code in this CJ45 Tcode by selecting this Server Group option as below screen shot, because whenever we go by this option SAP will execute our enhancement for execution via CJ45 for every execution whether its foreground or background it does not matter.  




CJ45 TCODE with execution in Background mode and Server Group option




















Before going to explain the actual requirement solution I like to give brief explanation about the Server Group option .

Server Group:

To achieve a balanced distribution of the system load, you can use destination additions to execute function modules in parallel tasks in any application server or in a predefined application server group of an SAP system. 


In my custom code implementation part (User Exit) I had conditions as below in the user exit.

CHECK (SY-tcode EQ ‘CJ44’ OR sy- tcode EQ ‘CJ45’) OR sy-batch IS NOT INITIAL

The code under this condition was never executed, because when you schedule project in CJ45 as Background and Server group the set of code in the enhancement will execute in Foreground and it will execute the code in parallel processing.

  • Parallel processing enables the SAP System to process separate data packets in different batch processes simultaneously.
  • Significantly SAP is using this Server Group option to process separate data packets in different batch processes simultaneously.


I am going to achieve this custom requirement by using another powerful methodology provided by SAP it’s called Shared Memory.

Shared Memory:

With shared objects in ABAP it is possible to share common data on one application server of a SAP system between different user sessions. 

The following steps needs to be implemented to achieve the same

  1. Creating  Root Class for shared memory
  2. Creating Shared memory area
  3. Creating implicit enhancement to pass the value for shared memory area
  4. Reading values from shared memory area to User Exit 

1         Creation of Root Class:

Creating root class for shared memory area in SE24 and choose the attributes as follows
















Creating one attribute as ‘BATCH’ in this class to pass the value to shared memory area.













2. Creating the Shared memory area:

create the shared memory area in SHMA tcode and give the root class name as created above.



















Executing CJ45 Tcode:CJ45 TCODE with Background processing option with SERVER GROUP option

Actual execution screen and parameter



















Giving defined server GROUP name:


































3. Creating implicit enhancement in the above popup screen program:

Creating implicit enhancement to pass the value to the User exit when the user choose the Server Group option image  













Passing data to Shared Memory: 

Implement the below code snippet to pass the value to the shared memory


























4. Retrieving values from Shared Memory: 

Implementing the below code in the user exit EXIT_SAPLKASC_001





















Finally adding the above local variable also in CHECK condition statement as below


After this above custom implementation steps now able to produce suitable result for custom requirement.




Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.