1 Reply Latest reply: Jun 30, 2007 1:33 AM by Srikanth voodi RSS

Check Routines III

Beekay B
Currently Being Moderated

Can any one please check the below two routine, if its fine with BI 7.0.

Please advise how and what to add or modify.

I have total 6 in total so will post 2 in each thread.

 

<u><b>Routine 5</b></u>

 

 

 

PROGRAM trans_routine.

 

 

----


  •       CLASS routine DEFINITION

----


*

----


CLASS lcl_transform DEFINITION.

  PUBLIC SECTION.

 

  • Attributs

    DATA:

      p_check_master_data_exist

            TYPE RSODSOCHECKONLY READ-ONLY,

*-    Instance for getting request runtime attributs;

  •     Available information: Refer to methods of

  •     interface 'if_rsbk_request_admintab_view'

      p_r_request

            TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.

 

  PRIVATE SECTION.

 

    TYPE-POOLS: rsd, rstr.

 

  •   Rule specific types

    TYPES:

      BEGIN OF tys_SC_1,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0DSCT_DATE2 Due date for cash discount 2.

        DSCT_DATE2           TYPE /BI0/OIDSCT_DATE2,

  •      InfoObject: 0DSCT_PCT1 Percentage for Cash Discount 1.

        DSCT_PCT1           TYPE /BI0/OIDSCT_PCT1,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1.

    TYPES:

      BEGIN OF tys_TG_1,

  •      InfoObject: 0INT_CALCT2 Interest Calculation Numerator Days 2 (Re

*alized).

        INT_CALCT2           TYPE /BI0/OIINT_CALCT2,

      END   OF tys_TG_1.

 

$$ begin of global - insert your declaration only below this line  -

... "insert your code here

$$ end of global - insert your declaration only before this line   -

 

    METHODS

      compute_0INT_CALCT2

        IMPORTING

          request                  type rsrequest

          datapackid               type rsdatapid

          SOURCE_FIELDS              type tys_SC_1

        EXPORTING

          RESULT                   type tys_TG_1-INT_CALCT2

          monitor                  type rstr_ty_t_monitor

        RAISING

          cx_rsrout_abort

          cx_rsrout_skip_record

          cx_rsrout_skip_val.

    METHODS

      invert_0INT_CALCT2

        IMPORTING

          i_th_fields_outbound         TYPE rstran_t_field_inv

          i_r_selset_outbound          TYPE REF TO cl_rsmds_set

          i_is_main_selection          TYPE rs_bool

          i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set

          i_r_universe_inbound         TYPE REF TO cl_rsmds_universe

        CHANGING

          c_th_fields_inbound          TYPE rstran_t_field_inv

          c_r_selset_inbound           TYPE REF TO cl_rsmds_set

          c_exact                      TYPE rs_bool.

ENDCLASS.                    "routine DEFINITION

 

$$ begin of 2nd part global - insert your code only below this line  *

