Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

concatenating strings

Former Member
0 Likes
670

Hi all,

I am getting text from read_text . I am concatenating all lines of text into another variable declared as LINE type string . ALL LINES are concatenating in one line. is there any other way to concatenating the lines into multiple lines of same cell. Is it possible or not?

pls check the given code.

loop at tlinetab into wa_tlinetab2.

if sy-tabix = 1.

move wa_tlinetab2-tdline to line2.

else.

concatenate line2 wa_tlinetab2-tdline into line2 separated by space.

endif.

endloop.

st_stxh-text2 = line2.

3 REPLIES 3
Read only

Former Member
0 Likes
589

hi

good

go through this code and use accordingly,

data:

l_text1(10) type c value 'first',

l_text2(10) type c value 'next',

l_out(20) type c.

concatenate l_text1 l_text2 into l_out.

write:/ l_out. " ---> Output: firstnext

concatenate l_text1 l_text2 into l_out separated by space.

write:/ l_out. "---> Output: first next

move: l_text1 to l_out.

l_out+15 = l_text2.

write:/ l_out. "----> Output: first next

thanks

mrutyun^

Read only

Former Member
0 Likes
589

Ekta,

I didnt understand the phrase 'multiple lines of same cell'. can you elborate ur requirement. According to my understanding, you want to use a single variable to store multiple lines seperated, as in a table, which is impossible. Because a variable stores the data in a continuous sequence. ( Variable i mean here is a STRING)

Read only

Former Member
0 Likes
589

Hi

see the sample code and do accordingly

REPORT ZTEST.

tables:stxh.

parameters p_vbeln type vbeln.

data:begin of it_stxh occurs 0,

tdobject type tdobject,

tdname type tdobname,

tdid type tdid,

tdspras type spras,

end of it_stxh.

types:begin of ty_lines.

include structure tline.

types:end of ty_lines.

data:it_lines type standard table of ty_lines with header line.

start-of-selection.

select tdobject

tdname

tdid

tdspras

from stxh

into table it_stxh where tdobject = 'VBBK' and

tdname = p_vbeln and

tdid = 'Z102' AND

tdspras = sy-langu.

if not sy-subrc ne 0.

leave to list-processing.

endif.

data: str type string.

read table it_stxh index 1.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = it_stxh-tdid

LANGUAGE = it_stxh-tdspras

NAME = it_stxh-tdname

OBJECT = it_stxh-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = it_lines

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

IF SY-SUBRC eq 0.

loop at it_lines.

concatenate str it_lines-tdline into str separated by '"'.

endloop.

ENDIF.

Regards

Anji