Show TOC

Example: Characteristic RoutineLocate this document in the navigation structure

Use

You use DataSource General Ledger: Transaction Figures (0FI_GL_1) to load data into DataStore object FIGL: Transaction Figures (0FIGL_O06).

You want to create a routine for the characteristic Debit/Credit Indicator (0FI_DBCRIND) in the target that assigns the value D to debit postings and the value C to credit postings.

  1. You are in transformation maintenance. In the rule group, you double click on InfoObject Debit/Credit Indicator (0FI_DBCRIND). The rule details screen appears.

  2. You choose Add Source Fields and add the Total Debit Postings (UMSOL) and Total Credit Postings (UMHAB) fields so that they are available in the routine.

  3. You choose Routine as the rule type. The routine editor opens.

  4. You enter the following lines of code. They return either a D or a C as the result value:

    Sample Code
    *---------------------------------------------------------------------*
    
      METHOD compute_0FI_DBCRIND.
    
        DATA:
          MONITOR_REC    TYPE rsmonitor.
    
    *$*$ begin of routine - insert your code only below this line        *-* 
    
    *    result value of the routine
        if SOURCE_FIELDS-umhab ne 0 and SOURCE_FIELDS-umsol eq 0.
          RESULT = 'D'.
        elseif SOURCE_FIELDS-umhab eq 0 and SOURCE_FIELDS-umsol ne 0.
          RESULT = 'C'.
        else.
          monitor_rec-msgid = 'ZMESSAGE'.
          monitor_rec-msgty = 'E'.
          monitor_rec-msgno = '001'.
          monitor_rec-msgv1 = 'ERROR, D/C Indicator'.
          monitor_rec-msgv2 = SOURCE_FIELDS-umhab.
          monitor_rec-msgv3 = SOURCE_FIELDS-umsol.
          append monitor_rec to monitor.
          RAISE EXCEPTION TYPE CX_RSROUT_ABORT.
        endif.
    
    *$*$ end of routine - insert your code only before this line         *-*
      ENDMETHOD.                    "compute_0FI_DBCRIND
    *---------------------------------------------------------------------*
    
    

    The system checks whether the debit and credit postings contain values:

    • If the debit posting has values that are not equal to zero and the credit posting is equal to zero, the system assigns the value D.

    • If the credit posting has values that are not equal to zero and the debit posting is equal to zero, the system assigns the value C.

    • If both the debit and credit postings contain values, the system outputs an error in the monitor and terminates the load process.

  5. You quit the routine editor.

  6. In the Rule Details dialog box, choose Transfer Values.

  7. You save the transformation.