Show TOC

Syntax documentation*REC Locate this document in the navigation structure

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 Example

*XDIM_MEMBERSET P_ACCT = CE0004010

*WHEN CATEGORY

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

*ENDWHEN

End of the example.

The {member} must be enclosed in double quotes and can contain the name of any dimension, enclosed between percent signs (for example: ENTITY="IC_%ENTITY%"). In this case, the dimension name is replaced with the value of the current member for that dimension, and not with just the dimension name.

You can use property values in WHEN statement.

Example 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.

End of the example.

Example 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

End of the example.
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.

Only valid for: SAP NetWeaver |
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 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 cube.

End of the example.
End of: SAP NetWeaver |
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 Note

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

End of the note.

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 Example

AppSet: APSHELL_V (Copy of APSHELL)

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.

End of the example.

Example Example

AppSet: APSHELL_V (Copy of APSHELL)

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

End of the example.

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.