*REC

The *REC( ) instruction tells the program what to do once the specified criteria has been met.

Each REC instruction generates one new record to post to the database. Each source record can generate as many records as desired, even pointing to the same destination cell.

The parameters of the REC( ) function specify what to modify of the original record. Any dimension member can be modified using the following syntax:

{DimensionName}={member}

Example

*XDIM_MEMBERSET P_ACCT = CE0004010

*WHEN CATEGORY

*IS ACTUAL *REC(FACTOR = 1.1, CATEGORY="FORECAST")

*ENDWHEN

You can use property values in WHEN statement.

Example

*XDIM_MEMBERSET CATEGORY = PLAN

*WHEN TIME.YEAR

*IS "2007"

*REC(FACTOR = 1.1, CATEGORY="FORECAST")

*ENDWHEN

The above script copies the 2007 plan data to Forecast. You can also read property values and assign them to dimensions.

Example

*XDIM_MEMBERSET P_ACCT = CE0004010,CE0652000

*WHEN P_ACCT

*IS "CE0004010"

*REC(EXPRESSION=([P_ACCT].[CE0004010],[P_ACTIVITY].[NONE])/([P_ACCT].[CE0652000],[P_ACTIVITY].[LABPRD]), RPTCURRENCY=[ENTITY].CURRENCY, P_ACCT=CE0661000)

*ENDWHEN

Restrictions For Using the REC Instruction

  • You cannot use other MDX keywords (such as PARENT and DESCENDANTS) in FACTOR or EXPRESSION instructions. The only permitted operations are addition (+), subtraction (-), multiplication (*), and division (/), combinations of these operators, and parenthesis for tuple and priorities of the operations.

  • You cannot use the GET() function to refer to another source value. The MDX tuple format acts as a GET function.

  • You cannot use NOADD or FLD functions within REC.

  • Dynamic properties such as HLEVEL, PARENTHn are not supported in the REC statement.

  • REC always needs to be accompanied by WHEN / IS / ENDWHEN. Stand-alone REC statements do not have any effect.

  • You cannot use SIGNEDDATA or any measure name in a WHEN statement to write a condition on a measure value.

  • WHEN / IS / REC / ENDWHEN cannot be used in SELECTCASE / ENDSELECT.

Using Multiple REC Statements

You can write multiple REC statements within one WHEN/ IS/ ENDWHEN statement.

Syntax

*WHEN {dim}

* IS {condition_value}

*REC({FACTOR or EXPRESSION instruction},dim=…)

*REC({FACTOR or EXPRESSION instruction},dim=…)

*REC({FACTOR or EXPRESSION instruction},dim=…)

*ENDWHEN

Example

*XDIM_MEMBERSET TIME = 2006.AUG,2006.SEP

*XDIM_MEMBERSET P_ACCT=CE0004010

*XDIM_MEMBERSET CATEGORY=ACTUAL

*WHEN P_ACCT

*IS "CE0004010"

*REC(EXPRESSION=%VALUE%/1.5098, RPTCURRENCY="EUR")

*REC(EXPRESSION=%VALUE%/1.0666, RPTCURRENCY="CAD")

*REC(EXPRESSION=%VALUE%/1.9183, RPTCURRENCY="GBP")

*ENDWHEN

The script shown above creates EUR, CAD, and GBP posts in the InfoProvider.

Referring To Another Source Value Within A FACTOR/EXPRESSION Instruction

You can assign a source value from the scoped data for a FACTOR or EXPRESSION instruction to calculate a new value inside a *REC( ) statement. To refer to another source value, you must use fully qualified MDX formatting, including an Account dimension.

Note
You have the ability to use implicit Account members in direct MDX statements within script logic.

Syntax

*WHEN {dim}

* IS {condition_value}

*REC({FACTOR or EXPRESSION instruction},dim=…)

*REC({FACTOR or EXPRESSION instruction},dim=…)

*REC({FACTOR or EXPRESSION instruction},dim=…)

*ENDWHEN

Example

Environment: EnvironmentShell_V (Copy of EnvironmentShell)

Application: Planning

*XDIM_MEMBERSET P_ACCT = CE0004010,CE0004020

*WHEN P_ACCT

*IS "CE0004010"

*REC(EXPRESSION=%VALUE%/[P_ACCT].[CE0004020], P_ACCT="CE0661000")

*ENDWHEN

You can use tuples as well.

Example

Environment: EnvironmentShell_V (Copy of EnvironmentShell)

Application: Planning

*XDIM_MEMBERSET P_ACCT = CE0004010,CE0652000

*WHEN P_ACCT

*IS "CE0004010"

*REC(EXPRESSION=%VALUE%/([P_ACCT].[CE0652000],[P_ACTIVITY].[LABPRD]), P_ACCT="CE0661000")

*ENDWHEN

Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or by its gross negligence.