SAP ABAP Data Element RSCVTRTTXTLG (Routine in conversion rules)
Hierarchy
SAP_BW (Software Component) SAP Business Warehouse
   BW-WHM-DST (Application Component) Data Staging
     RSAR (Package) Data import from source system
Basic Data
Data Element RSCVTRTTXTLG
Short Description Routine in conversion rules  
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

Complex transfer rules for InfoSources are defined with the help of routines.

Routines are ABAP programs consisting of a predefined global data declaration part, and an ABAP form routine. All of the ABAP programming functions are available in the form routine.

Procedure

After calling up the editor for maintaining the routine, you get the following program framework:

program conversion_routine.


*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
*$*$ end of global - insert your declaration only before this line *-*
*
FORM COMPUTE_<InfoObject>
USING RECORD_NO LIKE SY-TABIX
TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
CHANGING RESULT LIKE <Datatype of InfoObject>
G_T_ERRORLOG TYPE RSSM_T_ERRORLOG_INT
RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC.
*$*$ begin of routine - insert your code only below this line *-*

RESULT = .

RETURNCODE = 0.
ABORT = 0.

*$*$ end of routine - insert your code only before this line *-*
ENDFORM.
...

FORM INVERT_<InfoObject>
USING I_RT_CHAVL_CS TYPE RSARC_RT_CHAVL
I_THX_SELECTION_CS TYPE RSARC_THX_SELCS
CHANGING C_T_SELECTION TYPE SBIWA_T_SELECT
E_EXACT TYPE RS_BOOL.
*$*$ begin of inverse routine - insert your code only below this line*-*

DATA:
L_S_SELECTION LIKE LINE OF C_T_SELECTION.

* An empty selection means all values
CLEAR C_T_SELECTION.

L_S_SELECTION-FIELDNM = '<fieldname>'.
* ...

* Selection of all values may be not exact
E_EXACT = RS_C_FALSE.

*$*$ end of inverse routine - insert your code only before this line*-*
ENDFORM.

Remark:
The fields indicated with <...> are dependent on the transfer structure and the communication structure, and are automatically filled by the system when you call up the editor.

Make the following entries:

  1. Global data declarations
    Between *$*$ begin of global ... and *$*$ end of global ... you can define global data declarations that are then available in all routines.
    You can use subtotals in other routines, for example, or reuse the results of the first call up when you call up the same routine again.
  2. The Form routine has the following parameters:
    • TRAN_STRUCTURE
    • In the variable TRAN_STRUCTURE, the routine for the contents of the record that you want to convert, is available in the transfer structure format.
    • RECORD_NO
      In the variable RECORD_NO the number of the record that is currently being processed is available.
    • RESULT
    • You must assign the result of the conversion to the variable RESULT.
    • RETURNCODE
    • Using the variable RETURNCODE you report the error to the conversion program. RETURNCODE <> 0 means there is a calculation error, meaning the processing of the current data packet will be terminated.
    • ABORT
    • With the variable ABORT you report the errors to the conversion program. ABORT <> 0 means there is a serious prosessing error that will terminate the processing of the current data packet completely.
  3. Insert your program code for the routine between *$*$ begin of routine ... and *$*$ end of routine ..., so that the variables RETURN, RETURNCODE and ABORT are supplied with the corresponding values.
  4. With characteristics, you have the option of implementing a Form routine to reverse the transfer described above. This routine is required when you execute queries on SAP RemoteCubes, to transform the selection criteria of a navigation step into selection criteria for the extrator. The routine has the following paramters:
    • I_RT_CHAVL_CS
    • The parameter contains the selection criteria of all the characteristics in the form of an Selection table.
    • I_THX_SELECTION_CS
    • The parameter contains the selection criteria for all the characteristics in the form of a hash table using Selektionstabellen for the individual characteristics. You require this parameter only if the reversal is dependent on the selection criteria of other characteristics. You get the selection criteria for a particular characteristic with the instruction


DATA L_SX_SELECTION_CS LIKE LINE OF I_THX_SELECTION_CS.
READ TABLE I_THX_SELECTION_CS INTO L_SX_SELECTION_CS
WITH TABLE KEY CHANM = '...'.
The structure L_SX_SELECTION_CS contains the Selection table you want in the component RT_CHAVL.
  • C_T_SELECTION
  • In this table parameter, you have to return the transformed selection criteria. The table has the same structure as a Selection table, but also contains in addition, the field names in the component FIELDNM. If an empty table is returned for this parameter, this means a selection for for all the values for the fields used in the transfer routine. If an exact reversal is not possible, you can return the total of all the exact selection criteria. If in doubt, this is the selection of all values that are specified by default when creating a new transfer routine.
  • E_EXACT
  • This indicator determines whether the transformation of the selection criteria has been carried out exactly (constant RS_C_TRUE) or not (constant RS_C_FALSE).

  1. Insert your program code for the reversal of the transfer routine between *$*$ begin of inverse routine ... and *$*$ end of inverse routine ... so that the variables C_T_SELECTION and E_EXACT are supplied with the corresponding values.
  2. Check the syntax of your routine with the Check function. Transfer the routine using the Save function. When you leave the editor, the maintenance for the routine is completed.

Example

The following routine gives you an example of a transfer routine that determines the calendar year (InfoObject 0CALYEAR) from the transfered flight date (field FLDATE):

...


FORM COMPUTE_CALYEAR
USING RECORD_NO LIKE SY-TABIX
TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
CHANGING RESULT LIKE /BI0/CSSFLIGHT-CALYEAR
G_T_ERRORLOG TYPE RSSM_T_ERRORLOG_INT
RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC.
*$*$ begin of routine - insert your code only below this line *-*
RESULT = TRAN_STRUCTURE-FLDATE(4). "assuming date format YYYYMMDD
RETURNCODE = 0.
ABORT = 0.
*$*$ end of routine - insert your code only before this line *-*
ENDFORM.

The routine for the reversal might look something like the following:


FORM INVERT_CALYEAR
USING I_RT_CHAVL_CS TYPE RSARC_RT_CHAVL
I_THX_SELECTION_CS TYPE RSARC_THX_SELCS
CHANGING C_T_SELECTION TYPE SBIWA_T_SELECT
E_EXACT TYPE RS_BOOL.
*$*$ begin of inverse routine - insert your code only below this line*-*
DATA:
L_S_SELECTION LIKE LINE OF C_T_SELECTION.
FIELD-SYMBOLS:
<L_RS_CHAVL> LIKE LINE OF I_RT_CHAVL_CS.

* An empty selection means all values
CLEAR C_T_SELECTION.

* Transform selections of calender year to selections of flight date
L_S_SELECTION-FIELDNM = 'FLDATE'.
* Loop at selections of calender year
LOOP AT I_RT_CHAVL_CS ASSIGNING <L_RS_CHAVL>.
MOVE-CORRESPONDING <L_RS_CHAVL> TO L_S_SELECTION.
* Transform options
CASE L_S_SELECTION-OPTION.
WHEN 'EQ'. &#x
History
Last changed by/on SAP  20130604 
SAP Release Created in