$$ end of rule type

    TYPES:

      BEGIN OF tys_TG_1_full,

  •      InfoObject: 0CHNGID Change Run ID.

        CHNGID           TYPE /BI0/OICHNGID,

  •      InfoObject: 0RECORDTP Record type.

        RECORDTP           TYPE /BI0/OIRECORDTP,

  •      InfoObject: 0REQUID Request ID.

        REQUID           TYPE /BI0/OIREQUID,

  •      InfoObject: 0FISCPER Fiscal year / period.

        FISCPER           TYPE /BI0/OIFISCPER,

  •      InfoObject: 0FISCVARNT Fiscal year variant.

        FISCVARNT           TYPE /BI0/OIFISCVARNT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0AC_DOC_TYP Document type.

        AC_DOC_TYP           TYPE /BI0/OIAC_DOC_TYP,

  •      InfoObject: 0DOC_DATE Document Date.

        DOC_DATE           TYPE /BI0/OIDOC_DATE,

  •      InfoObject: 0POST_KEY Posting key.

        POST_KEY           TYPE /BI0/OIPOST_KEY,

  •      InfoObject: 0COMP_CODE Company code.

        COMP_CODE           TYPE /BI0/OICOMP_CODE,

  •      InfoObject: 0GL_ACCOUNT G/L Account.

        GL_ACCOUNT           TYPE /BI0/OIGL_ACCOUNT,

  •      InfoObject: 0C_CTR_AREA Credit Control Area.

        C_CTR_AREA           TYPE /BI0/OIC_CTR_AREA,

  •      InfoObject: 0DUNN_AREA Dunning area.

        DUNN_AREA           TYPE /BI0/OIDUNN_AREA,

  •      InfoObject: 0LAST_DUNN Date of last dunning notice.

        LAST_DUNN           TYPE /BI0/OILAST_DUNN,

  •      InfoObject: 0DUNN_BLOCK Dunning block.

        DUNN_BLOCK           TYPE /BI0/OIDUNN_BLOCK,

  •      InfoObject: 0DUNN_LEVEL Dunning level.

        DUNN_LEVEL           TYPE /BI0/OIDUNN_LEVEL,

  •      InfoObject: 0DUNN_KEY Dunning key.

        DUNN_KEY           TYPE /BI0/OIDUNN_KEY,

  •      InfoObject: 0NETDUEDATE Due date for net payment.

        NETDUEDATE           TYPE /BI0/OINETDUEDATE,

  •      InfoObject: 0REASON_CDE Reason code for payments.

        REASON_CDE           TYPE /BI0/OIREASON_CDE,

  •      InfoObject: 0DSCT_DATE1 Due date for cash discount 1.

        DSCT_DATE1           TYPE /BI0/OIDSCT_DATE1,

  •      InfoObject: 0DSCT_DATE2 Due date for cash discount 2.

        DSCT_DATE2           TYPE /BI0/OIDSCT_DATE2,

  •      InfoObject: 0SP_GL_IND Special G/L indicator.

        SP_GL_IND           TYPE /BI0/OISP_GL_IND,

  •      InfoObject: 0BLINE_DATE Baseline Date For Due Date Calculation.

        BLINE_DATE           TYPE /BI0/OIBLINE_DATE,

  •      InfoObject: 0PYMT_METH Payment method.

        PYMT_METH           TYPE /BI0/OIPYMT_METH,

  •      InfoObject: 0PMNT_BLOCK Payment block key.

        PMNT_BLOCK           TYPE /BI0/OIPMNT_BLOCK,

  •      InfoObject: 0PMNTTRMS Terms of Payment Key.

        PMNTTRMS           TYPE /BI0/OIPMNTTRMS,

  •      InfoObject: 0CHRT_ACCTS Chart of accounts.

        CHRT_ACCTS           TYPE /BI0/OICHRT_ACCTS,

  •      InfoObject: 0ACCT_TYPE Account type.

        ACCT_TYPE           TYPE /BI0/OIACCT_TYPE,

  •      InfoObject: 0COUNTRY Country key.

        COUNTRY           TYPE /BI0/OICOUNTRY,

  •      InfoObject: 0DEBITOR Customer number.

        DEBITOR           TYPE /BI0/OIDEBITOR,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0FI_SUBSID Account Number of the Branch.

        FI_SUBSID           TYPE /BI0/OIFI_SUBSID,

  •      InfoObject: 0PSTNG_DATE Posting date in the document.

        PSTNG_DATE           TYPE /BI0/OIPSTNG_DATE,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DISC_BASE Amount eligible for cash discount in docum

*ent currency.

        DISC_BASE           TYPE /BI0/OIDISC_BASE,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0DEB_CRE_DC Foreign currency amount with signs (+/-).

        DEB_CRE_DC           TYPE /BI0/OIDEB_CRE_DC,

  •      InfoObject: 0DSC_AMT_DC Cash discount amount in document currency

