7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ABAPでの検証時の便利なクラスCL_DEMO_OUTPUT

Posted at

検証時に不便だったこと

ABAPで検証している時に、変数の値を確認するのは地味に面倒でした。特に内部テーブルや構造は、Writeコマンドで簡単に書けないので、Writeをたくさん書いたり、デバッガで確認したりとストレス溜まっていました。

クラスCL_DEMO_OUTPUT

クラスCL_DEMO_OUTPUTを使うと簡単に確認できます。前から知っていましたが、多少余裕があったので、改めてメモしておきます。
こんな感じで書きます。するとポップアップ画面が出て変数の中身を確認できます。

Report.abap
SELECT *
FROM t000
INTO TABLE @DATA(lt_output).

cl_demo_output=>display( lt_output ) .

複数変数を同時に見たい場合は、こんな書き方です。

Report.abap
* 複数出したい場合
SELECT *
FROM t000
INTO TABLE @DATA(lt_output).

DATA(lr_out) = cl_demo_output=>new( )->write_data( lt_output ).

DELETE lt_output FROM 3.

lr_out->write_data( lt_output )->display( ).

参考

以下のレポートプログラムがサンプルです。
DEMO_USAGE_OUTPUT_INSTANCE
DEMO_USAGE_OUTPUT_STATIC

以下のページが参考になります。
CL_DEMO_OUTPUT, Part 1 of 2 – Usage
CL_DEMO_OUTPUT, Part 2 of 2 – A Look Behind

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?