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

convert table to xstring

Former Member
0 Likes
11,649

hallow

i have internal table (person_tab) and i wont convert it to

<b>xtring</b>

how can i do that?

best regards.

TYPES : BEGIN OF 1_itab,

werks TYPE persa,

persg TYPE persg,

persk TYPE persk,

orgeh TYPE orgeh,

stell TYPE stell,

lastname TYPE pad_nachn,

firstname TYPE pad_vorna,

stdaz TYPE enstd,

btrtl TYPE btrtl,

name1 TYPE pbtxt,

btext TYPE btrtx,

perid TYPE prdni,

END OF 1_itab.

DATA : person_tab TYPE TABLE OF 1_itab,

wa_person_tab LIKE LINE OF person_tab

<b>

i now this function but how i move person_tab to this function?</b>

<b>plz give example</b>

call function 'SOTR_SERV_TABLE_TO_STRING'

exporting

line_length = gl_linewidth

langu = p_langu

importing

text = l_text

tables

text_tab = l_text_tab.

call function 'SCMS_STRING_TO_XSTRING'

exporting

text = l_text

importing

buffer = l_xstring_data

exceptions

failed = 1

others = 2

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,782

Hello,

Please try this combination FM.

SOTR_SERV_TABLE_TO_STRING

SCMS_STRING_TO_XSTRING or SCMS_FTEXT_TO_XSTRING

Please try this.

data: l_text type string.

types: begin of text_table,

line type sotr_txt,

end of text_table.

data: l_text_tab type table of text_table.

data: l_xstring_data type string.

...

call function 'SOTR_SERV_TABLE_TO_STRING'

exporting

line_length = gl_linewidth

langu = p_langu

importing

text = l_text

tables

text_tab = l_text_tab.

call function 'SCMS_STRING_TO_XSTRING'

exporting

text = l_text

importing

buffer = l_xstring_data

exceptions

failed = 1

others = 2

Regards,

Deepu.K

4 REPLIES 4
Read only

Former Member
0 Likes
6,782

hallow

if i cant use ththis function ?

did anyone have other idea?

regards

Read only

Former Member
0 Likes
6,782

Hi.

You could build it together on your own. I think you like a line break after each row

of your internal table:

DATA: lt_person TYPE TABLE OF <your_type>,
                   ls_person TYPE <your_type>,
                   xstring     TYPE XSTRING.
LOOP AT it_person.
  IF sy-index = 1.
  CONCATENATE ls_person INTO xstring 
  ELSE.
 CONCATENATE xstring CL_ABAP_CHAR_UTILITIES=>CR_LF ls_person 
   INTO xstring.
ENDLOOP.

Hope that solves your problem,

Timo.

Read only

Former Member
0 Likes
6,782

Hi antonio,

Refer this code :

data : BEGIN OF I_FLAT occurs 0,

RECORD TYPE STRING,

END OF T_FLAT.

Loop at 1_itab.

CONCATENATE

1_itab-werks

1_itab-persg

1_itab-persk

1_itab-orgeh

1_itab-stell

1_itab-lastname

1_itab-firstname

1_itab-stdaz

1_itab-btrtl

1_itab-name1

1_itab-btext

1_itab-perid

INTO I_FLAT-RECORD SEPARATED BY SPACE.

endloop.

Rewad points if helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
6,783

Hello,

Please try this combination FM.

SOTR_SERV_TABLE_TO_STRING

SCMS_STRING_TO_XSTRING or SCMS_FTEXT_TO_XSTRING

Please try this.

data: l_text type string.

types: begin of text_table,

line type sotr_txt,

end of text_table.

data: l_text_tab type table of text_table.

data: l_xstring_data type string.

...

call function 'SOTR_SERV_TABLE_TO_STRING'

exporting

line_length = gl_linewidth

langu = p_langu

importing

text = l_text

tables

text_tab = l_text_tab.

call function 'SCMS_STRING_TO_XSTRING'

exporting

text = l_text

importing

buffer = l_xstring_data

exceptions

failed = 1

others = 2

Regards,

Deepu.K