cancel
Showing results for 
Search instead for 
Did you mean: 

Pass DM variables to calling script of runlogic

former_member597393
Participant
0 Kudos
203

Dears,

I would like to pass DM variable (input value) VAR1 and VAR2 to my calling script CALL_SCRIPT.LGF

I have othe dimension I would to run each process for base member of dimension DIM1 that I have to pass to my calling script CALL_SCRIPT.LGF

for moment I can see that VAR1 and VAR2 are passed to RUNLOGIC but not to CALL_SCRIPT.LGF

but CALL_SCRIPT.LGF is not executed

My Runlogic is script :

 

*START_BADI RUNLOGIC

QUERY = OFF

WRITE = ON

LOGIC = CALL_SCRIPT.LGF

APPSET = MYAPPSET

APPLICATION = MYAPP

VARIABLE VAR1= $SELECTION$

VARIABLE VAR2= $COMOBOBOX$

DIMENSION DIM1 = BAS(PARENT1)

CHANGED = DIM1

DEBUG = OFF

*END_BADI

--------------------------------------------

My calling script :

 

*XDIM_MEMBERSET DIM1=%DIM1_SET%

*START_BADI RUN_CALC_BADI

QUERY=OFF

WRITE=ON

VAR1=$VAR1$

VAR2=$VAR2$

ANALYSIS = $DIM1$

*END_BADI

Thanks

Faouzi

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Kudos

Hi Faouzi,

Please, provide the advanced script in DM package to run your first script. I want to see what you actually have in variables $SELECTION$ and $COMOBOBOX$.

Second: as far as I know in the original version of RUNLOGIC BADI the syntax like:

VARIABLE VAR1= $SOMEVAR$

is not supported.

It's supported in our customized version of RUNLOGIC BADI. In the latest version of the original RUNLOGIC the DM variables like $SOMEVARIABLE% are automatically passed to the calling script and can be directly used in calling script code.

B.R. Vadim

former_member186338
Active Contributor
0 Kudos

Have you implement the modifications proposed here:

http://scn.sap.com/message/13186255#13186255

Vadim

former_member597393
Participant
0 Kudos

Thanks Vadim for your reply,

I applied the last code change for the last version from thread : http://scn.sap.com/thread/3149929

Here is the Advanced script in :

PROMPT(SELECT,%SELECTION%,,"Select DIM2","DIM2")

PROMPT(COMBOBOX,%COMOBOBOX%,"VAR2:",0,0.5,{0.50,0.60,0.70,0.80,0.90,1.00,1.10,1.20,1.30,1.40,1.50,1.60,1.70,1.80,1.90,2.00})

INFO(%EQU%,=)

INFO(%TAB%,;)

TASK(ZRUN_DAILY_JOB,TAB,%TAB%)

TASK(ZRUN_DAILY_JOB,EQU,%EQU%)

TASK(ZRUN_DAILY_JOB,SUSER,%USER%)

TASK(ZRUN_DAILY_JOB,SAPPSET,%APPSET%)

TASK(ZRUN_DAILY_JOB,SAPP,%APP%)

TASK(ZRUN_DAILY_JOB,LOGICFILENAME,MyRUNLOGIC_SCRIPT.LGF)

TASK(ZRUN_DAILY_JOB,REPLACEPARAM,SELECTION%EQU%%SELECTION%%TAB%COMOBOBOX%EQU%%COMOBOBOX%)

where MyRUNLOGIC_SCRIPT.LGF is the script that contains the RUNLOGIC script

Regards

Faouzi

former_member597393
Participant
0 Kudos

Hi,

I need two things :

  1. to pass the variable VAR1 and VAR2 from DM to calling script .
  2. execute each base member of DIM1 ( changed dimension ) in different paralell process

Thanks

Faouzi

former_member186338
Active Contributor
0 Kudos

Hi Faouzi,

If you properly implemented this code:

CALL FUNCTION 'UJK_SCRIPT_LOGIC_EXECUTE'

