Ansicht
Dokumentation

ABENREDUCE_TEXT_ABEXA - REDUCE TEXT ABEXA

ABENREDUCE_TEXT_ABEXA - REDUCE TEXT ABEXA

Fill RESBD Structure from EBP Component Structure   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

- Table Reduction, String Processing

This example demonstrates a reduction of the columns of a character-like table to a text string.

Source Code

Execute

Description

A table comprehension is used to construct a new internal table switched_words from the content of an internal table words, where the condition operator SWITCH replaces certain lines of the existing internal table with other lines. This table is specified in the FOR expression of the REDUCE expression and its lines are reduced to a text string using a concatenation after NEXT and then assigned to the variable sentence. Here, the helper variable sep declared after INIT is initial for the first read line and is filled with a blank for the evaluation of further lines.

This example also demonstrates an alternative implementation in which the table comprehension is embedded directly in the table reduction. Here, the helper variable switched_words is not required, but the source code is much harder to read. A human reader, for example, can hardly tell that the FOR expressions are not sequential and that the table comprehension is executed first, followed by the table reduction for the result.






PERFORM Short Reference   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 1736 Date: 20240501 Time: 234757     sap01-206 ( 45 ms )