Skip to Content
0

How to stop the script execution in case of error.

Jan 26, 2017 at 01:36 PM

328

avatar image

The exception CX_UJ_CUSTOM_LOGIC in BADI_UJ_CUSTOM_LOGIC doesn't interrupt execution of LGF script


After installation in system of support-package SAPK-81010INCPMBPC, execution of LGF scripts doesn't interrupt on raising exception CX_UJ_CUSTOM_LOGIC in code of BADI_UJ_CUSTOM_LOGIC called in scipt.

Before that execution of LGF script interrupted on raising exception CX_UJ_CUSTOM_LOGIC in code of BADI_UJ_CUSTOM_LOGIC.

It is now impossible to interrupt execution of LGF script on calculation errors in code of BADI_UJ_CUSTOM_LOGIC. The execution of LGF script continues with logging message "EXCEPTION OCCURRED IN BADI".

System information:

SAP_BASIS 740 0015 SAPKB74015 SAP Basis Component SAP_ABA 740 0015 SAPKA74015 Cross-Application Component SAP_GWFND 740 0015 SAPK-74015INSAPGWFND SAP Gateway Foundation 7.40 SAP_UI 740 0017 SAPK-74017INSAPUI User Interface Technology 7.40 PI_BASIS 740 0015 SAPK-74015INPIBASIS Basis Plug-In ST-PI 740 0004 SAPK-74004INSTPI SAP Solution Tools Plug-In BI_CONT 757 0007 SAPK-75707INBICONT Бизнес-информация и аналитика: содержимое BI_CONT_XT 757 0007 SAPK-75707INBICONTXT Business Intelligence Content for Bobj I SAP_BW 740 0015 SAPKW74015 SAP Business Warehouse CPMBPC 810 0010 SAPK-81010INCPMBPC SAP Business Planning and Consolidation POASBC 100_731 0007 SAPK-10207INPOASBC POA Shared Business Components
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

6 Answers

Evgeniy Samardak Feb 02, 2017 at 05:58 AM
1

Hi Mark,

The calculated package is used in the tooled system, which generates all calculations, written on the logic of the script.
Please have a look at the example below:

Beginning of the file (RUN_ALL.LGF):

*START_BADI
LOP  // Calculation 1
QUERY=OFF
WRITE=OFF 
APPL=REV
PARAMETER DIM SELECTION=%SELECTION% 
PACKAGE1=CALC_PP_MB
*END_BADI

*START_BADI LOP // Calculation 2 
QUERY=OFF
WRITE=OFF
APPL=OPEX
PARAMETER DIM SELECTION=%SELECTION%
*END_BADI

---------------- // Calculation N

End of the file (RUN_ALL.LGF)

Before support package installation script logic RUN_ALL.LGF has been interrupted due to the mistake in Calculation 1

The status of package launching script logic became "Failed". Working process of the script was not interrupted after the support package installation. This kind of action do not allow the system to understand whether all attached calculations completed successfully or not

I suggest it is the result of note 2263229 installation. The note is included in the support package SAPK-81010INCPMBPC.

Now the execution interrupt of LGF scripts is stopped to proceed when the exception CX_UJ_CUSTOM_LOG occurs in BADI_UJ_CUSTOM_LOGIC handler.

The note, canceling operation notes 2263229 (Regression fix) is needed or some other solution required.

System information:

SAP_BASIS 740 0015 SAPKB74015 SAP Basis Component

SAP_ABA 740 0015 SAPKA74015 Cross-Application Component

SAP_GWFND 740 0015 SAPK-74015INSAPGWFND SAP Gateway Foundation 7.40

SAP_UI 740 0017 SAPK-74017IN

SAPUI User Interface Technology 7.40

PI_BASIS 740 0015 SAPK-74015INPIBASIS Basis Plug-In

ST-PI 740 0004 SAPK-74004INSTPI SAP Solution Tools Plug-In

BI_CONT 757 0007 SAPK-75707IN

BICONT Бизнес-информация и аналитика: содержимое

BI_CONT_XT 757 0007 SAPK-75707INBICONTXT Business Intelligence Content for Bobj I SAP_BW 740 0015 SAPKW74015 SAP Business Warehouse

CPMBPC 810 0010 SAPK-81010INCPMBPC SAP Business Planning and Consolidation

POASBC 100_731 0007 SAPK-10207INPOASBC POA Shared Business Components

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Yes, looks like the issue is this note!

CATCH cx_root.
  cl_ujk_logger=>log( i_object = 'EXCEPTION OCCURRED IN BADI.' )
0

Hello Evgeniy,

Do you have any news on this issue? I'm currently seeing the same behavior and I was wondering if you received SAP feedback or found a solution of any kind.

By the way, I did a code comparison of two systems (one where it's still working and another where it isn't) and I can confirm that changes made in method RUN_IN_SYNC_MODE from class CL_UJK_CUSTOM_LOGIC (as a result of note 2263229) is at base of not interrupting the package anymore.

Kind regards,

Jelle