*.

        DSC_AMT_DC           TYPE /BI0/OIDSC_AMT_DC,

  •      InfoObject: 0CREDIT_DC Credit amount in foreign currency.

        CREDIT_DC           TYPE /BI0/OICREDIT_DC,

  •      InfoObject: 0CREDIT_LC Credit amount in local currency.

        CREDIT_LC           TYPE /BI0/OICREDIT_LC,

  •      InfoObject: 0DEBIT_DC Debit amount in foreign currency.

        DEBIT_DC           TYPE /BI0/OIDEBIT_DC,

  •      InfoObject: 0DEBIT_LC Debit amount in local currency.

        DEBIT_LC           TYPE /BI0/OIDEBIT_LC,

  •      InfoObject: 0NETTAKEN Net period used.

        NETTAKEN           TYPE /BI0/OINETTAKEN,

  •      InfoObject: 0INT_CALC_1 Interest Calculation Numerator Days 1 (Ag

*reed).

        INT_CALC_1           TYPE /BI0/OIINT_CALC_1,

  •      InfoObject: 0INT_CALC_2 Interest calculation numerator days 2 (ag

*reed).

        INT_CALC_2           TYPE /BI0/OIINT_CALC_2,

  •      InfoObject: 0INT_CALC_N Interest Calculation Numerator Net (Agree

*d).

        INT_CALC_N           TYPE /BI0/OIINT_CALC_N,

  •      InfoObject: 0INT_CALCT1 Interest Calculation Numerator Days 1 (Re

*alized).

        INT_CALCT1           TYPE /BI0/OIINT_CALCT1,

  •      InfoObject: 0INT_CALCT2 Interest Calculation Numerator Days 2 (Re

*alized).

        INT_CALCT2           TYPE /BI0/OIINT_CALCT2,

  •      InfoObject: 0INT_CALCTN Interest Calculation Numerator Net (Reali

*zed).

        INT_CALCTN           TYPE /BI0/OIINT_CALCTN,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

  •      InfoObject: 0DOC_CURRCY Document currency.

        DOC_CURRCY           TYPE /BI0/OIDOC_CURRCY,

  •      Field: RECORD Data record number.

        RECORD           TYPE RSARECORD,

      END   OF tys_TG_1_full.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_40,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0NETDUEDATE Due date for net payment.

        NETDUEDATE           TYPE /BI0/OINETDUEDATE,

      END   OF tys_SC_1__RULE_40.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_41,

  •      InfoObject: 0DSCT_DAYS1 Days for Cash Discount 1.

        DSCT_DAYS1           TYPE /BI0/OIDSCT_DAYS1,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_41.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_42,

  •      InfoObject: 0DSCT_DAYS2 Days for Second Cash Discount.

        DSCT_DAYS2           TYPE /BI0/OIDSCT_DAYS2,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_42.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_43,

  •      InfoObject: 0NETTERMS Deadline for Net Conditions.

        NETTERMS           TYPE /BI0/OINETTERMS,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_43.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_44,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0DSCT_DATE1 Due date for cash discount 1.

        DSCT_DATE1           TYPE /BI0/OIDSCT_DATE1,

  •      InfoObject: 0DSCT_PCT1 Percentage for Cash Discount 1.

        DSCT_PCT1           TYPE /BI0/OIDSCT_PCT1,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_44.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_45,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0DSCT_DATE2 Due date for cash discount 2.

        DSCT_DATE2           TYPE /BI0/OIDSCT_DATE2,

  •      InfoObject: 0DSCT_PCT1 Percentage for Cash Discount 1.

        DSCT_PCT1           TYPE /BI0/OIDSCT_PCT1,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_45.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_46,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0NETDUEDATE Due date for net payment.

        NETDUEDATE           TYPE /BI0/OINETDUEDATE,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_46.

 

  • Additional declaration for update rule interface

  DATA:

    MONITOR       type standard table of rsmonitor  WITH HEADER LINE,

    MONITOR_RECNO type standard table of rsmonitors WITH HEADER LINE,

    RECORD_NO     LIKE SY-TABIX,

    RECORD_ALL    LIKE SY-TABIX,

    SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS.

 

 

  • global definitions from update rules

  • TABLES: ...

  • DATA:   ...

 

FORM routine_0001

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_40

  CHANGING

    RESULT         TYPE tys_TG_1_full-NETTAKEN

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  IF COMM_STRUCTURE-FI_DOCSTAT EQ 'C'.

     RESULT = COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-NETDUEDATE.

  ELSE.

     RESULT = 0.

  endif.

  • 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.

 

 

ENDFORM.                    "routine_0001

 

FORM routine_0002

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_41

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALC_1

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-DSCT_DAYS1 / 100.

  • 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.

 

 

ENDFORM.                    "routine_0002

 

FORM routine_0003

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_42

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALC_2

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-DSCT_DAYS2 / 100.

  • UNIT = COMM_STRUCTURE-LOC_CURRCY.

  • 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.

 

 

ENDFORM.                    "routine_0003

 

FORM routine_0004

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_43

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALC_N

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-NETTERMS / 100.

  • 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.

 

 

ENDFORM.                    "routine_0004

 

FORM routine_0005

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_44

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALCT1

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  DATA:    DSCT1 LIKE COMM_STRUCTURE-DEB_CRE_LC.

 

  DSCT1 = COMM_STRUCTURE-DSCT_PCT1 * COMM_STRUCTURE-DEB_CRE_LC / 100.

  DSCT1 = DSCT1 / 10 * 9.

  IF COMM_STRUCTURE-DSC_AMT_LC >= DSCT1 AND

     COMM_STRUCTURE-FI_DOCSTAT EQ 'C'.

    RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-DSCT_DATE1 ).

    RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.

  ELSE.

    RESULT = 0.

  ENDIF.

  • 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.

 

 

ENDFORM.                    "routine_0005

 

FORM routine_0006

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_45

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALCT2

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  DATA:    DSCT1 LIKE COMM_STRUCTURE-DEB_CRE_LC.

 

  DSCT1 = COMM_STRUCTURE-DSCT_PCT1 * COMM_STRUCTURE-DEB_CRE_LC / 100.

  DSCT1 = DSCT1 / 10 * 9.

  IF COMM_STRUCTURE-DSC_AMT_LC < DSCT1 AND

     COMM_STRUCTURE-DSC_AMT_LC > 0     AND

     COMM_STRUCTURE-FI_DOCSTAT = 'C'.

     RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-DSCT_DATE2 ).

     RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.

  ELSE.

     RESULT = 0.

  ENDIF.

  • 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.

 

 

