Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.71 KB | None | 0 0
  1. "Пример в хэлпе, кусок
  2.     TYPES strings TYPE STANDARD TABLE OF string WITH EMPTY KEY.
  3.     DATA(words) = VALUE strings(
  4.       ( `All` )
  5.       ( `ABAP` )
  6.       ( `constructs` )
  7.       ( `are` )
  8.       ( `imperative` ) ).
  9. "Table comprehension into helper table
  10.     DATA(switched_words) = VALUE strings(
  11.           FOR word IN words
  12.            ( SWITCH #( word WHEN `All`        THEN `Some`
  13.                             WHEN `imperative` THEN `functional`
  14.                             ELSE word ) ) ).
  15.  
  16. "Table reduction of helper table
  17.     DATA(sentence) =
  18.       REDUCE string( INIT text = `` sep = ``
  19.         FOR word IN switched_words
  20.         NEXT text = |{ text }{ sep }{ word }| sep = ` ` ) && '.'.
  21.  
  22. "Вот этот sentence заполнился значениями из строк switched_words.
  23. *-------------------------------------------------------------------
  24. "Мне надо в строку собрать имена БЕ:
  25. types
  26.           : begin of lty_names
  27.             , name1 type t001w-name1
  28.           , end   of lty_names
  29.           .
  30.     data
  31.           : lt_bukrs_name type standard table of t001w-name1 "standard table of lty_names "закомментил, чтобы приблизить к примеру
  32.           .
  33. select name1
  34.       from t001w
  35.         into table @lt_bukrs_name
  36.           where werks in @s_bukrs     "в werks нормальные имена филиалов хранятся
  37.       .
  38.  
  39. "Далее пишу в атрибут
  40. me->ms_data-butxt = reduce #(  init text = space coma = space
  41.                                    for name in lt_bukrs_name
  42.                                    next text = |{ text } { coma } { name }| coma = ','  ).
  43. "пусто, ска
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement