当前位置 : 主页 > 手机开发 > harmonyos >

abap 指针使用的一个小例子

来源:互联网 收集:自由互联 发布时间:2023-10-08
data: begin of ttt occurs 0, mm type mara-matnr, end of ttt. ttt-mm = 'DISPO'.append ttt. ttt-mm = 'PLIFZ'.append ttt.types: s_ttt like line of ttt.FIELD-SYMBOLS: A TYPE s_ttt.FIELD-SYMBOLS: B TYPE c.DATA: lcx_error TYPE REF TO cx_root, err
data: begin of ttt occurs 0,
          mm type mara-matnr,
       end of ttt.


 ttt-mm = 'DISPO'.
append ttt.

 ttt-mm = 'PLIFZ'.
append ttt.


types: s_ttt like line of ttt.

FIELD-SYMBOLS: <A>  TYPE s_ttt.
FIELD-SYMBOLS: <B> TYPE c.

DATA: lcx_error TYPE REF TO cx_root,
 err_text TYPE c LENGTH 1000.

loop at ttt assigning <a>.
     try.
         ASSIGN     (<A>-mm) TO <B>.
         if <b> is assigned.
           WRITE <B>.
           unassign <b>.
         else.
           write 'error'.
         endif.
       catch CX_SY_ASSIGN_CAST_ILLEGAL_CAST into lcx_error.
         err_text = lcx_error->get_text( ). "得到错误信息
         write err_text.
     endtry.
   endloop.
上一篇:关于SAP中的ICON
下一篇:没有了
网友评论