cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed with BPC 10.1 Data Manager script with REPLACEPARAM_KEY keyword

mark_dean
Explorer
0 Kudos

I am trying to develop a Work Status reset program using a custom process chain. I have based the processing on the Create Master Data on the Fly pdf.

I want to pass custom Entity, Category and Time values + a couple other parameters such as desired work status and Include Children in the Data Manager prompt.

When I run the package the Entity, Category and Time %% variables are filled correctly (although I have read that the maximum number of chars is 40 for the REPLACEPARAM_KEY & _VALUE parameters and mine are longer than that as are proceeded by the Environment, Model, Private Publications etc. before we get to the actual dimension name and member values), but the problem I want the answer to is: The view status gives failure message as:

Cannot configure parameter REPLACEPARAM1_KEY in task ZBPC_WRKSTS_RESET_START

model: INPUT. Package status: RUNNING

All the REPLACEPARAM_KEY and _VALUE(s) are specified in the custom RSPC BPC Process Type.

My DM script is below (I need help with the syntax of the REPLACPARAM_KEY etc.). I have tried without quotes, using the word ID etc. You can see that it is "ENTITY_WS" and I have only shown the affected script:

PROMPT(SELECTINPUT,%ENTITY_WS%,,"Select Entity base members",ENTITY_WEEKLY) - ENTITYWEEKLY is the dimension

TASK(ZBPC_WRKSTS_RESET_START,REPLACEPARAM1_KEY,"ENTITY_WEEKLY")

TASK(ZBPC_WRKSTS_RESET_START,REPLACEPARAM1_VALUE,%ENTITY_WS%).

I have been working on trying to pass BPC custom variables to backend Process Chain for some time and keep hitting hurdles.

Thank you for any help.

Mark Dean

Accepted Solutions (0)

Answers (13)

Answers (13)

mark_dean
Explorer
0 Kudos

Hi Vadim,

The script logic did continue after I had called the 1st BADI (which put an 'E' Type message) into the ET_MESSAGE table.

In the script below I called another implementation of UJ_CUSTOM_LOGIC. The filter now was 2SFG_1. It was a copy of the 1st BADI call except there was an infinite DEBUG loop in the IF_UJ_CUSTOM_LOGIC~EXECUTE Method, and yes it hit the infinite loop after passing the 'E' type message which would have generated a 'Failed' status.

Interestingly when coming out of the loop and processing to the end, the concluding log had a status of warning even though an 'E' type message would have been re-inserted into the ET_MESSAGE. In the Formula log was shown the 2 calls to the 2 BADI's.

Anyhow the quick answer to your question is YES, script logic continued after executing the 1st BADI filter (2SFG_WS_RESET) and at no time was a RAISE EXCEPTION TYPE cx_uj_custom_logic (which would have ended package immediately with a Succeeded status in this release of BPC).

*START_BADI 2SFG_WS_RESET
QUERY = ON
WRITE = ON
VERSION = %VERSION_SET% //Category is called version at 2SFG
TIME_INPUT = %TIME_INPUT_SET%
ENTITY_WEEKLY = %ENTITY_WEEKLY_SET%
STATUS_WS = $STATUS_WS$
INCL_CHLD_WS = $INCL_CHLD_WS$
S_USER = $S_USER$
*END_BADI

*START_BADI 2SFG_1
QUERY = ON
WRITE = ON
VERSION = %VERSION_SET% //Category is called version at 2SFG
TIME_INPUT = %TIME_INPUT_SET%
ENTITY_WEEKLY = %ENTITY_WEEKLY_SET%
STATUS_WS = $STATUS_WS$
INCL_CHLD_WS = $INCL_CHLD_WS$
S_USER = $S_USER$
*END_BADI

former_member186338
Active Contributor
0 Kudos

To my mind it's not a good idea to continue script execution after badi failed. It's not an issue in you case (changing work status) but in other cases...

mark_dean
Explorer
0 Kudos

Vadim and all,

yes, we on on SAP BPC 10.1 NetWeaver Standard on HANA, and in the NW backend System>Status software release is: SAP_BW 750 0003 SAPK-75003INSAPBW SAP Business Warehouse.