EXPORTING

I_APPSET                 = P_NEW_APPSET_ID

I_APPLICATION            = P_NEW_APPL_ID

I_USER                   = l_user

I_LOGIC                  = lt_th_lgx

I_FILE_TYPE              = 'LGF'

IT_CV                    = PTH_DIM_LIST

I_MODULE                 = 'DM'

I_LGF                    = l_docname

I_MODE                   = l_run_mode

IS_BADI_PARAM            = lt_badi_param

IMPORTING

ET_LGX                   = lt_lgx

E_FM_ERROR_MESSAGE       = ls_err_message

ET_LOG                   = lt_log.

In PROCESS_PARAMETERS:

******************************************************************************

* VALUE

******************************************************************************

clear ls_param.

clear gs_badi_param.

loop at it_param into ls_param where hashkey CS 'VARIABLE'.

REPLACE FIRST OCCURRENCE OF 'VARIABLE' IN ls_param-hashkey WITH space.

condense ls_param-hashkey no-gaps.

condense ls_param-hashvalue no-gaps.

translate ls_param-hashvalue to upper case.

IF gs_badi_param-parameter IS INITIAL.

CONCATENATE ls_param-hashkey '=' ls_param-hashvalue INTO gs_badi_param-parameter.

ELSE.

CONCATENATE gs_badi_param-parameter ';' ls_param-hashkey '=' ls_param-hashvalue INTO gs_badi_param-parameter.

ENDIF.

endloop.

gs_badi_param-equal = '='.

gs_badi_param-splitter = ';'.

MOVE gs_badi_param TO is_badi_param.

Then VARIABLE BADI parameter will work! It works fine in our system.

The issue is in the following lines of the advanced script:

PROMPT(SELECT,%SELECTION%,,"Select DIM2","DIM2")

TASK(ZRUN_DAILY_JOB,REPLACEPARAM,SELECTION%EQU%%SELECTION%%TAB%COMOBOBOX%EQU%%COMOBOBOX%)

PROMPT(SELECT....) will store in %SELECTION% the text like this:

/APPSETNAME/APPNAME/PrivatePublications/USERNAME/TempFiles/FROM.TMP@@@SAVE@@@@@@EXPAND@@@|DIMENSION:DIM2|SOMEMBERNAME1,SOMEMBERNAME2|

Where SOMEMBERNAME1,SOMEMBERNAME2... are the members of DIM2 selected by used in the DM propt.

