SAP® Documentation

Single view

/SAPAPO/CL_SNP_APP_CTX - Track SNP application context

CL_GUI_FRONTEND_SERVICES - Frontend Services   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book


This class provides a framework to keep track of active SNP applications such as Heuristics, Deployment etc. SNP applications can run within the context of each other, like for example Interactive Planning can start Deployment which in turn can call Heuristics. For this reason the class does not only store the active application but also keeps track of the application stack.

The applications are coded with 3 characters. The currently supported applications are stored in constant structure /SAPAPO/CL_SNP_APP_CTX=>APP. The ranges 'Z*' and 'Y*' are reserved for customer applications.

The application context has to be set before the application starts using DM Layer functionalities, that is, it starts reading or changing transactional data (mostly orders like stock transport requisitions, etc.). If the application is using liveCache simsessions it is recommended to set the application context near the creation of simsession. Similarly, the application context should be cleared before leaving the application, eg. near the close of the simsession.

To handle the application context you can use either method pairs set - refresh or add - remove. Note that these should be always used in pair.

The set - refresh pair clears the existing application stack, therefore it should be used in standalone reports that cannot be called from other SNP applications.

The add - remove pair only changes the last application in the stack and sets the active application, therefore it should be used in functions that can be called either as a standalone application or inside other SNP applications. If you are unsure, use the add - remove pair.



A customer BAdI implementation is only relevant for stock transport requisitions created by Deployment. Realtime deployment is running which is calling Heuristics. Both Deployment and Heuristics create stock transport requisitions.

The framework methods are called in the following order:

1. Deployment is started and it sets the context by calling:


2. Heuristics is called and added to the context:


3. Heuristics creates STR-s and the BAdI implementation is called - at the beginning it checks the active application as:


The check fails.

4. Heuristics is finished, and it is removed from the application context:


5. Deployment is also creating STR-s; the BAdI implementation is called again; this time the check is passed.

6. Deployment is finished, and it clears the context:



In parallelized applications make sure that the application context is set in each parallel process.

If a function module is commonly used in standalone application and in eg. interactive planning, set the context inside the function module using the add - remove pair.

Further information

ABAP Short Reference   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 3505 Date: 20190619 Time: 085017     sap01-206 ( 77 ms )

Our Service

Looking for Support? Questions?




Leave us your contact details and we will call you back. Panels marked with * are mandatory.