Below are my conclusions on how to run a Data Manager package and influence its processing. This information directly relates to an issue that was posted recently (a week ago): https://answers.sap.com/questions/113793/index.html

My scenario consists of a user selecting multiple work status member combinations (Entity, Version and Time), together with a target work status and an Include Children flag.

This Data Manager prompt based on /CPMB/DEFAULT_FORMULAS process chain, which runs a logic script that calls the UJ_CUSTOM_LOGIC BADI custom implementation. In this implemenation custom ABAP is processed in the IF_UJ_CUSTOM_LOGIC~EXECUTE Method.

A Exporting parameter of this Method is ET_MESSAGE which is key to controlling the package processing.

My program loops around each supplied Work Status member combination and calls the cl_ujw_work_status_mgr->update_work_status_locks( performs validation (not full I think?), and if error throws an error which is catchable and if passes validation updates the backend Appset / Application /1CPMB/LKWSxxyyy table).

In my program on catching the error: CATCH cx_uj_static_check INTO gr_exception.

I will write an 'E' type message to the ET_MESSAGE. This is the message that will appear on the main log and also give the Package as a Failed status when processing finally ends in the IF_UJ_CUSTOM_LOGIC~EXECUTE Method. Writing a 'W' type message will issue a status of 'Warning'. An 'S' type will ensure a status of 'Succeeded' but the main message is fixed as 'SUCCESS' - i.e. the et_message is not displayed, only the mstyp is taken into account.

With later releases of BPC you cannot use the RAISE EXCEPTION TYPE cx_uj_custom_logic.This will always immediatley end the Method processing and the package status will be returned as 'Succeeded' - totally undesired - see link above.

Meanwhile if an error has been caught I write a comprehensive message to the Formula Log using the standard cl_ujk_logger=>log( i_object = l_log ) processing. I also write a message for a Success (i.e. work status update has occurred.)

Shown below is the DM log where 3 errors occurred (trying to update work status in 3 different models). The package status is 'Failed' because of the 'E' (did not try 'A'), the ET_MESSAGE is shown telling user to look down the Formula log for detailed error description.

former_member186338
Active Contributor
0 Kudos

Yes, this is absolutely clear! My question was that if you add some script logic code after badi call in the script then it will be executed even if badi generated error! With exception in previous versions the script was terminated and nothing was executed after badi call.

P.S. Unable to test on the latest version...

former_member186338
Active Contributor
0 Kudos

Please delete duplicated answer...

mark_dean
Explorer
0 Kudos

Vadim,

I was just in the middle of sending you a full rundown of what I did but I lost it. Before I resubmit can you tell me how to see what version of BPC we are on e.g. BPC 10.1 SP xxxx patch or whatever, from the Front End BPC Admin web (I know how to get the EPM Add-in version for Excel -is this the same?)

As we are on HANA under the system>status we only get SAP_BW 750 SP-Level 0003. On HANA you do not get the CBCEPM 810 or whatever it is in the status Product version.

Thanks

Mark

former_member186338
Active Contributor
0 Kudos

"SAP_BW 750 SP-Level 0003" - this is the only info required

P.S. Prepare your answer in notepad 🙂

mark_dean
Explorer
0 Kudos

Vadim, here is the code for the IF_UJ_CUSTOM_LOGIC~EXECUTE Method

Notice how I have asterisked out the RAISE EXCEPTION. If left in program ends with Package succeeded after leaving program with the RAISE . Being left out ensures processing continues (e.g. you can add further messages to the formula log), and as soon as Method processing ends and returns to the custom UJ_CUSTOM_LOGIC then Package ends as Failed (due to the et_message-msgty = 'E').

msgty = 'W' will also give package status ending as 'Warning'

l_s_message TYPE uj0_s_message.

l_s_message-msgid = 'ZBPC'.
l_s_message-msgno = '042'. "Any arbitrary no
l_s_message-recno = 1. "Just for consistency

l_s_message-msgty = 'E'.
l_s_message-message = 'Whatever you want blha blah blah - I tell the user here to look at the formula log to get discrete errors'

APPEND l_s_message TO et_message.

* RAISE EXCEPTION TYPE cx_uj_custom_logic.

Below is a screen shot of msgty = 'E'.

