Generate this example Choose a template and create a fresh report with the demo service.

xtt->merge( iv_block_name = 'R' is_block =

JSON
{"A":[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],"DATE":"2020-10-21","DATETIME":"20201021121212","T":[{"GROUP":"GRP A","CAPTION":"<Caption 1 />","DATE":"2020-10-21","SUM1":5971.44,"SUM2":5021.46},{"GROUP":"GRP C","CAPTION":"<Caption 2 />","DATE":"2020-10-19","SUM1":2276.75,"SUM2":7717.2},{"GROUP":"GRP B","CAPTION":"<Caption 3 />","DATE":"2020-10-20","SUM1":3031.38,"SUM2":445.22},{"GROUP":"GRP A","CAPTION":"<Caption 4 />","DATE":"2020-10-21","SUM1":9476.79,"SUM2":3683.27},{"GROUP":"GRP A","CAPTION":"<Caption 5 />","DATE":"2020-10-21","SUM1":4604.0,"SUM2":5525.85},{"GROUP":"GRP C","CAPTION":"<Caption 6 />","DATE":"2020-10-19","SUM1":2159.71,"SUM2":2260.94},{"GROUP":"GRP B","CAPTION":"<Caption 7 />","DATE":"2020-10-20","SUM1":2490.3,"SUM2":6388.81},{"GROUP":"GRP A","CAPTION":"<Caption 8 />","DATE":"2020-10-21","SUM1":5476.81,"SUM2":406.18},{"GROUP":"GRP D","CAPTION":"<Caption 9 />","DATE":"2020-10-18","SUM1":689.66,"SUM2":518.6},{"GROUP":"GRP C","CAPTION":"<Caption 10 />","DATE":"2020-10-19","SUM1":5451.87,"SUM2":4061.85},{"GROUP":"GRP D","CAPTION":"<Caption 11 />","DATE":"2020-10-18","SUM1":4573.55,"SUM2":5436.0},{"GROUP":"GRP C","CAPTION":"<Caption 12 />","DATE":"2020-10-19","SUM1":1196.35,"SUM2":522.46},{"GROUP":"GRP C","CAPTION":"<Caption 13 />","DATE":"2020-10-19","SUM1":7686.95,"SUM2":2727.98},{"GROUP":"GRP D","CAPTION":"<Caption 14 />","DATE":"2020-10-18","SUM1":978.18,"SUM2":295.55},{"GROUP":"GRP D","CAPTION":"<Caption 15 />","DATE":"2020-10-18","SUM1":71.12,"SUM2":8878.56}],"TIME":"12:12:12","TITLE":"Title","V_DESC":"Class attributes"}

).


Generate demo 120

Class attributes

Request preview

Purpose

Demo ZCL_XTT_DEMO_120 passes an object directly to MERGE( ). Use this approach when a class already exposes the fields and tables required by the report and a duplicate root structure would add no value.

Merge an object

image

Pass the object reference to MERGE( ); public attributes are resolved like structure components.

Example: personnel actions

The pattern is especially useful for an existing domain object, for example a class that already contains IT 0000 and IT 0001 data for a personnel action.

image

The template can:

  • read scalar and nested attributes such as {R-MV_MASSN} and {R-MS_P0000-STAT2};
  • repeat an internal table such as {R-MT_P0000};
  • read an entry with an expression such as {R;cond=value-MT_P0001[ 1 ]-ENAME};
  • derive conditional text through ;cond=.

No additional root structure is required.

Attribute visibility

Public attributes are always available.

To expose protected or private attributes, declare ZCL_XTT_REPLACE_BLOCK as a friend of the report object. Do this deliberately: it gives the rendering layer access to the object’s internal state.

image