SAP ABAP Data Element RSROUT_TRFN_INVERS (Inversion Routine)
Hierarchy
SAP_BW (Software Component) SAP Business Warehouse
   BW-WHM-DST (Application Component) Data Staging
     RSTRAN_R (Package) Transformation Runtime
Basic Data
Data Element RSROUT_TRFN_INVERS
Short Description Inversion Routine  
Data Type
Category of Dictionary Type     Direct Type Entry
Type of Object Referenced     No Information
Domain / Name of Reference Type      
Data Type CHAR   Character String 
Length 1    
Decimal Places 0    
Output Length 1    
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  
Medium  
Long  
Heading  
Documentation

Definition

Use

In the routine editor, you create an inversion routine for the routine you previously defined. This routine is required, for example, when you execute queries on VirtualProviders. In this case the inversion routine is necessary to transform the selection criteria for a navigation step into selection criteria for the extractor. The same applies if you jump to another SAP system using the report-report interface. If you do not create an inversion routine, the system selects all values.

You can create an inversion routine for all types of routine. The following rules apply:

  • With expert routines, there is no segmentation into conditions.
  • With start routines, the system performs segmentation into conditions. The system applies this to the complete source structure. The source structure is the start and end point.
  • With end routines, the target structure is the start and end point.

The inversion routine has the method invert.

Dependencies

Example

In this example, the German keys 'HERR' and 'FRAU' in the target characteristic are mapped to the English keys 'MR' and 'MRS' from the field PASSFORM (form of address) of the source. All other values from the source field are mapped to the initial value.

The coding of the routine is as follows:


*$*$ begin of routine - insert your code only below this line *-*
CASE SOURCE_FIELDS-passform.
WHEN 'HERR'. RESULT = 'MR'.
WHEN 'FRAU'. RESULT = 'MRS'.
WHEN OTHERS. RESULT = space.
ENDCASE.
*$*$ end of routine - insert your code only before this line *-*
ENDMETHOD. "compute_0PASSFORM

The corresponding inversion routine is as follows:


*$*$ begin of inversion routine - insert your code only below this line*-*
DATA l_r_set TYPE REF TO cl_rsmds_set.
IF i_r_selset_outbound->is_universal( ) EQ rsmds_c_boolean-true.
* If query requests all values for characteristic 0PASSNAME
* request also all values from source field PASSNAME
c_r_selset_inbound = cl_rsmds_set=>get_universal_set( ).
c_exact = rs_c_true. "Inversion is exact
ELSE.
TRY.
IF me->p_r_set_mrs IS INITIAL.
* Create set for condition PASSFORM = 'FRAU'
me->p_r_set_mrs = i_r_universe_inbound->create_set_from_string( 'PASSFORM = ''FRAU''' ).
ENDIF.
IF me->p_r_set_mr IS INITIAL.
* Create set for condition PASSFORM = 'HERR'
me->p_r_set_mr = i_r_universe_inbound->create_set_from_string( 'PASSFORM = ''HERR''' ).
ENDIF.
IF me->p_r_set_space IS INITIAL.
* Create set for condition NOT ( PASSFORM = 'FRAU' OR PASSFORM = 'HERR' )
l_r_set = me->p_r_set_mr->unite( me->p_r_set_mrs ).
me->p_r_set_space = l_r_set->complement( ).
ENDIF.
* Compose inbound selection
c_r_selset_inbound = cl_rsmds_set=>get_empty_set( ).
* Check if outbound selection contains value 'MR'
IF i_r_selset_outbound->contains( 'MR' ) EQ rsmds_c_boolean-true.
c_r_selset_inbound = c_r_selset_inbound->unite( me->p_r_set_mr ).
ENDIF.
* Check if outbound selection contains value 'MRS'
IF i_r_selset_outbound->contains( 'MRS' ) EQ rsmds_c_boolean-true.
c_r_selset_inbound = c_r_selset_inbound->unite( me->p_r_set_mrs ).
ENDIF.
* Check if outbound selection contains initial value
IF i_r_selset_outbound->contains( space ) EQ rsmds_c_boolean-true.
c_r_selset_inbound = c_r_selset_inbound->unite( me->p_r_set_space ).
ENDIF.
c_exact = rs_c_true. "Inversion is exact
CATCH cx_rsmds_dimension_unknown
cx_rsmds_input_invalid
cx_rsmds_sets_not_compatible
cx_rsmds_syntax_error.
* Normally, this should not occur
* If the exception occurs request all values from source
* for this routine to be on the safe side
c_r_selset_inbound = cl_rsmds_set=>get_universal_set( ).
c_exact = rs_c_false. "Inversion is no longer exact
ENDTRY.
ENDIF.
* Finally, add (optionally) further code to transform outbound projection
* to inbound projection
* Check if outbound characteristic 0PASSFORM (field name PASSFORM)
* is requested for the drilldown state of the query
READ TABLE i_th_fields_outbound
WITH TABLE KEY segid = 1 "Primary segment
fieldname = 'PASSFORM'
TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
* Characteristic 0PASSFORM is needed
* ==> request (only) field PASSFORM from the source for this routine
DELETE c_th_fields_inbound
WHERE NOT ( segid EQ 1 OR
fieldname EQ 'PASSFORM' ).
ELSE.
* Characteristic 0PASSFORM is not needed
* ==> don't request any field from source for this routine
CLEAR c_th_fields_inbound.
ENDIF.
*$*$ end of inverse routine - insert your code only before this line *-*
History
Last changed by/on SAP  20130604 
SAP Release Created in 720