The above message appears in the main DM package log. The only thing I could not do was if msgty = 'S', was to say to the user to look at the formula log to see the updated details. Log just says the standard Package status: SUCCESS

Regards

Mark

former_member186338
Active Contributor
0 Kudos

Unfortunately script without RAISE EXCEPTION TYPE CX_UJ_CUSTOM_LOGIC

will continue execution!

Just test like here:

//********************* Test sample code
*START_BADI TESTSTATUS
WRITE=OFF
QUERY=OFF
DEBUG=OFF
*END_BADI

*XDIM_MEMBERSET PERIODS=2011.FEB
*XDIM_MEMBERSET PLANTYPE=ACTUAL
*XDIM_MEMBERSET TITLES=1214
*XDIM_MEMBERSET CORPDIR=DIRECT
*XDIM_MEMBERSET INACCT=PAGEVIEWS
*XDIM_MEMBERSET BE=BE1000
*WHEN INACCT
*IS *
*REC(EXPRESSION=%VALUE%)
*ENDWHEN

Without Exception the code after badi will run (Formula log):

LOG BEGIN TIME:2017-01-31 16:19:35
FILE:\ROOT\WEBFOLDERS\SIM\ADMINAPP\INPER\TESTEX.LGF
USER:V.KALININ
APPSET:SIM
APPLICATION:INPER
[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:BE WILL QUERY ON ALL BASE MEMBERS.
[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:CORPDIR WILL QUERY ON ALL BASE MEMBERS.
[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:INACCT WILL QUERY ON ALL BASE MEMBERS.
[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:PERIODS WILL QUERY ON ALL BASE MEMBERS.
[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:PLANTYPE WILL QUERY ON ALL BASE MEMBERS.
[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:TITLES WILL QUERY ON ALL BASE MEMBERS.
EXECUTION BADI:TESTSTATUS
QUERY: OFF
WRITE: OFF
BADI EXECUTION TIME IN TOTAL :0.00 ms.
MESSAGE FROM CUSTOM LOGIC:
E:ZBPC:042
[INFO] GET_DIM_LIST(): I_APPL_ID="INPER", #dimensions=7
BE,CORPDIR,INACCT,MEASURES,PERIODS,PLANTYPE,TITLES

#dim_memberset=6
PERIODS:2011.FEB,1 in total.
PLANTYPE:ACTUAL,1 in total.
TITLES:1214,1 in total.
CORPDIR:DIRECT,1 in total.
INACCT:PAGEVIEWS,1 in total.
BE:BE1000,1 in total.

REC :%VALUE%

CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 2.00 ms. 1  RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
1  RECORDS ARE GENERATED.
CALCULATION END.

ENDWHEN ACCUMULATION: 1  RECORDS ARE GENERATED.

DATA TO WRITE BACK:
BE    CORPDIR    INACCT    PERIODS    PLANTYPE    TITLES    SIGNEDDATA
BE1000    DIRECT    PAGEVIEWS    2011.FEB    ACTUAL    1214    - 2700.00
1  RECORDS HAVE BEEN WRITTEN BACK.
WRITING TIME :1.00  ms.

SCRIPT RUNNING TIME IN TOTAL:4.00 s.
LOG END TIME:2017-01-31 16:19:36
File path: \ROOT\WEBFOLDERS\SIM\INPER\PRIVATEPUBLICATIONS\V.KALININ\tempfiles\20170131161935\TESTEX.LOG<br>

And with exception the script execution will be terminated on the badi. I am talking about OLD SP. Can you test the same in latest?

mark_dean
Explorer
0 Kudos

Vadim,

I finally found a solution. I tried adding an 'E' type message to the ET_message parameter of the IF_UJ_CUSTOM_LOGIC~EXECUTE method.

Package came up as status 'Failed' and message specified came up in the main part of the log. The message here would inform the user to look at the formula log to see reasons for individual failures (and successes).

One last thing - how to I close this this thread besides marking all as read?

Thanks again for your help.

Regards

Mark

former_member186338
Active Contributor
0 Kudos

It's better to provide a sample code to show your solution. Please show minimal badi code that will result in Failed status (like in my sample).

"One last thing - how to I close this this thread besides marking all as read?" -

marking all as read?? not clear... you have close action!

mark_dean
Explorer
0 Kudos

Sorry Vadim, for not posting the release details.

We are on SAP BPC 10.1 SP11, EPM Add-in is 10.0 SP26 Patch 3 Net3.5, BW is SAP-BW 750 0003.

Yes, I tried your code but did not work as on a later release. Wrote message to Formula log but package ended as succeeded!

As you know I want to duplicate that functionality on this latest release (i.e. interrupting the UJ_CUSTOM_LOGIC error processing).

Why do you think this has been disabled in later releases. I cannot find anything regarding this.

Regards

Mark

former_member186338
Active Contributor
0 Kudos

I think you have to contact SAP support and provide clear test case. I don't see any notes related to this logic change.

To my mind it's a bug!

mark_dean
Explorer
0 Kudos

Hi Vadim,

the post you directed me to corresponded with my issue of needing to change status of Data Manager execution, I could clearly identify with, but as you posted, we need a resolution as opposed to just stating that in the latest BPC release there is no way to interrupt the UJ_CUSTOM_LOGIC processing to effect the change in status of a Data Manager package.

I am almost there, I am writing correctly comprehensive Success and Error messages with regard to the

cl_ujw_work_status_mgr->update_work_status_locks method which provides all of the validation needed for work status update, and if no errors updates the work status locks table (/1cpmb/LKWSxxyyy where xx = appset prefix and yyy = application prefix) correctly.

I am writing the error / success messages using the cl_ujk_logger=>log( i_object = l_log ) method, but I just need something to inform the user if an error has occurred, instead of the package status just reading 'succeeded', and then if there is an error they can see in the Formula Log what errors (and successes occurred) - as my reset program deals with multiple work status dimension intersections.

Thanks

Mark

former_member186338
Active Contributor
0 Kudos

"please provide detailed info about BPC and BW version and SP" - once again...

former_member186338
Active Contributor
0 Kudos

P.S. Have you tested the code I have provided in the mentioned link?

In my system (with old SP) the result is:

mark_dean
Explorer
0 Kudos

Hi Vadim,

thanks for all your help so far. I have another question.

I am nearly there with my Data Manager work status reset program. I a writing log records as desired to the CL_UJK_LOGGER=>LOG which show up correctly in the status formula log.

However if as below as specified in UJ_CUSTOM_LOG~EXECUTE (this is just a really simple example)

l_log = 'You have not specified ENTITY_WEEKLY value(s) which are required'.
cl_ujk_logger=>log( i_object = l_log ).

RAISE EXCEPTION TYPE cx_uj_custom_logic.

EXIT.

the package still comes back as SUCCESSFUL. (I want to take control back after the EXIT, or know how to insert the fact that the package did not run successfully).

I want it to come back with an overall status with an error and a message to inform the user to read the formula log. If this is not possible then I just want to end the package with warning or error but not successful.

Thanks again Vadim, Regards Mark

former_member186338
Active Contributor
0 Kudos

"the package still comes back as SUCCESSFUL" - it depends on BPC SP (please provide detailed info about BPC and BW version and SP).

Please also read my answers here: https://answers.sap.com/questions/113793/index.html

former_member186338
Active Contributor
0 Kudos

Hi Mark,

Some basic things:

I know to specify QUERY = ON - incorrect, you don't need to scope records!

Parameters:

You have to specify in the badi number of parameters:

1. List of dimensions used in work status - each parameter: dimension name - dimension member

2. STATUS parameter

3. INCLCHILD parameter.

Please look once again on the provided link:

READ TABLE it_param WITH KEY hashkey = ‘STATUS’ INTO ls_param.

former_member186338
Active Contributor
0 Kudos

P.S.

Is the IF_UJ_CUSTOM_LOGIC~EXECUTE method's table variable IT_PARAM populated automatically??

It will be populated if you call badi with the required parameters, like:

CATEGORY=%CATEGORY_SET% //If you category type dimension is named CATEGORY

...

%CATEGORY_SET% will come from %SELECTION% variable in the advanced script...

STATUS=$STATUS_WS$ //From REPLACEPARAM...

mark_dean
Explorer
0 Kudos

Hi Vadim, I understand the BADI UJ_CUSTOM_LOGIC custom filter implementation on the ABAP backend. It is the BPC Front End Manager scriptfile to call the BADI I am unsure about.

My BPC DM prompt script reads as follows and calls the script logic in file RUN_WORK_STATUS_CHG

PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%,%ENTITY_DIM%,%TIME_DIM%")

PROMPT(RADIOBUTTON,%STATUS_WS%,"Reset Work Status to:",1,{"0 = Unlocked","1 = Submitted","2 = Approved","3 = Locked"},{"1","2","3","4"})

PROMPT(CHECKBOXNO, %INC_CHLD_WS%,"Include Children")

INFO(%EQU%,=)

INFO(%TAB%,;)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SUSER,%USER%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPPSET,%APPSET%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPP,%APP%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SELECTION,%SELECTION%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,LOGICFILENAME,RUN_WORK_STATUS_CHG)

TASK((/CPMB/DEFAULT_FORMULAS_LOGIC,REPLACEPARAM,STATUS_WS%EQU%%STATUS_WS%%TAB%INC_CHLD_WS%EQU%%INC_CHLD_WS%)

The section I am unsure about is the RUN_WORK_STATUS_CHG logic file script which runs the custom filtered implementation of the UJ_CUSTOM_LOGIC BADI. I know to specify QUERY = ON so as to scope the data for the BADI to run on but it is the parameters passed to the BADI implementation that I am unsure about.

Is the IT_PARAM variable in the IF_UJ_CUSTOM_LOGIC~EXECUTE method automatically filled by the Process Chain Process Type screen? I mean how does the SELECTION & REPLACEPARAM variables passed in the Process Type in the Process Chain get into the UJ_CUSTOM_LOGIC BADI?

Is the IF_UJ_CUSTOM_LOGIC~EXECUTE method's table variable IT_PARAM populated automatically??

So I have:

*START_BADI <filter name of custom UJ_CUSTOM_LOGIC Badi>

*WRITE = OFF

*QUERY = ON

?? Parameters

?? Parameters

*END_BADI

Is this all I have to specify

Thanks very much for answering this.

Mark

mark_dean
Explorer
0 Kudos

Thanks Vadim, for showing the correct way to approach this.

former_member186338
Active Contributor
0 Kudos

If the question is answered please accept the correct answer and close the question.

mark_dean
Explorer
0 Kudos

Thanks Vadim,

I see your answers elsewhere on the forum and they often help me. When I mentioned about using the Master Data on the Fly pdf, I meant that I was duplicating some of the processing scenario, like having a similar custom process chain and using the same superclass, and the Method list in my custom RSPC Process Type CL_UJD_BPC... class and changing some of the Methods i.e. IF_RSPC>EXECUTE, SET_PC_TYPE and RUN to suit my requirements and the fact that it passes custom parameters which is what I require.

I have not used a BADI call from BPC before, and one of the reasons I went the Process Chain route was that I wanted to send status and informational messages back to the BPC View Status screen. I expect I can still do this going the BADI route.

I am going to follow your suggestion - the problem I have been really trying to solve up to now is how to retrieve custom parameters in the Class OO NW backend.

Regards

Mark

former_member186338
Active Contributor
0 Kudos

Please read the link from my previous post! You DON'T need to use custom chain!!!

In this sample badi use 2 parameters in the script:

TIME = %CURRENT_MONTH%

VERSION = FORECAST1

You can pass parameters from DM advanced script using scope (SELECTION) or using REPLACEPARAM/MEMBERSELECTION.

What is the issue?

former_member186338
Active Contributor
0 Kudos

P.S. log info in BPC View Status screen will be also present if you use custom logic badi and standard DEFAULT_FORMULAS chain to launch lgf script!

former_member186338
Active Contributor
0 Kudos

"I have based the processing on the Create Master Data on the Fly pdf." - ups, strange!

Please read: https://blogs.sap.com/2013/10/28/how-to-change-work-status-from-script-logic-using-badi/

And use standard chain default formulas to launch the script with custom logic badi.

former_member186338
Active Contributor
0 Kudos

The special chain used in master data on the fly is absolutely not required to create DM for Work status change...