内部テーブルに数値項目の集計について

TYPES:

  BEGIN OF TYP_TAB01,

              KEY1(10)              TYPE C,

              KEY2(4)                TYPE C,

              FIELD1(40)            TYPE C,

              FIELD2(40)            TYPE C,

             

              AMOUNT              TYPE P(8),

             

  END OF TYP_TAB01,

  BEGIN OF TYP_COL_TAB01,

              KEY1(10)              TYPE C,

              KEY2(4)                TYPE C,

              AMOUNTSUM       TYPE P(8),

END OF TYP_COL_TAB01.

 

DATA:    

  LTD_TAB01                     TYPE STANDARD TABLE OF TYP_TAB01,

  LTD_COL_TAB01              TYPE HASHED TABLE OF TYP_COL_TAB01

                                                        WITH UNIQUE KEY KEY1 KEY2,

  LTH_TAB01                      LIKE LINE OF LTD_TAB01,

  LTH_COL_TAB01              LIKE LINE OF LTD_COL_TAB01.

 

LOOP AT LTD_TAB01 INTO LTH_TAB01.

              LTH_COL_TAB01-KEY1 = LTH_TAB01-KEY1.

              LTH_COL_TAB01-KEY2 = LTH_TAB01-KEY2.

              LTH_COL_TAB01-AMOUNTSUM = LTH_TAB01-AMOUNT.

              TRY.

                            COLLECT LTH_COL_TAB01 INTO LTD_COL_TAB01.

              CATCH CX_SY_ARITHMETIC_OVERFLOW.

                            LTH_COL_TAB01-AMOUNTSUM = 999999999999999.

                            MODIFY TABLE LTD_COL_TAB01 FROM LTH_COL_TAB01.

              ENDTRY.

ENDLOOP.

你可能感兴趣的:(内部テーブルに数値項目の集計について)