Start of Content Area

This graphic is explained in the accompanying text Example: Characteristic Routine  Locate the document in its SAP Library structure

In the SAP ERP system, you are loading data using the General Ledger: Transaction Figures DataSource (0FI_GL_1) into the 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 This graphic is explained in the accompanying text 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 D or a C as the result value:

Syntax

*---------------------------------------------------------------------*

  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 if 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 loading process.

       5.      You exit the routine editor.

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

       7.      You save the transformation.

 

End of Content Area