Link Search Menu Expand Document


Conditional block output

From time to time in reports it is necessary to hide or show part of the data in the template. How can this be done most informatively?


Another ABAP in the template

The two previous cases were

  • Conditional data output with formatting in ;cond=
  • show_if, hide_if for conditional selection from “templates” of rows

Addition ‘;type=block’

It resembles most of all show_if, but it is not intended for a specific tree or table, but for writing arbitrary conditions

For example, this block will be displayed in 2019 ;cond=sy-datum(4) eq ‘2019’ image

The 12th line will be displayed if the TITLE field in the R structure contains data


You could also write ;cond=value-title IS NOT INITIAL

For PDF, SUBFORM is used for detecting scopes of the block. For Excel & Word, the scope is declared by tables rows

Table borders may not be visible in Word


To display the borders in the template
Table Tools -> Layout -> View Gridlines


Previously, to hide a block, you had to create a special ABAP table and fill it in:

  • 1 - line (for display)
  • 0 - if it was necessary to hide the block

This add-on simply performs the same function only by writing a condition in the template itself


For convenience {R-BL2;type=block;cond=strlen( value-TITLE ) gt 0} can be abbreviated to {R-BL2;=strlen( v-TITLE ) gt 0}

*See templates 140