on ‎2018 May 28 11:11 AM
Hi Experts,
Is it some way possible to read the user id of the user executing a data manager package then concatenate it with a char string and pass that concatenated value to a logic script?
For example, currently i have the below script (partial declaration part only), where $INPVERSION$ is a DM Input variable, which is reading input from the user say, "USER123456". Here "123456" is the user id of the user executing the package and "USER" is just a text string appended before. "USER123456" is a member ID of the version dimension.
Script :
*SELECT(%STEAVERS%,"[STEAVERS]",VERSION,"[ID]= $INPVERSION$") *SELECT(%SBCVERS%,"[SBCVERS]",VERSION,"[ID]= $INPVERSION$") *SELECT(%FFYEAR%,"[FFYEAR]",VERSION,"[ID]= $INPVERSION$") *SELECT(%LFYEAR%,"[LFYEAR]",VERSION,"[ID]= $INPVERSION$") *SELECT(%FYEARALL%,"[ID]",TIME,"[ID]>=%FFYEAR% AND ID<=%LFYEAR%") *SELECT(%LAYEAR%,"[LAYEAR]",VERSION,"[ID]= $INPVERSION$") *SELECT(%FYEARLAG%,"[ID]",TIME,"[ID]>=%LAYEAR% AND ID<=%LFYEAR%") *SELECT(%FYEARNXT%,"[ID]",TIME,"[ID]>%FFYEAR% AND ID<=%LFYEAR%")
The above is working fine with DM input variable as explained but the objective is to avoid the DM input and make it dynamic through combination of DM script and Logic script.
I hope i have been able to explain.
Any ideas?
Request clarification before answering.
Try to add:
INFO(%EQU%,=)
INFO(%TAB%,;)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,TAB,%TAB%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,EQU,%EQU%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,REPLACEPARAM,USER%EQU%%USER%)
In the script use $USER$
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the script you can concatenate text without issues:
*SELECT(%STEAVERS%,[STEAVERS],VERSION,[ID]=USER$USER$)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I followed your suggestion and the script looked as below but it seems the TIME dimension values are not getting identified. Though the FFYEAR, LFYEAR and LAYEAR are properly maintained for the VERSION member id
****************************************************************************************************************************
*SELECT(%STEAVERS%,[STEAVERS],VERSION,[ID]=USER$USER$)
*SELECT(%SBCVERS%,[SBCVERS],VERSION,[ID]=USER$USER$)
*SELECT(%FFYEAR%,[FFYEAR],VERSION,[ID]=USER$USER$)
*SELECT(%LFYEAR%,[LFYEAR],VERSION,[ID]=USER$USER$)
*SELECT(%FYEARALL%,[ID],TIME,[ID]>=%FFYEAR% AND [ID]<=%LFYEAR%)
*SELECT(%LAYEAR%,[LAYEAR],VERSION,[ID]=USER$USER$)
*SELECT(%FYEARLAG%,[ID],TIME,[ID]>=%LAYEAR% AND [ID]<=%LFYEAR%)
*SELECT(%FYEARNXT%,[ID],TIME,[ID]>%FFYEAR% AND [ID]<=%LFYEAR%)
****************************************************************************************************************************
Error after running DM package: RUN_LOGIC:No value assigned to dimension "TIME"
For you reference DM script i have updated as:
****************************************************************************************************************************
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SUSER,%USER%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPPSET,%APPSET%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPP,%APP%)
INFO(%EQU%,=)
INFO(%TAB%,;)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,EQU,%EQU%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,TAB,%TAB%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,REPLACEPARAM,USER%EQU%%USER%)
TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,LOGICFILENAME,XYZ.LGF)
****************************************************************************************************************************
I am not sure whether the SELECT statement is reading the $USER$ variable from the DM script or not.
Regards,
Swakshar
Incase you want the full script:
*SELECT(%STEAVERS%,[STEAVERS],VERSION,[ID]=USER$USER$)
*SELECT(%SBCVERS%,[SBCVERS],VERSION,[ID]=USER$USER$)
*SELECT(%FFYEAR%,[FFYEAR],VERSION,[ID]=USER$USER$)
*SELECT(%LFYEAR%,[LFYEAR],VERSION,[ID]=USER$USER$)
*SELECT(%FYEARALL%,[ID],TIME,[ID]>=%FFYEAR% AND [ID]<=%LFYEAR%)
*SELECT(%LAYEAR%,[LAYEAR],VERSION,[ID]=USER$USER$)
*SELECT(%FYEARLAG%,[ID],TIME,[ID]>=%LAYEAR% AND [ID]<=%LFYEAR%)
*SELECT(%FYEARNXT%,[ID],TIME,[ID]>%FFYEAR% AND [ID]<=%LFYEAR%)
*START_BADI UPDATE_CALC_VERS
VERSION = USER%USER%
QUERY = OFF
WRITE = OFF
*END_BADI
//----------------------------------------------------------------------------------------------------------------------------
*XDIM_MEMBERSET VERSION = USER%USER%
*XDIM_MEMBERSET ACCOUNT = INT003
*WHEN ACCOUNT
*IS *
*REC(EXPRESSION = 0)
*ENDWHEN
*XDIM_MEMBERSET INPFACTOR = NO_FACTOR
*XDIM_MEMBERSET GLOBPARAM = NO_GLOBPARAM
*XDIM_MEMBERSET INPUTCURRENCY = USD
*XDIM_MEMBERSET VERSION = USER%USER%,%STEAVERS%
*XDIM_MEMBERSET DATASOURCE = STEA
*XDIM_MEMBERSET KFTYPE = QUANTITY
*XDIM_MEMBERSET ACCOUNT = 305100
*XDIM_MEMBERSET TIME = %FYEARALL%
*WHEN ACCOUNT
*IS 305100
//Oil equity boepd
*REC(EXPRESSION = -(%VALUE%*1000000)/365,ACCOUNT = INT003,DATASOURCE = CALC,VERSION = USER%USER%)
*ENDWHEN
//----------------------------------------------------------------------------------------------------------------------------
*XDIM_MEMBERSET ACCOUNT = 110580,INT201,CF_055
*XDIM_MEMBERSET VERSION = USER%USER%,%%STEAVERS%,%SBCVERS%
*XDIM_MEMBERSET DATASOURCE = STEA,CALC
*XDIM_MEMBERSET INPFACTOR = NO_FACTOR
*XDIM_MEMBERSET GLOBPARAM = NO_GLOBPARAM
*XDIM_MEMBERSET INPUTCURRENCY = USD
*XDIM_MEMBERSET KFTYPE = AMOUNT
*XDIM_MEMBERSET TIME = %FYEARALL%
//Copy investment to liability
*FOR %FYR% = %FYEARALL%
*WHEN TIME
*IS %FYR%
*WHEN ACCOUNT
*IS 110580
*BEGIN
*REC(EXPRESSION = -%VALUE%,DATASOURCE = CALC, TIME = %FYR%, ACCOUNT = INT201,VERSION = USER%USER%)
*END
*ENDWHEN
*ENDWHEN
*NEXT
*FOR %FYR% = %FYEARALL%
*WHEN TIME
*IS %FYR%
*WHEN ACCOUNT
*IS 110580
*BEGIN
*REC(EXPRESSION = %VALUE%,DATASOURCE = CALC, TIME = %FYR%, ACCOUNT = CF_055,VERSION = USER%USER%)
*END
*ENDWHEN
*ENDWHEN
*NEXT
//------------------------------------------------------------------------------------------------------------------------
First - you are not looking on your post results!
There are no line breaks in the advanced DM script! I have to copy it to notepad and insert line breaks myself - makes me very unhappy. Looks like you disrespect people answering your questions.
Second - the following lines from my answer are missing in your advanced script:
INFO(%EQU%,=)
INFO(%TAB%,;)
Do you think I posted the mentioned lines just for fun?
As a result $USER$ variable is empty.
Hi Vadim,
Its highly appreciated that you are helping me out. If i am making mistakes there is a polite and professional way to point it out. Making kind of comments that you are making like above are not at all welcome.
If you fail keep patience because i am responding with mistakes you can choose to stop helping me.
I believe this is a professional forum and i am not here to offend or make fun of people's efforts.
Regards,
Swakshar
Yes, we are using a professional forum. And professionals are always checking the results of posts. Unfortunately I can see a lot of users posting text without correct line breaks (making text unreadable), using "Insert File" instead of correct "Insert Image", posting code as attached screenshot (impossible to copy and edit), posting low resolution images etc... I don't think it's a professional behavior!
P.S. By the way, I am writing about the mentioned issues each week, looks like users asking questions are not reading forum (only asking own questions).
Hi Vadim,
Thank you for helping, the issue is resolved. If i was careful enough yesterday, it would have been solved yesterday itself.
Regarding rules of the forum and not following them, i believe there is a way to point out and make people aware who are violating them (Note: they might not be violating DELIBERATELY). Choice of words is something i feel should be checked upon as this is a professional forum not someones personal blog space.
Anyway.
Regards,
Swakshar
In this particular case I am not talking about violation of forum rules. I am talking about common sense things related to question/comment posting.
P.S. Actually your current question was answered here: https://answers.sap.com/questions/444321/help-with-select-statement-in-script-logic-sap-bpc.html
There is no special variable %USER%!
You have to pass user name from advanced script using REPLACEPARAM
In the current question the full code was provided.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.