Type Template Report
Excel Download template Download report
Generate this example Choose a template and create a fresh report with the demo service.

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

JSON
{"FIRST_NAME":"FirstName","LAST_NAME":"LastName","MIDDLE_NAME":"MiddleName","T":[{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2023-11-03","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":451,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2024-01-22","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":452,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2024-04-11","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":461,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2024-04-28","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":461,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2024-05-28","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":460,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2024-06-30","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":459,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2024-09-18","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":189,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"BERLIN","LANDXTO":"Germany","CARRNAME":"Lufthansa","CONNID":"2402","FLDATE":"2024-12-07","DEPTIME":"10:30:00","ARRTIME":"11:35:00","PRICE":242.0,"CURRENCY":"EUR","SEATSMAX":475,"SEATSOCC":32,"_GROUP1":"FRANKFURT-Germany-BERLIN-Germany","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"TOKYO","LANDXTO":"Japan","CARRNAME":"Japan Airlines","CONNID":"0408","FLDATE":"2023-11-03","DEPTIME":"20:25:00","ARRTIME":"15:40:00","PRICE":1061.36,"CURRENCY":"JPY","SEATSMAX":385,"SEATSOCC":367,"_GROUP1":"FRANKFURT-Germany-TOKYO-Japan","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"TOKYO","LANDXTO":"Japan","CARRNAME":"Japan Airlines","CONNID":"0408","FLDATE":"2024-01-22","DEPTIME":"20:25:00","ARRTIME":"15:40:00","PRICE":1061.36,"CURRENCY":"JPY","SEATSMAX":385,"SEATSOCC":373,"_GROUP1":"FRANKFURT-Germany-TOKYO-Japan","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"TOKYO","LANDXTO":"Japan","CARRNAME":"Japan Airlines","CONNID":"0408","FLDATE":"2024-04-11","DEPTIME":"20:25:00","ARRTIME":"15:40:00","PRICE":1061.36,"CURRENCY":"JPY","SEATSMAX":385,"SEATSOCC":373,"_GROUP1":"FRANKFURT-Germany-TOKYO-Japan","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"TOKYO","LANDXTO":"Japan","CARRNAME":"Japan Airlines","CONNID":"0408","FLDATE":"2024-06-30","DEPTIME":"20:25:00","ARRTIME":"15:40:00","PRICE":1061.36,"CURRENCY":"JPY","SEATSMAX":385,"SEATSOCC":364,"_GROUP1":"FRANKFURT-Germany-TOKYO-Japan","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"TOKYO","LANDXTO":"Japan","CARRNAME":"Japan Airlines","CONNID":"0408","FLDATE":"2024-09-18","DEPTIME":"20:25:00","ARRTIME":"15:40:00","PRICE":1061.36,"CURRENCY":"JPY","SEATSMAX":385,"SEATSOCC":51,"_GROUP1":"FRANKFURT-Germany-TOKYO-Japan","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"TOKYO","LANDXTO":"Japan","CARRNAME":"Japan Airlines","CONNID":"0408","FLDATE":"2024-12-07","DEPTIME":"20:25:00","ARRTIME":"15:40:00","PRICE":1061.36,"CURRENCY":"JPY","SEATSMAX":385,"SEATSOCC":15,"_GROUP1":"FRANKFURT-Germany-TOKYO-Japan","T_COLOR":[]},{"CITYFROM":"FRANKFURT","LANDXFROM":"Germany","CITYTO":"NEW YORK","LANDXTO":"USA","CARRNAME":"Lufthansa","CONNID":"0400","FLDATE":"2023-11-03","DEPTIME":"10:10:00","ARRTIME":"11:34:00","PRICE":666.0,"CURRENCY":"EUR","SEATSMAX":330,"SEATSOCC":321,"_GROUP1":"FRANKFURT-Germany-NEW YORK-USA","T_COLOR":[]}]}

).


Generate demo 160

;call

Request preview

Purpose

Demo ZCL_XTT_DEMO_160 calls an object method from a marker. Use ;call= when a display value is too involved for a short ;cond= expression but does not justify another field in the report context. For example, if you need to display the maximum of the fields A and B in the R structure, you can write in the template{R;cond=WHEN value-A gt value-B THEN value-A ELSE value-B } without creating a 3rd field in R. For brevity, the expression can be written like this {R:WHEN v-A gt value-B THEN v-A ELSE v-B}.

Move long or reusable presentation logic into a method so the template remains readable.

Implicit parameter passing

Pass the target object to MERGE( ), then use ;call= in the marker.

image

The complete root context is passed implicitly to an importing parameter named IS_ROOT.

image

It is passed implicitly, by the name IS_ROOT

      get_fullname
        IMPORTING
                  is_root TYPE ts_root "<--- is passed implicitly
        RETURNING VALUE (rv_text) TYPE string,

...

  METHOD get_fullname.
    rv_text = to_upper (| {is_root-first_name} {is_root-last_name} {is_root-middle_name} |).
  ENDMETHOD.

Short form

As : abbreviates ;cond=, @ abbreviates ;call=.

image

Explicit parameters

When the method needs only selected values, pass them explicitly with value-FIELD in the long form or v-FIELD in the @ shorthand.

image

The method has the following signature

      date_text
       IMPORTING
         "is_root TYPE ts_flight_info <- no need. Pass v-FLDATE explicitly
         iv_date TYPE d
         iv_lang TYPE sylangu DEFAULT sy-langu
       RETURNING VALUE (rv_text) TYPE string.

Unlike ;cond=, the output type is derived from the returning parameter. An explicit ;type= is normally unnecessary.

Result in two languages: image


Date-formatting note

The date method is illustrative. For Excel, prefer ABAP type D and set the number format in the cell with Ctrl+1.

image

image


For locale-aware dates in PDF and Word, a string template in ;cond= with the COUNTRY formatting option is often sufficient.

image

image