0

Hi Jelle,

I recommend you to contact SAP yourself and to ask to create a configuration parameter to be able to switch on/off the note effect!

0

Hello Vadim,

Thanks for the recommendation. Will do, I'll just add one thing:

After browsing the notes a little bit more, I found out note 2391076 will trigger the failure of the package again but the custom error messages exported when raising exception CX_UJ_CUSTOM_LOGIC are not displayed in the package log anymore...

Kind regards,

Jelle

0

Not sure that this note will help! Look on the code changes:

CATCH cx_root.
  cl_ujk_logger=>log( i_object = 'EXCEPTION OCCURRED IN BADI.' ).
*>>>> START OF DELETION <<<<<
ENDTRY.
*>>>> END OF DELETION <<<<<<<
*>>>> START OF INSERTION <<<<
  " begin MFA20161116 note 2391076
  data: ls_message type uj0_s_message.
       ls_message-msgty = 'E'.
       ls_message-message = 'EXCEPTION OCCURRED IN BADI.'.
       append ls_message to et_message.
   " end MFA20161116 note 2391076
ENDTRY.
*>>>> END OF INSERTION <<<<<<
0
Vadim Kalinin Jan 26, 2017 at 01:51 PM
0

Please provide the abap code sample used to interrupt script execution!

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Something like this:

method IF_UJ_CUSTOM_LOGIC~EXECUTE.

  DATA: l_mytext LIKE IF_T100_MESSAGE=>T100KEY.

  l_mytext-msgid = 'UJ0_EXCEPTION'.
  l_mytext-msgno = '147'.
  l_mytext-attr1 = 'Error Generated!'.

  RAISE EXCEPTION TYPE CX_UJ_CUSTOM_LOGIC
             EXPORTING
                textid      = l_mytext.
endmethod.
0
Mark Dean Jan 30, 2017 at 03:36 PM
0

Hi Evgeniy,

thank you for your post as it relates directly to an issue I am having.

I am utilising the BPC DM script to invoke the UJ_CUSTOM_LOGIC BADI. My BADI implementation task is to reset / change Work Status for multiple Entity, Category, Time combinations.

All the validation / data base updates take place using the cl_ujw_work_status_mgr->update_work_status_locks method and this is working fine and returns the correct file update if successful or various different work status error messages if some validation error's occur.

Some of these combinations may be successful, others not e.g. Owner / Manager not set up for a particular Entity, and I write all of these messages to the DM Formula Log using the standard (as I have found searching forums) the

cl_ujk_logger=>log( i_object = l_log ) method.

The DM package status always ends succeeded. I want to be able to change this to warning or error which prompts the user to look at the Formula log to find what errors occurred.

Is there any way of doing this? I really need to make this work as this is the final issue I have had with this project task I was assigned. Everything else up to this package status issue is working fine.

I am writing comprehensive success and error messages to the DM Formula Log, but if any error does occur I want the status of the DM package NOT to say 'Succeeded'. I want it to say Warning or Error or something.

Thanks for your help / suggestions.

Kind regards

Mark Dean

Share
10 |10000 characters needed characters left characters exceeded
Pierre BOURNAVEAS
May 04, 2017 at 02:10 PM
0

Hello,

SAP Note 2391076 - "DM Package status show "success" when exception occurs in BADI execution" is correcting this behavior:

Symptom:

DM Package status show "success" when exception occurs in BADI execution in package.

By applying note, the status should show as "Fail".

Regards,

Pierre

Show 1 Share
10 |10000 characters needed characters left characters exceeded

The effect of this note was already discussed in the comments on the answer to this question. Unfortunately it will not stop script execution after failing the badi. But the status will be failed :)

0
Evgeniy Samardak May 18, 2017 at 07:42 AM
0

Hi,

abap code sample used to interrupt script execution

IF l_error = abap_true.
log2( |Processing aborted due to an error run the package/script| ).

RAISE EXCEPTION TYPE cx_uj_custom_logic.

EXIT.

ENDIF.


abap.jpg (33.0 kB)
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Just to confirm:

You are on: SAPK-81010INCPMBPC (including the note 2263229)

And the code:

method IF_UJ_CUSTOM_LOGIC~EXECUTE.

  DATA: l_mytext LIKE IF_T100_MESSAGE=>T100KEY.

  l_mytext-msgid = 'UJ0_EXCEPTION'.
  l_mytext-msgno = '147'.
  l_mytext-attr1 = 'Error Generated!'.

  RAISE EXCEPTION TYPE CX_UJ_CUSTOM_LOGIC
             EXPORTING
                textid      = l_mytext.
endmethod.

will stop execution of script logic after badi call??

0

Just tested the code of badi provided in my previous message with BPC 10.1 integrated in BW 7.50 SP06 (more resent then SAPK-81010INCPMBPC).

STOPSCRIPT is the filter value of the badi.

