The class CL_DEMO_OUTPUT and its interface IF_DEMO_OUTPUT format ABAP data and other data as output for demonstration and test purposes. Since its appearance, the following evolutionary steps took place:
The latter already introduced the implicit usage of CL_DEMO_OUTPUT to ABAP Cloud. Either by implementing IF_OO_ADT_CLASSRUN or by inheriting from CL_DEMO_CLASSRUN, CL_DEMO_OUTPUT can be invoked in order to produce console output. Here, CL_DEMO_CLASSRUN offers more methods than IF_OO_ADT_CLASSRUN.
When using IF_OO_ADT_CLASSRUN or CL_DEMO_CLASSRUN, the instantiation and the handling of the output data are done internally by ADT. Since neither IF_DEMO_OUTPUT nor CL_DEMO_OUTPUT can be released as an API, they cannot be used directly in ABAP Cloud.
To close this gap, with ABAP 2408, IF_DEMO_OUTPUT_CLOUD and CL_DEMO_OUTPUT_CLOUD were released as APIs for usage in test and demonstration programs in ABAP Cloud. They wrap CL_DEMO_OUTPUT and make only those features available that are suitable for ABAP Cloud. The main restrictions are:
Now you can write code in an ABAP class with ABAP language version "ABAP for Cloud Development" as follows:
DATA:
BEGIN OF struc,
col TYPE i VALUE 333,
itab TYPE TABLE OF i WITH EMPTY KEY,
END OF struc.
struc-itab = VALUE #( FOR i = 1 UNTIL i = 4 ( i * 111 ) ).
FINAL(dref) = REF #( struc ).
FINAL(html) =
cl_demo_output_cloud=>new( cl_demo_output_cloud=>html
)->begin_section( 'HTML Output'
)->get( dref ).
FINAL(text) =
cl_demo_output_cloud=>new( cl_demo_output_cloud=>text
)->begin_section( 'Text Output'
)->get( dref ).
FINAL(json) =
cl_demo_output_cloud=>new( cl_demo_output_cloud=>json
)->begin_section( 'JSON Output'
)->get( dref ).
FINAL(xml) =
cl_demo_output_cloud=>new( cl_demo_output_cloud=>xml
)->begin_section( 'XML Output'
)->get( dref ).
"Do what you want ...
As the comment says, you can do what you want with the output strings returned by GET in HTML-, TEXT-, JSON- or XML-format.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 46 | |
| 42 | |
| 38 | |
| 32 | |
| 30 | |
| 28 | |
| 27 | |
| 23 | |
| 23 | |
| 22 |