Skip to Content
Jul 16, 2019 at 12:56 PM

Running a BPC package with SYSADMIN user authority temporarily adopted but SLG1 issue


Hi guys,

we have a custom BPC Process chain which loads Master & Transaction data (e.g. Master data on the fly).

As the users running this package would not usually have BPC authorisations to run the BPC actions for adding Master & Transaction data, we assign a _SYSTEM user from the SPRO field SYSADMIN (for Business Planning & Consolidation SPRO section)

So in a BPC custom class we have the following code where ls_user is the SPRO value.

call method cl_uj_context=>set_cur_context

i_appset_id = lv_environment_id
is_user = ls_user
i_appl_id = lv_application_id

.Also after this we have the code:

lo_context->switch_to_srvadmin( ) (where lo_context is TYPE REF TO if_uj_context)

Now this enables the user to run the custom package successfully.

However we get red logs in transaction SLG1 i.e. Object is UJ, Subobject is UJD and program is either SAPMHTTP or UJ0_START_PLAN (want to keep green logs but get rid of these spurious red logs)

Now the SAPMHTTP SLG1 logs are written before we even change the authorisation (presumably before the package runs in an ABAP context there is a Process Chain process type authorisation check).

Anyhow to remove an 'spurious' SLG1 red logs at the end of the custom BPC process chain we have an ABAP program that selects the 'red' logs from the BALHDR table and then deletes these logs (i.e. using the FM

call function 'BAL_DB_DELETE').This is the same way as the standard SLG2 (Delete logs) transaction works.

The issue is there is always one 'red' log still showing in SLG1 after the package has been processed.

If I debug the process e.g. with an infinite loop we do not get the SLG1 log. I know that when debug is run a commit work is issued.

I have tried doing Commit Work and Commit Work and Wait, and also checking for sy-subrc in a loop but always there is this last SLG1 red when running in normal mode.

However, in debug mode all the SLG1 'red' logs are deleted.

I would really appreciate someone telling me why it runs ok in Debug but when running in the normal manner we always have this last 'red' SLG1 log.