Convert char to numbers, the number must be declare as P

本文展示了一个使用 ABAP 语言进行数据处理的过程,包括字符转换为数字、获取绝对值及内部表的操作等。通过调用 MOVE_CHAR_TO_NUM 函数进行字符到数字的转换,并处理了转换过程中可能出现的异常。
 

           CALL FUNCTION 'MOVE_CHAR_TO_NUM'

             EXPORTING

               chr = i_lagp-lgpla+5(2)

             IMPORTING

               num = int_tmp

             EXCEPTIONS

               convt_no_number = 1

               convt_overflow = 2

             OTHERS = 3.

            IF sy-subrc <> 0.

              int_tmp = 0.

            endif.

 

Get the absolute value

     int_tmp = abs( int_tmp - int_tmp2 ).

 

Append internal table.

        result-r_lgtyp = i_lagp-lgtyp.

        result-r_lgnum = i_lagp-lgnum.

        result-r_lgpla = i_lagp-lgpla.

        result-r_lptyp = i_lagp-lptyp.

        result-r_index = int_index.

 

 

        append result to i_result.

 

Sort internal table   SORT  i_result DESCENDING BY r_index ASCENDING.

 

Read table by index

int_index = 1.

DO 9 TIMES.

  READ TABLE i_result index int_index.

  IF sy-subrc = 0.

    result-r_lgtyp = i_result-r_lgtyp.

    result-r_lgnum = i_result-r_lgnum.

    result-r_lgpla = i_result-r_lgpla.

    result-r_lptyp = i_result-r_lptyp.

    result-r_index = i_result-r_index.

    append result to i_bin.

  ENDIF.

  int_index = int_index + 1.

ENDDO.

转载于:https://www.cnblogs.com/gangjing/archive/2009/03/13/1410625.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值