ENDFORM.                    "routine_0006

 

FORM routine_0007

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_46

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALCTN

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  IF COMM_STRUCTURE-DSC_AMT_LC = 0 AND

     COMM_STRUCTURE-FI_DOCSTAT = 'C'.

     RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-NETDUEDATE ).

     RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.

  ELSE.

     RESULT = 0.

  ENDIF.

  • 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.

 

 

ENDFORM.                    "routine_0007

 

$$ end of 2nd part global - insert your code only before this line   *

 

----


  •       CLASS routine IMPLEMENTATION

----


*

----


CLASS lcl_transform IMPLEMENTATION.

 

  METHOD compute_0INT_CALCT2.

 

  •   IMPORTING

  •     request     type rsrequest

  •     datapackid  type rsdatapid

  •     SOURCE_FIELDS-FI_DOCSTAT TYPE /BI0/OIFI_DOCSTAT

  •     SOURCE_FIELDS-CLEAR_DATE TYPE /BI0/OICLEAR_DATE

  •     SOURCE_FIELDS-DSCT_DATE2 TYPE /BI0/OIDSCT_DATE2

  •     SOURCE_FIELDS-DSCT_PCT1 TYPE /BI0/OIDSCT_PCT1

  •     SOURCE_FIELDS-DEB_CRE_LC TYPE /BI0/OIDEB_CRE_LC

  •     SOURCE_FIELDS-DSC_AMT_LC TYPE /BI0/OIDSC_AMT_LC

  •     SOURCE_FIELDS-LOC_CURRCY TYPE /BI0/OILOC_CURRCY

  •    EXPORTING

  •      RESULT type tys_TG_1-INT_CALCT2

 

    DATA:

      MONITOR_REC    TYPE rsmonitor.

 

*$*$ begin of routine - insert your code only below this line        *-*

  Data:

*--

    COMM_STRUCTURE   type tys_SC_1__RULE_45,

    l_subrc          type sy-tabix,

    l_abort          type sy-tabix,

    ls_monitor       TYPE rsmonitor,

    ls_monitor_recno TYPE rsmonitors.

 

  REFRESH:

    MONITOR.

 

  • Runtime attributs

    SOURCE_SYSTEM  = p_r_request->get_logsys( ).

    MOVE-CORRESPONDING SOURCE_FIELDS to COMM_STRUCTURE.

 

  • Migrated update rule call

  Perform routine_0006

  USING

    COMM_STRUCTURE

  CHANGING

    RESULT

    l_subrc

    l_abort.

 

*-- Convert Messages in Transformation format

    LOOP AT MONITOR INTO ls_monitor.

      move-CORRESPONDING ls_monitor to MONITOR_REC.

      append monitor_rec to MONITOR.

    ENDLOOP.

    IF l_subrc <> 0.

      RAISE EXCEPTION TYPE cx_rsrout_skip_val.

    ENDIF.

    IF l_abort <> 0.

      RAISE EXCEPTION TYPE CX_RSROUT_ABORT.

    ENDIF.

 

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

  ENDMETHOD.                    "compute_0INT_CALCT2

----


  •       Method invert_0INT_CALCT2

----


*

  •       This subroutine needs to be implemented only for direct access

  •       (for better performance) and for the Report/Report Interface

  •       (drill through).

  •       The inverse routine should transform a projection and

  •       a selection for the target to a projection and a selection

  •       for the source, respectively.

  •       If the implementation remains empty all fields are filled and

  •       all values are selected.

*

----


*

----


  METHOD invert_0INT_CALCT2.

 

$$ begin of inverse routine - insert your code only below this line-

... "insert your code here

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

 

  ENDMETHOD.                    "invert_0INT_CALCT2

ENDCLASS.                    "routine IMPLEMENTATION

 

 

<u><b>Routine 6</b></u>

 

 

 

PROGRAM trans_routine.

 

 

----


  •       CLASS routine DEFINITION

----


*

----


CLASS lcl_transform DEFINITION.

  PUBLIC SECTION.

 

  • Attributs

    DATA:

      p_check_master_data_exist

            TYPE RSODSOCHECKONLY READ-ONLY,

*-    Instance for getting request runtime attributs;

  •     Available information: Refer to methods of

  •     interface 'if_rsbk_request_admintab_view'

      p_r_request

            TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.

 

  PRIVATE SECTION.

 

    TYPE-POOLS: rsd, rstr.

 

  •   Rule specific types

    TYPES:

      BEGIN OF tys_SC_1,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0NETDUEDATE Due date for net payment.

        NETDUEDATE           TYPE /BI0/OINETDUEDATE,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1.

    TYPES:

      BEGIN OF tys_TG_1,

  •      InfoObject: 0INT_CALCTN Interest Calculation Numerator Net (Reali

*zed).

        INT_CALCTN           TYPE /BI0/OIINT_CALCTN,

      END   OF tys_TG_1.

 

