Join list of strings with a comma

青春壹個敷衍的年華 提交于 2019-12-02 05:19:58

Another way of writing CONCATENATE LINES OF ... is to use the 7.40 function concat_lines_of( [table =] itab [sep = sep] )

cl_demo_output=>display( concat_lines_of(
          table = value string_table( ( `one` ) ( `two` ) ( `three` ) )
          sep   = `, ` ) ).

(Result: 'one, two, three')

I'm kind of spitballin' here but the following should work. You got a table of strings lt_strings and a variable for output lv_concatenated. ABAP has a built in command called concatenate and you can feed a table as input.

data: lt_strings type string_table,
      lv_concatenated type string.

concatenate lines of lt_strings into lv_concatenated separated by ','.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!