ABAP_OO àì夳堔傛蜴生んèń 2023-08-17 14:06 284阅读 0赞 ## ABAP\_OOP\_Sample\_1.01 ## "示例程序1.1 REPORT zrep_error_check_01. DATA: gv_result TYPE p LENGTH 8 DECIMALS 2, gv_exref TYPE REF TO cx_root, gv_msgtxt TYPE string. DATA: gv_cuotient TYPE i, gv_dividend TYPE i VALUE 19, gv_divisor TYPE i VALUE 0, gv_s_numbr TYPE string VALUE '1234567890', gv_position_11 TYPE i VALUE 11. TRY. gv_result = gv_dividend / gv_divisor. " no short dump here. catch it. CATCH cx_root INTO gv_exref. gv_msgtxt = gv_exref->get_text( ). WRITE: / gv_msgtxt. CLEANUP. ENDTRY. TRY. gv_s_numbr = gv_s_numbr(gv_position_11). " no short dump here. catch it. CATCH cx_root INTO gv_exref. gv_msgtxt = gv_exref->get_text( ). WRITE: / gv_msgtxt. CLEANUP. ENDTRY. ## ABAP\_OOP\_Sample\_2.01 ## "示例程序2.1 REPORT zrep_cls_07. DATA gv_top(20) TYPE c VALUE 'Top of the World'. DATA gv_on_the_way(20) TYPE c VALUE 'Because it is there'. DATA: gv_char(20) TYPE c, gv_float TYPE f, gv_float_origin(10) TYPE c VALUE '10.90', gv_float_new LIKE gv_float_origin. DO 6 TIMES. "避免在循环中定义并初始化变量 "并不是每次循环都会重新初始化变量 DATA: gv_elevation TYPE i VALUE 6688. "如果一定要定义,循环中要将变量及时赋值 "gv_elevation = 6688. IF sy-index = 3. gv_elevation = 8848. ENDIF. IF gv_elevation = 8848. WRITE sy-index. WRITE gv_elevation. WRITE gv_top. ELSE. WRITE sy-index. WRITE gv_elevation. WRITE gv_on_the_way. ENDIF. NEW-LINE. ENDDO. ## ABAP\_OOP\_Sample\_2.02 ## ## ABAP\_OOP\_Sample\_2.03 ## ## ABAP\_OOP\_Sample\_2.04 ## ## ABAP\_OOP\_Sample\_2.05 ## ## ABAP\_OOP\_Sample\_2.06 ## ## ABAP\_OOP\_Sample\_2.07 ## ## ABAP\_OOP\_Sample\_2.08 ## ## ABAP\_OOP\_Sample\_4.01 ## ## ABAP\_OOP\_Sample\_4.02 ## ## ABAP\_OOP\_Sample\_4.03 ## ## ABAP\_OOP\_Sample\_4.04 ## ## ABAP\_OOP\_Sample\_4.05 ## ## ABAP\_OOP\_Sample\_4.06 ## ## ABAP\_OOP\_Sample\_4.07 ## 转载于:https://www.cnblogs.com/ckstock/p/11586167.html
还没有评论,来说两句吧...