$$ begin of global - insert your declaration only below this line  -

... "insert your code here

$$ end of global - insert your declaration only before this line   -

 

    METHODS

      compute_0INT_CALCTN

        IMPORTING

          request                  type rsrequest

          datapackid               type rsdatapid

          SOURCE_FIELDS              type tys_SC_1

        EXPORTING

          RESULT                   type tys_TG_1-INT_CALCTN

          monitor                  type rstr_ty_t_monitor

        RAISING

          cx_rsrout_abort

          cx_rsrout_skip_record

          cx_rsrout_skip_val.

    METHODS

      invert_0INT_CALCTN

        IMPORTING

          i_th_fields_outbound         TYPE rstran_t_field_inv

          i_r_selset_outbound          TYPE REF TO cl_rsmds_set

          i_is_main_selection          TYPE rs_bool

          i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set

          i_r_universe_inbound         TYPE REF TO cl_rsmds_universe

        CHANGING

          c_th_fields_inbound          TYPE rstran_t_field_inv

          c_r_selset_inbound           TYPE REF TO cl_rsmds_set

          c_exact                      TYPE rs_bool.

ENDCLASS.                    "routine DEFINITION

 

$$ begin of 2nd part global - insert your code only below this line  *

$$ end of rule type

    TYPES:

      BEGIN OF tys_TG_1_full,

  •      InfoObject: 0CHNGID Change Run ID.

        CHNGID           TYPE /BI0/OICHNGID,

  •      InfoObject: 0RECORDTP Record type.

        RECORDTP           TYPE /BI0/OIRECORDTP,

  •      InfoObject: 0REQUID Request ID.

        REQUID           TYPE /BI0/OIREQUID,

  •      InfoObject: 0FISCPER Fiscal year / period.

        FISCPER           TYPE /BI0/OIFISCPER,

  •      InfoObject: 0FISCVARNT Fiscal year variant.

        FISCVARNT           TYPE /BI0/OIFISCVARNT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0AC_DOC_TYP Document type.

        AC_DOC_TYP           TYPE /BI0/OIAC_DOC_TYP,

  •      InfoObject: 0DOC_DATE Document Date.

        DOC_DATE           TYPE /BI0/OIDOC_DATE,

  •      InfoObject: 0POST_KEY Posting key.

        POST_KEY           TYPE /BI0/OIPOST_KEY,

  •      InfoObject: 0COMP_CODE Company code.

        COMP_CODE           TYPE /BI0/OICOMP_CODE,

  •      InfoObject: 0GL_ACCOUNT G/L Account.

        GL_ACCOUNT           TYPE /BI0/OIGL_ACCOUNT,

  •      InfoObject: 0C_CTR_AREA Credit Control Area.

        C_CTR_AREA           TYPE /BI0/OIC_CTR_AREA,

  •      InfoObject: 0DUNN_AREA Dunning area.

        DUNN_AREA           TYPE /BI0/OIDUNN_AREA,

  •      InfoObject: 0LAST_DUNN Date of last dunning notice.

        LAST_DUNN           TYPE /BI0/OILAST_DUNN,

  •      InfoObject: 0DUNN_BLOCK Dunning block.

        DUNN_BLOCK           TYPE /BI0/OIDUNN_BLOCK,

  •      InfoObject: 0DUNN_LEVEL Dunning level.

        DUNN_LEVEL           TYPE /BI0/OIDUNN_LEVEL,

  •      InfoObject: 0DUNN_KEY Dunning key.

        DUNN_KEY           TYPE /BI0/OIDUNN_KEY,

  •      InfoObject: 0NETDUEDATE Due date for net payment.

        NETDUEDATE           TYPE /BI0/OINETDUEDATE,

  •      InfoObject: 0REASON_CDE Reason code for payments.

        REASON_CDE           TYPE /BI0/OIREASON_CDE,

  •      InfoObject: 0DSCT_DATE1 Due date for cash discount 1.

        DSCT_DATE1           TYPE /BI0/OIDSCT_DATE1,

  •      InfoObject: 0DSCT_DATE2 Due date for cash discount 2.

        DSCT_DATE2           TYPE /BI0/OIDSCT_DATE2,

  •      InfoObject: 0SP_GL_IND Special G/L indicator.

        SP_GL_IND           TYPE /BI0/OISP_GL_IND,

  •      InfoObject: 0BLINE_DATE Baseline Date For Due Date Calculation.

        BLINE_DATE           TYPE /BI0/OIBLINE_DATE,

  •      InfoObject: 0PYMT_METH Payment method.

        PYMT_METH           TYPE /BI0/OIPYMT_METH,

  •      InfoObject: 0PMNT_BLOCK Payment block key.

        PMNT_BLOCK           TYPE /BI0/OIPMNT_BLOCK,

  •      InfoObject: 0PMNTTRMS Terms of Payment Key.

        PMNTTRMS           TYPE /BI0/OIPMNTTRMS,

  •      InfoObject: 0CHRT_ACCTS Chart of accounts.

        CHRT_ACCTS           TYPE /BI0/OICHRT_ACCTS,

  •      InfoObject: 0ACCT_TYPE Account type.

        ACCT_TYPE           TYPE /BI0/OIACCT_TYPE,

  •      InfoObject: 0COUNTRY Country key.

        COUNTRY           TYPE /BI0/OICOUNTRY,

  •      InfoObject: 0DEBITOR Customer number.

        DEBITOR           TYPE /BI0/OIDEBITOR,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0FI_SUBSID Account Number of the Branch.

        FI_SUBSID           TYPE /BI0/OIFI_SUBSID,

  •      InfoObject: 0PSTNG_DATE Posting date in the document.

        PSTNG_DATE           TYPE /BI0/OIPSTNG_DATE,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DISC_BASE Amount eligible for cash discount in docum

