Hierarchy
⤷ BW-WHM-DST (Application Component) Data Staging
⤷ RSAU (Package) Update
Basic Data
Data Element | RSROUTTXT2 |
Short Description | Routine for Key Figures with Return Table |
Data Type
Category of Dictionary Type | D | Domain |
Type of Object Referenced | No Information | |
Domain / Name of Reference Type | TEXT60 | |
Data Type | CHAR | Character String |
Length | 60 | |
Decimal Places | 0 | |
Output Length | 60 | |
Value Table |
Further Characteristics
Search Help: Name | ||
Search Help: Parameters | ||
Parameter ID | ||
Default Component name | ||
Change document | ||
No Input History | ||
Basic direction is set to LTR | ||
No BIDI Filtering |
Field Label
Length | Field Label | |
Short | 10 | Routine |
Medium | 20 | Routine |
Long | 40 | Routine |
Heading | 60 | Routine |
Documentation
Definition
For routines with a return table, the parameter RESULT is replaced by the return table RESULT_TABLE. The return table has the same structure as the data target. The only difference being that only one key figure (data field for ODS Objects) for which the routine was created, is filled as well as its characteristics (key figures for ODS objects).
The parameter ICUBE_VALUES also appears. The easiest way to fill the RESULT_TABLE return table is to copy the structure ICUBE_VALUES into the RESULT_TABLE table as many times as it is necessary to fill only the corresponding key figure and to adjust the characteristic values (see example below).
Note the following special case: When using a key figure routine with a return table and additional currency conversion, the currencies are NOT stored in the ICUBE_VALUES structure. This is because they are not calculated until the routine has been executed.
Caution: The system does not check the units. When using units in the routine, you need to check for inconsistencies for yourself.
Use
Dependencies
Example
The following routine shows an example for a key figure routine with a return table that calculates a sales group's revenue for individual vendors: The g_t_sales table used in the Startroutine example is used here:
PROGRAM UPDATE_ROUTINE.
*$*$ begin of global - insert your declaration only below this line
*-*
* TABLES: ...
DATA: g_t_sales LIKE /bic/msalesmng OCCURS 0.
*$*$ end of global - insert your declaration only before this line
*-*
FORM compute_key_figure
TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring
RESULT_TABLE STRUCTURE /BIC/VSALESWT
USING COMM_STRUCTURE LIKE /BI0/CSSELLING
RECORD_NO LIKE SY-TABIX
RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
ICUBE_VALUES LIKE /BIC/VSALESWT
CHANGING RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
*
*$*$ begin of routine - insert your code only below this line
*-*
* fill the internal table "MONITOR", to make monitor entries
DATA: l_s_sales LIKE /bic/msalesmng,
number TYPE i VALUE 0.
RESULT_TABLE = ICUBE_VALUES.
LOOP AT g_t_sales INTO l_s_sales
WHERE /bic/sellcentr = ICUBE_VALUES-/bic/sellcentr.
RESULT_TABLE-/bic/salesmng = l_s_sales-/bic/salesmng.
APPEND RESULT_TABLE.
number = number + 1.
ENDLOOP.
IF number = 0.
RETURNCODE = 1.
MONITOR-msgid = 'RSAU'.
MONITOR-msgty = 'W'.
MONITOR-msgno = '580'.
MONITOR-msgv1 = 'SALESMNG'.
APPEND MONITOR.
EXIT.
ENDIF.
LOOP AT RESULT_TABLE.
RESULT_TABLE-amount = COMM_STRUCTURE-amount / number.
MODIFY RESULT_TABLE.
ENDLOOP.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
*$*$ end of routine - insert your code only before this line
*-*
*
ENDFORM.
History
Last changed by/on | SAP | 20130604 |
SAP Release Created in | 30A |