Unfortunately TASK(ZRUN_DAILY_JOB,REPLACEPARAM,SELECTION%EQU%%SELECTION% will copy the whole text into the variable $SELECTION$ and pass it to your first script. Not sure that it's what you want.

There are 2 possible solutions to have only SOMEMBERNAME1,SOMEMBERNAME2 in the $$ script variable:

1. Use SELECTION TASK in DM advanced script:

TASK(ZRUN_DAILY_JOB,SELECTION,%SELECTION%)

TASK(ZRUN_DAILY_JOB,REPLACEPARAM,COMOBOBOX%EQU%%COMOBOBOX%)

In MyRUNLOGIC_SCRIPT.LGF:

*START_BADI RUNLOGIC

QUERY = OFF

WRITE = ON

LOGIC = CALL_SCRIPT.LGF

APPSET = MYAPPSET

APPLICATION = MYAPP

VARIABLE VAR1= %DIM2_SET% //will come from script scope defined by TASK SELECTION

VARIABLE VAR2= $COMOBOBOX$

DIMENSION DIM1 = BAS(PARENT1)

CHANGED = DIM1

DEBUG = OFF

*END_BADI

2. The second option is to use MEMBERSELECTION instead of REPLACEPARAM TASK. But in this case the %COMBOBOX% variable need to have syntax like %SELECTION%. This can be simulated by some INFO statements:

INFO(%PREFIX%,@@@SAVE@@@@@@EXPAND@@@|X|)

INFO(%SUFFIX%,|)

TASK(ZRUN_DAILY_JOB,MEMBERSELECTION,SELECTION%EQU%%SELECTION%%TAB%COMOBOBOX%EQU%%PREFIX%%COMOBOBOX%%SUFFIX%)

In this case no changes in the caller script MyRUNLOGIC_SCRIPT.LGF.

Please, ensure that in *START_BADI RUNLOGIC you mentioned all dimensions of the cube of the caller script and of the cube with the calling script (use <all> and <none> when necessary). I don't see statement like:

DIMENSION DIM2 = $SELECTION$ // or %DIM2_SET%

...

B.R. Vadim

former_member597393
Participant
0 Kudos

Thanks Vadim,

I filter SOMEMBERNAME1 from whole text when I get the variable in second script.but your solution is better whith sufix.

how I can define the other dimensions in the first and second script ,I don't need their value

I only need the base member values of the dimension DIM1 that I have in the RUNLOGIC ( with changed ) ,I need this base members value to be run for each paralell process.

How I can define VAR1 and VAR2 in second script in order to get their value

How I can define DIM1 ( changed dimension ) in the second script in order to the base members values.

Thanks

Faouzi

former_member186338
Active Contributor
0 Kudos

Hi Faouzi,

I don't recommend you to filter member name from text, better to use first or second methods to pass clear dimension names.

If you want to ensure that some variable from DM contains only one member (is it the case for DIM2?), then add this line at the beginning of the caller script (applicable to BPC 7.5 and early SP's of BPC 10):

*SELECT(%SOMEVAR%,"[ID]",DIM2,"[ID]='$DMVAR$'")

where $DMVAR$ in your case will be $SELECTION$ or %DIM2_SET%

If $DMVAR$ contains multiple members then this line will generate immediate error.

All dimensions have to be defined inside *START_BADI RUNLOGIC/*END_BADI:

DIMENSION DIM1 = BAS(PARENT1)

DIMENSION DIM2 = $SELECTION$

DIMENSION DIM3 = <all> //don't care, all members, applicable for both applications (caller and calling)

DIMENSION DIM4 = <none> // this dimension is present in the application with caller script and absent in the application with calling script

...

"How I can define VAR1 and VAR2 in second script in order to get their value" - you don't need to define the variables, simply use them like in your code.

"How I can define DIM1 ( changed dimension ) in the second script in order to the base members values." Your code ANALYSIS = $DIM1$ is incorrect, because you don't have variable DIM1 defined in the caller script. The calling script will be launched number of times each with the scope for some base member of PARENT1. The correct calling script will be:

*START_BADI RUN_CALC_BADI

QUERY=OFF

WRITE=ON

VAR1=$VAR1$

VAR2=$VAR2$

ANALYSIS = %DIM1_SET% // Not 100% sure that scope variable will properly work in BADI parameter

*END_BADI

If not, try this:

*XDIM_MEMBERSET DIM1 AS %DIM1MEMBER%=%DIM1_SET%

*START_BADI RUN_CALC_BADI

QUERY=OFF

WRITE=ON

VAR1=$VAR1$

VAR2=$VAR2$

ANALYSIS = %DIM1MEMBER%

*END_BADI

B.R. Vadim

P.S. First try to ensure that the scripts will properly work for one base member of DIM1:

DIMENSION DIM1 = SOMEBASECHILDOFPARENT1DIM1

//CHANGED = DIM1 // comment this line!

former_member186338
Active Contributor
0 Kudos

By the way, in your caller code you do not change DM variables - simply pass them to the calling script. For this scenario you don't need modified RUNLOGIC BADI with the VARIABLE parameter support. The latest Gersh code will simply pass the DM variables from the caller script to the calling script untouched. So, with his unmodified code you can simply use $SELECTION$ and $COMBOBOX% in the calling script. My modification (VARIABLE) is only required if you want to calculate some new values based on caller script DM variables and then pass the result to calling script in $$ variable.

B.R. Vadim

former_member597393
Participant
0 Kudos

Thank you very match Vadim for your help,

I am still testing your proposal .

There is an issue with BADI when it doesn't work with BASE ( PARENTH).

I can see the variable passed from DM to the RUNLOGIC BADI in   it_param , but it is not calling the second script.

I put debug in the second and is not executed.

Regards

Faouzi

former_member200327
Active Contributor
0 Kudos

Hi Faouzi,

BAS ( PARENTH1) is not a valid syntax in BPC. valid syntax is BAS(Node_name).

Hope this helps,

Gersh

former_member597393
Participant
0 Kudos

Thanks Vandim,

Sorry ,This is what I am using BAS(Node_name).

Now I am able to call the second script but the problem the variable are not passed.

when I check it_param in the second BADI I see :

VAR1=$VAR1$

VAR2=$VAR2$

values are not passed.

The same in values displayed in lt_th_lgx

-------------------------------------------------------------------------

This method from RUNLOGIC

---------------------------------------------------------------

  me->process_parameters( exporting it_param = it_param
                                    it_cv = it_cv
                                    i_user = l_user
                          importing et_lgx = lt_th_lgx
                                    e_chng_list = lt_th_dim
                                    e_docname = l_docname
                                    e_subrc = l_subrc ).

  • the it_param in the RUNLOGIC are OK  and passed from DM.
  • but it_param in second script which call an other BADI are not passed.

AN OTHER INFO :

if I link my second script to DM withoud using RUNLOGIC the variable are passed.

Thanks

Faouzi

former_member186338
Active Contributor
0 Kudos

Hi Faouzi,

If parameters in VARIABLE VAR2= $COMOBOBOX$ are not passed to the second script then there is something wrong in the implementation of changes in the original code. And looking on your code to call process_parameters I can see the issue (I forget to mention this change in my old post):

  me->process_parameters( exporting it_param = it_param

                                    it_cv = it_cv

                                    i_user = l_user

                          importing et_lgx = lt_th_lgx

                                    E_CHNG_LIST = lt_th_dim

                                    IS_BADI_PARAM = lt_badi_param

                                    e_docname = l_docname

                                    e_subrc = l_subrc ).

B.R. Vadim

former_member597393
Participant
0 Kudos

Hi Vandim,

I changed as requested.but you told me as I am only passing parameters without calculation ,I don't need to do those changes.

in the lt_badi_param ,I get two variable values separated by comma wich is OK,but still not passed to my second script.

I changed here also :

     wait up to 1 seconds.
            call function 'ZBPC_PARALLEL_LOGIC_RUN'
            starting new task l_name
*            DESTINATION 'PMRCLNT001'
          destination in group default
            calling l_end_of_run on end of task
             exporting
               i_appset                 = p_new_appset_id
               i_application            = p_new_appl_id
               i_user                   = l_user
               i_logic                  = lt_th_lgx
               i_file_type              = 'LGF'
               it_cv                    = lt_th_cngl_call_dim
               i_module                 = 'DM'
               i_lgf                    = l_docname
               i_mode                   = l_run_mode
*{   REPLACE        BW4K902649                                        5
*\*   IS_BADI_PARAM            =
              is_badi_param             = lt_badi_param
*}   REPLACE
*          CHANGING
*            ET_LGX                   = lt_lgx
*            E_FM_ERROR_MESSAGE       = ls_err_message
*            ET_LOG                   = lt_log
*   E_SP_WARNING             =
            exceptions
          system_failure        = 1  message l_message
          communication_failure = 2  message l_message
          resource_failure      = 3.

Thanks

Faouzi

former_member597393
Participant
0 Kudos

Hi Vadim,

I changed also thos function inside process method and I get one of the variables

   call function 'UJK_SCRIPT_LOGIC_EXECUTE'
    exporting
      i_appset                 = p_new_appset_id
      i_application            = p_new_appl_id
      i_user                   = l_user
      i_logic                  = et_lgx
*   I_FILE_TYPE              = 'LGX'
      it_cv                    = lt_cur_view
*   I_MODULE                 =
      i_lgf                    = l_filename
      i_mode                   = ujk0_cs_run_mode-validate
*{   REPLACE        BW4K902649                                        3
*\*   IS_BADI_PARAM            =
      is_badi_param            = is_badi_param
*}   REPLACE
    importing
*{   REPLACE        BW4K902649                                        4
*\*    ET_LGX                   = et_lgx
    et_lgx                   = et_lgx
*}   REPLACE
      e_fm_error_message       = l_error_message
*   ET_LOG                   =
*   E_SP_WARNING             =

Regards

Faouzi

former_member186338
Active Contributor
0 Kudos

Hi Faouzi,

When I wrote "The latest Gersh code will simply pass the DM variables from the caller script to the calling script untouched" the key word is - latest. It's the version of RUNLOGIC BADI directly send by Gersh to us (we don't use it, we use the version from How-to with the "VARIABLE" code change). I am not sure that the version located in How-to supports the parameter transfer to the calling script.

I also understand that in our system we use the RUNLOGIC BADI without parallel run, and it's a different branch in code. It looks like you need to change "ZBPC_PARALLEL_LOGIC_RUN":

  CALL FUNCTION 'UJK_SCRIPT_LOGIC_EXECUTE'

*          STARTING NEW TASK l_name

*          DESTINATION IN GROUP DEFAULT

*          PERFORMING l_end_of_run ON END OF TASK

   EXPORTING

     I_APPSET                 = I_APPSET

     I_APPLICATION            = I_APPLICATION

     I_USER                   = I_USER

     I_LOGIC                  = I_LOGIC

     I_FILE_TYPE              = I_FILE_TYPE

     IT_CV                    = IT_CV

     I_MODULE                 = I_MODULE

     I_LGF                    = I_LGF

     I_MODE                   = I_MODE

*   IS_BADI_PARAM            =

     is_badi_param             = lt_badi_param

  IMPORTING

In order to pass parameters to script execution.

B.R. Vadim

former_member186338
Active Contributor
0 Kudos

And yes, here (in PROCESS_PARAMETERS) you also have to add is_badi_param = is_badi_param to properly validate the script.

former_member200327
Active Contributor
0 Kudos

Hi Faouzi,

Please send me a email to better.bpc at gmail.com and I'll reply with the new version of RUNLOGIC that understands $...$ parameters.

It has a lot of other enhancements as well. New How To Guide should be published soon.

Regards,

Gersh

former_member597393
Participant
0 Kudos

Hi All,

I am waiting our basis to approve and install it.once done I come back to you

Regards

Faouzi

former_member597393
Participant
0 Kudos

Hi Gersh,

I installed the program that you sent to me and I get this error.

Regards

Faouzi

former_member200327
Active Contributor
0 Kudos

Hi Faouzi,

What SP are you running? Can you please check in your system in Class CL_UJK_MODEL has Method INITIALIZE and if it's Visibility is Public.

This method was included later and needed only if you make multiple calls to RUNLOGIC in same script. So, if you don't have that Method and have no need to call RUNLOGIC multiple times in one script then you can comment out the Method call.

Please let me now how it goes.

Regards,

Gersh

former_member597393
Participant
0 Kudos

Hi Gresh,

We are running on SAP 7.5 SP8.0

we don't have the mehod INITIALIZE in class CL_UJK_MODEL.

we need to run base members of the one parent in differents process.is this achieved by multipe calls of the RUNLOGIC?

how we get this method ?

Regards

Faouzi

former_member200327
Active Contributor
0 Kudos

Hi Faouzi,

I don't have access to version 7.5 any longer, but I'll work around that call in next version of RUNLOGIC. Meanwhile you can comment it out. It's needed only in version 10.0.

To call your script for base members of one Node you can put parameter CHANGED = DIMNAME (NODENAME) in a single RUNLOGIC call.

Regards,

Gersh