*ent currency.

        DISC_BASE           TYPE /BI0/OIDISC_BASE,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0DEB_CRE_DC Foreign currency amount with signs (+/-).

        DEB_CRE_DC           TYPE /BI0/OIDEB_CRE_DC,

  •      InfoObject: 0DSC_AMT_DC Cash discount amount in document currency

*.

        DSC_AMT_DC           TYPE /BI0/OIDSC_AMT_DC,

  •      InfoObject: 0CREDIT_DC Credit amount in foreign currency.

        CREDIT_DC           TYPE /BI0/OICREDIT_DC,

  •      InfoObject: 0CREDIT_LC Credit amount in local currency.

        CREDIT_LC           TYPE /BI0/OICREDIT_LC,

  •      InfoObject: 0DEBIT_DC Debit amount in foreign currency.

        DEBIT_DC           TYPE /BI0/OIDEBIT_DC,

  •      InfoObject: 0DEBIT_LC Debit amount in local currency.

        DEBIT_LC           TYPE /BI0/OIDEBIT_LC,

  •      InfoObject: 0NETTAKEN Net period used.

        NETTAKEN           TYPE /BI0/OINETTAKEN,

  •      InfoObject: 0INT_CALC_1 Interest Calculation Numerator Days 1 (Ag

*reed).

        INT_CALC_1           TYPE /BI0/OIINT_CALC_1,

  •      InfoObject: 0INT_CALC_2 Interest calculation numerator days 2 (ag

*reed).

        INT_CALC_2           TYPE /BI0/OIINT_CALC_2,

  •      InfoObject: 0INT_CALC_N Interest Calculation Numerator Net (Agree

*d).

        INT_CALC_N           TYPE /BI0/OIINT_CALC_N,

  •      InfoObject: 0INT_CALCT1 Interest Calculation Numerator Days 1 (Re

*alized).

        INT_CALCT1           TYPE /BI0/OIINT_CALCT1,

  •      InfoObject: 0INT_CALCT2 Interest Calculation Numerator Days 2 (Re

*alized).

        INT_CALCT2           TYPE /BI0/OIINT_CALCT2,

  •      InfoObject: 0INT_CALCTN Interest Calculation Numerator Net (Reali

*zed).

        INT_CALCTN           TYPE /BI0/OIINT_CALCTN,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

  •      InfoObject: 0DOC_CURRCY Document currency.

        DOC_CURRCY           TYPE /BI0/OIDOC_CURRCY,

  •      Field: RECORD Data record number.

        RECORD           TYPE RSARECORD,

      END   OF tys_TG_1_full.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_40,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0NETDUEDATE Due date for net payment.

        NETDUEDATE           TYPE /BI0/OINETDUEDATE,

      END   OF tys_SC_1__RULE_40.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_41,

  •      InfoObject: 0DSCT_DAYS1 Days for Cash Discount 1.

        DSCT_DAYS1           TYPE /BI0/OIDSCT_DAYS1,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_41.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_42,

  •      InfoObject: 0DSCT_DAYS2 Days for Second Cash Discount.

        DSCT_DAYS2           TYPE /BI0/OIDSCT_DAYS2,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_42.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_43,

  •      InfoObject: 0NETTERMS Deadline for Net Conditions.

        NETTERMS           TYPE /BI0/OINETTERMS,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_43.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_44,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0DSCT_DATE1 Due date for cash discount 1.

        DSCT_DATE1           TYPE /BI0/OIDSCT_DATE1,

  •      InfoObject: 0DSCT_PCT1 Percentage for Cash Discount 1.

        DSCT_PCT1           TYPE /BI0/OIDSCT_PCT1,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_44.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_45,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0DSCT_DATE2 Due date for cash discount 2.

        DSCT_DATE2           TYPE /BI0/OIDSCT_DATE2,

  •      InfoObject: 0DSCT_PCT1 Percentage for Cash Discount 1.

        DSCT_PCT1           TYPE /BI0/OIDSCT_PCT1,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_45.

 

    TYPES:

      BEGIN OF tys_SC_1__RULE_46,

  •      InfoObject: 0FI_DOCSTAT Item Status.

        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,

  •      InfoObject: 0CLEAR_DATE Clearing date.

        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,

  •      InfoObject: 0NETDUEDATE Due date for net payment.

        NETDUEDATE           TYPE /BI0/OINETDUEDATE,

  •      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.

        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,

  •      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.

        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,

  •      InfoObject: 0LOC_CURRCY Local currency.

        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,

      END   OF tys_SC_1__RULE_46.

 

  • Additional declaration for update rule interface

  DATA:

    MONITOR       type standard table of rsmonitor  WITH HEADER LINE,

    MONITOR_RECNO type standard table of rsmonitors WITH HEADER LINE,

    RECORD_NO     LIKE SY-TABIX,

    RECORD_ALL    LIKE SY-TABIX,

    SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS.

 

 

  • global definitions from update rules

  • TABLES: ...

  • DATA:   ...

 