*XDIM_MEMBERSET P_ACCOUNT= A_600000
*XDIM_MEMBERSET TIME=2013.02
*XDIM_MEMBERSET FUNCTIONAL_AREA=FA_NONE
*XDIM_MEMBERSET COST_CENTER=CC_NONE
*XDIM_MEMBERSET CATEGORY=ACT
*XDIM_MEMBERSET COMPANY_CODE=CO_NONE
*XDIM_MEMBERSET PROFIT_CENTER=PC_NONE
*XDIM_MEMBERSET AUDIT_TRAIL=AT_BPC_INPUT
*XDIM_MEMBERSET COORDER=IO_NONE
*XDIM_MEMBERSET TRADING_PARTNER=TP_NONE

*WHEN P_ACCOUNT
*IS *
*REC(EXPRESSION=%VALUE%)
*ENDWHEN

*START_BADI STOPSCRIPT
QUERY=OFF
WRITE=OFF 
*END_BADI

*XDIM_MEMBERSET P_ACCOUNT= A_600000
*XDIM_MEMBERSET TIME=2013.02
*XDIM_MEMBERSET FUNCTIONAL_AREA=FA_NONE
*XDIM_MEMBERSET COST_CENTER=CC_NONE
*XDIM_MEMBERSET CATEGORY=ACT
*XDIM_MEMBERSET COMPANY_CODE=CO_NONE
*XDIM_MEMBERSET PROFIT_CENTER=PC_NONE
*XDIM_MEMBERSET AUDIT_TRAIL=AT_BPC_INPUT
*XDIM_MEMBERSET COORDER=IO_NONE
*XDIM_MEMBERSET TRADING_PARTNER=TP_NONE

*WHEN P_ACCOUNT
*IS *
*REC(EXPRESSION=%VALUE%)
*ENDWHEN

Resulting log shows that script execution is not stopped!

LOG BEGIN TIME:2017-05-18 10:55:27
FILE:\ROOT\WEBFOLDERS\XXXXXXX\ADMINAPP\PLANNING\TEST.LGF
USER:KALININV
APPSET:XXXXXXX
APPLICATION:PLANNING
[INFO] GET_DIM_LIST(): I_APPL_ID="PLANNING", #dimensions=12 
AUDIT_TRAIL,CATEGORY,COMPANY_CODE,COORDER,COST_CENTER,CURRENCY,FUNCTIONAL_AREA,MEASURES,PROFIT_CENTER,P_ACCOUNT,TIME,TRADING_PARTNER

#dim_memberset=10 
P_ACCOUNT:A_600000,1 in total.
TIME:2013.02,1 in total.
FUNCTIONAL_AREA:FA_NONE,1 in total.
COST_CENTER:CC_NONE,1 in total.
CATEGORY:ACT,1 in total.
COMPANY_CODE:CO_NONE,1 in total.
PROFIT_CENTER:PC_NONE,1 in total.
AUDIT_TRAIL:AT_BPC_INPUT,1 in total.
COORDER:IO_NONE,1 in total.
TRADING_PARTNER:TP_NONE,1 in total.

REC :%VALUE%

CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 0  RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
NO RECORDS GENERATED.
CALCULATION END.

ENDWHEN ACCUMULATION: 0  RECORDS ARE GENERATED.
EXECUTION BADI:STOPSCRIPT
QUERY: OFF
WRITE: OFF
EXCEPTION OCCURRED IN BADI.
BADI EXECUTION TIME IN TOTAL :0.00 ms.
[INFO] GET_DIM_LIST(): I_APPL_ID="PLANNING", #dimensions=12 
AUDIT_TRAIL,CATEGORY,COMPANY_CODE,COORDER,COST_CENTER,CURRENCY,FUNCTIONAL_AREA,MEASURES,PROFIT_CENTER,P_ACCOUNT,TIME,TRADING_PARTNER

#dim_memberset=10 
P_ACCOUNT:A_600000,1 in total.
TIME:2013.02,1 in total.
FUNCTIONAL_AREA:FA_NONE,1 in total.
COST_CENTER:CC_NONE,1 in total.
CATEGORY:ACT,1 in total.
COMPANY_CODE:CO_NONE,1 in total.
PROFIT_CENTER:PC_NONE,1 in total.
AUDIT_TRAIL:AT_BPC_INPUT,1 in total.
COORDER:IO_NONE,1 in total.
TRADING_PARTNER:TP_NONE,1 in total.

REC :%VALUE%

CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 1.00 ms. 0  RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
NO RECORDS GENERATED.
CALCULATION END.

ENDWHEN ACCUMULATION: 0  RECORDS ARE GENERATED.

SCRIPT RUNNING TIME IN TOTAL:1.00 s.
LOG END TIME:2017-05-18 10:55:28

You can see that the script code after badi call is executed!

0
Evgeniy Samardak Jun 14, 2017 at 08:36 AM
0

SAP has released еру note 2487016 - New parameter is introduced to control BADI exception handling in logic script:

New parameter "K2_BADI_EXCEPTION_HANDLING" is introduced to control BADI exception handling in logic script.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Unable to find this note :(

0