on ‎2019 Dec 07 1:23 AM
Hi,
Can someone provide some insight on using For Loop (in script logic) to check data for the current month...If the current month is zero, to copy data from previous month.
Month selection will be triggered from user selection from DM package.
Many thanks!
Request clarification before answering.
Also you can try the following:
//%TIME_SET%=2019.04(current period -single period selection)
*XDIM_MEMBERSET TIME=TMVL(-1,%TIME_SET%) //scope previous month 2019.03
*WHEN TIME.MONTHNUM
*IS <> 12 //Not if current period - JAN
*REC(EXPRESSION=([TIME].[%TIME_SET%]>0 || [TIME].[%TIME_SET%]<0) ? [TIME].[%TIME_SET%] : %VALUE%,TIME=%TIME_SET%)
*ENDWHEN"||" - OR operator: https://launchpad.support.sap.com/#/notes/0002228643
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
Apology for that. Please find below the info
1. BPC NW version: 10.1 BW 7.5, SP level 5
2. JAVA script since the error is on ABAP calc engine
3. List of dimensions to be used (refer to point 6 below)
4. Intended to incorporate as part of the consolidation run (before the consolidation script). Hence, it is triggered by the DM package (using EPM consolidation run)
5. Calculation logic:
a) User will input the Group Currency value for a specific flow. Eg: User will enter value $100 in Period 3. If current period is period 4, the custom script will copy data from period 3 to period 4 (as the user will not want to enter the same value in period 4). The system will perform the check that if current period (i.e period 4) is blank, it will copy the data from previous period.
b) Back-track to period 1 and 2, if I am at period 1, it will be blank (always). If I am period 2, if period 1 is blank, it will copy blank to period 2. However, if user had written some value into period 2 and run again the package, period 2 data will not be overwritten as there is data in period 2 (I,e overwriten will only take place if current period is blank).
6. Script:
*XDIM_MEMBERSET TIME = 2020.04
*XDIM_MEMBERSET TIME=TMVL(-1,2020.04)
*XDIM_MEMBERSET AUDITTRAIL = INPUT
*XDIM_MEMBERSET CATEGORY = ACTUAL
*XDIM_MEMBERSET ENTITY = KN45
*XDIM_MEMBERSET GROUPS = G_NONE
*XDIM_MEMBERSET MOVEMENT = F500
*XDIM_MEMBERSET RPTCURRENCY = USD
*XDIM_MEMBERSET ACCOUNT = 244000
*WHEN TIME.MONTHNUM
*IS <> 12
*REC(EXPRESSION=([TIME].[2020.04]==0) ? %VALUE% : [TIME].[2020.04],TIME=2020.04)
*ENDWHEN----
Error message:
REC :([TIME].[2020.04]==0) ? %VALUE% : [TIME].[2020.04]
7. Issue:
a) Error 1:
REC :([TIME].[2020.04]==0) ? %VALUE% : [TIME].[2020.04]
------------ ABAP Code Generation Error:4 -------------
MESSAGEG27Relational operator "==" is not supported.
----> How to convert to java script?
b) Error 2 (
REC :([TIME].[2020.04]=0) ? %VALUE% : [TIME].[2020.04]
------------ ABAP Code Generation Error:4 -------------
MESSAGEG27Relational operator ")" is not supported.
-----> not sure if it is link to Error 1
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With JavaScript calculation engine my code will work correctly.
For ABAP try this:
//%TIME_SET%=2019.04 (current period - single period selection)
*XDIM_MEMBERSET TIME=TMVL(-1,%TIME_SET%) //scope previous month 2019.03
*WHEN TIME.MONTHNUM
*IS <> 12 //Not if current period - JAN
*REC(EXPRESSION=([TIME].[%TIME_SET%]<>0) ? [TIME].[%TIME_SET%] : %VALUE%,TIME=%TIME_SET%)
*ENDWHENInstead of "==" try "<>"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
Info: SAP BW 7.5, SP level 5
Prior to this, I was having another error:
SCRIPT in UJKT:
*XDIM_MEMBERSET TIME = 2020.04
*XDIM_MEMBERSET TIME=TMVL(-1,2020.04)
*XDIM_MEMBERSET AUDITTRAIL = INPUT
*XDIM_MEMBERSET CATEGORY = ACTUAL
*XDIM_MEMBERSET ENTITY = KN45
*XDIM_MEMBERSET GROUPS = G_NONE
*XDIM_MEMBERSET MOVEMENT = F500
*XDIM_MEMBERSET RPTCURRENCY = USD
*XDIM_MEMBERSET ACCOUNT = 244000
REC :([TIME].[2020.04]==0) ? %VALUE% : [TIME].[2020.04]
------------ ABAP Code Generation Error:4 -------------
MESSAGEG27Relational operator "==" is not supported.
Line13 Word==
-------- Code ---------
program.
class main definition.
public section.
methods METH1 importing
P1 type decfloat34
P2 type decfloat34
exporting RET type decfloat34
raising CX_SY_ZERODIVIDE.
endclass.
class main implementation.
method METH1.
"([TIME].[2020.04]==0) ? %VALUE% : [TIME].[2020.04]
if ( P1 == 0 ) .
RET = P2.
else.
RET = P1.
endif.
endmethod.
endclass.
-------- Input formulas ---------
([TIME].[2020.04]==0) ? %VALUE% : [TIME].[2020.04]
------------ ABAP Code Generation Error Ends ------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but this is the reason why I am asking to read https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/
And to provide required info! You use ABAP calculation engine!
Full UJKT result:
----------- ABAP Code Generation Error:4 -------------
MESSAGEG27Relational operator ")" is not supported.
Line13 Word)
-------- Code ---------
program.
class main definition.
public section.
methods METH1 importing
P1 type decfloat34
P2 type decfloat34
exporting RET type decfloat34
raising CX_SY_ZERODIVIDE.
endclass.
class main implementation.
method METH1.
"([TIME].[2020.04]=0) ? %VALUE% : [TIME].[2020.04]
if 0 ) .
RET = P2.
else.
RET = P1.
endif.
endmethod.
endclass.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
I have gotten this error in validation. What should I amend? Thanks
REC :([TIME].[2020.04]=0) ? %VALUE% : [TIME].[2020.04]
------------ ABAP Code Generation Error:4 -------------
MESSAGEG27Relational operator ")" is not supported.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The script will be:
//%TIME_SET%=2019.04 (current period - single period selection)
*XDIM_MEMBERSET TIME=TMVL(-1,%TIME_SET%) //scope previous month 2019.03
*WHEN TIME.MONTHNUM
*IS <> 12 //Not if current period - JAN
*REC(EXPRESSION=([TIME].[%TIME_SET%]==0) ? %VALUE% : [TIME].[%TIME_SET%],TIME=%TIME_SET%)
*ENDWHEN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
Thank you for the reply. The scenario will be like this:
1. User will input the Group Currency value for a specific flow. Eg: User will enter value $100 in Period 3. If current period is period 4, the custom script will copy data from period 3 to period 4 (as the user will not want to enter the same value in period 4). The system will perform the check that if current period (i.e period 4) is blank, it will copy the data from previous period
2. Back-track to period 1 and 2, if I am at period 1, it will be blank (always). If I am period 2, if period 1 is blank, it will copy blank to period 2. However, if user had written some value into period 2 and run again the package, period 2 data will not be overwritten as there is data in period 2 (I,e overwriten will only take place if current period is blank).
Hope the above is clear.
Thanks for your time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 32 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.