FORM routine_0001

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_40

  CHANGING

    RESULT         TYPE tys_TG_1_full-NETTAKEN

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  IF COMM_STRUCTURE-FI_DOCSTAT EQ 'C'.

     RESULT = COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-NETDUEDATE.

  ELSE.

     RESULT = 0.

  endif.

  • 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.

 

 

ENDFORM.                    "routine_0001

 

FORM routine_0002

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_41

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALC_1

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-DSCT_DAYS1 / 100.

  • 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.

 

 

ENDFORM.                    "routine_0002

 

FORM routine_0003

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_42

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALC_2

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-DSCT_DAYS2 / 100.

  • UNIT = COMM_STRUCTURE-LOC_CURRCY.

  • 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.

 

 

ENDFORM.                    "routine_0003

 

FORM routine_0004

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_43

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALC_N

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-NETTERMS / 100.

  • 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.

 

 

ENDFORM.                    "routine_0004

 

FORM routine_0005

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_44

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALCT1

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  DATA:    DSCT1 LIKE COMM_STRUCTURE-DEB_CRE_LC.

 

  DSCT1 = COMM_STRUCTURE-DSCT_PCT1 * COMM_STRUCTURE-DEB_CRE_LC / 100.

  DSCT1 = DSCT1 / 10 * 9.

  IF COMM_STRUCTURE-DSC_AMT_LC >= DSCT1 AND

     COMM_STRUCTURE-FI_DOCSTAT EQ 'C'.

    RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-DSCT_DATE1 ).

    RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.

  ELSE.

    RESULT = 0.

  ENDIF.

  • 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.

 

 

ENDFORM.                    "routine_0005

 

FORM routine_0006

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_45

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALCT2

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  DATA:    DSCT1 LIKE COMM_STRUCTURE-DEB_CRE_LC.

 

  DSCT1 = COMM_STRUCTURE-DSCT_PCT1 * COMM_STRUCTURE-DEB_CRE_LC / 100.

  DSCT1 = DSCT1 / 10 * 9.

  IF COMM_STRUCTURE-DSC_AMT_LC < DSCT1 AND

     COMM_STRUCTURE-DSC_AMT_LC > 0     AND

     COMM_STRUCTURE-FI_DOCSTAT = 'C'.

     RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-DSCT_DATE2 ).

     RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.

  ELSE.

     RESULT = 0.

  ENDIF.

  • 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.

 

 

ENDFORM.                    "routine_0006

 

FORM routine_0007

  USING

    COMM_STRUCTURE type tys_SC_1__RULE_46

  CHANGING

    RESULT         TYPE tys_TG_1_full-INT_CALCTN

    RETURNCODE     LIKE sy-subrc

    ABORT          LIKE sy-subrc

  RAISING

    cx_sy_arithmetic_error

    cx_sy_conversion_error.

 

  • init variables

 

  • fill the internal table "MONITOR", to make monitor entries

 

  • result value of the routine

  IF COMM_STRUCTURE-DSC_AMT_LC = 0 AND

     COMM_STRUCTURE-FI_DOCSTAT = 'C'.

     RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-NETDUEDATE ).

     RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.

  ELSE.

     RESULT = 0.

  ENDIF.

  • 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.

 

 

ENDFORM.                    "routine_0007

 

$$ end of 2nd part global - insert your code only before this line   *

 

----


  •       CLASS routine IMPLEMENTATION

----


*

----


CLASS lcl_transform IMPLEMENTATION.

 

  METHOD compute_0INT_CALCTN.

 

  •   IMPORTING

  •     request     type rsrequest

  •     datapackid  type rsdatapid

  •     SOURCE_FIELDS-FI_DOCSTAT TYPE /BI0/OIFI_DOCSTAT

  •     SOURCE_FIELDS-CLEAR_DATE TYPE /BI0/OICLEAR_DATE

  •     SOURCE_FIELDS-NETDUEDATE TYPE /BI0/OINETDUEDATE

  •     SOURCE_FIELDS-DEB_CRE_LC TYPE /BI0/OIDEB_CRE_LC

  •     SOURCE_FIELDS-DSC_AMT_LC TYPE /BI0/OIDSC_AMT_LC

  •     SOURCE_FIELDS-LOC_CURRCY TYPE /BI0/OILOC_CURRCY

  •    EXPORTING

  •      RESULT type tys_TG_1-INT_CALCTN

 

    DATA:

      MONITOR_REC    TYPE rsmonitor.

 

*$*$ begin of routine - insert your code only below this line        *-*

  Data:

*--

    COMM_STRUCTURE   type tys_SC_1__RULE_46,

    l_subrc          type sy-tabix,

    l_abort          type sy-tabix,

    ls_monitor       TYPE rsmonitor,

    ls_monitor_recno TYPE rsmonitors.

 

  REFRESH:

    MONITOR.

 

  • Runtime attributs

    SOURCE_SYSTEM  = p_r_request->get_logsys( ).

    MOVE-CORRESPONDING SOURCE_FIELDS to COMM_STRUCTURE.

 

  • Migrated update rule call

  Perform routine_0007

  USING

    COMM_STRUCTURE

  CHANGING

    RESULT

    l_subrc

    l_abort.

 

*-- Convert Messages in Transformation format

    LOOP AT MONITOR INTO ls_monitor.

      move-CORRESPONDING ls_monitor to MONITOR_REC.

      append monitor_rec to MONITOR.

    ENDLOOP.

    IF l_subrc <> 0.

      RAISE EXCEPTION TYPE cx_rsrout_skip_val.

    ENDIF.

    IF l_abort <> 0.

      RAISE EXCEPTION TYPE CX_RSROUT_ABORT.

    ENDIF.

 

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

  ENDMETHOD.                    "compute_0INT_CALCTN

----


  •       Method invert_0INT_CALCTN

----


*

  •       This subroutine needs to be implemented only for direct access

  •       (for better performance) and for the Report/Report Interface

  •       (drill through).

  •       The inverse routine should transform a projection and

  •       a selection for the target to a projection and a selection

  •       for the source, respectively.

  •       If the implementation remains empty all fields are filled and

  •       all values are selected.

*

----


*

----


  METHOD invert_0INT_CALCTN.

 

$$ begin of inverse routine - insert your code only below this line-

... "insert your code here

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

 

  ENDMETHOD.                    "invert_0INT_CALCTN

ENDCLASS.                    "routine IMPLEMENTATION

 

<b>Thanks.</b>

  • Re: Check Routines III
    Srikanth voodi
    Currently Being Moderated

    For 0INT_CALCT2

     

    <b>DATA:    dsct1 LIKE SOURCE_FIELDS-deb_cre_lc.

     

        dsct1 = SOURCE_FIELDS-dsct_pct1 * SOURCE_FIELDS-deb_cre_lc / 100.

        dsct1 = dsct1 / 10 * 9.

        IF SOURCE_FIELDS-dsc_amt_lc < dsct1 AND

           SOURCE_FIELDS-dsc_amt_lc > 0     AND

           SOURCE_FIELDS-fi_docstat = 'C'.

          RESULT = ( SOURCE_FIELDS-clear_date - SOURCE_FIELDS-dsct_date2 ).

          RESULT = RESULT * SOURCE_FIELDS-deb_cre_lc / 100.

        ELSE.

          RESULT = 0.

        ENDIF.</b>

     

    For 0INT_CALCTN

     

    <b>IF SOURCE_FIELDS-dsc_amt_lc = 0 AND

         SOURCE_FIELDS-fi_docstat = 'C'.

          RESULT = ( SOURCE_FIELDS-clear_date - SOURCE_FIELDS-netduedate ).

          RESULT = RESULT * SOURCE_FIELDS-deb_cre_lc / 100.

        ELSE.

          RESULT = 0.

        ENDIF.</b>

Actions