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
13,244

HALLOW

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

<b>xtring</b>

how can i do that?

<b>plz give example</b>

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 <b>person_tab</b>

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,535

Hi

Declare another internal table with a single field STRING(200).

data : begin of itab1 occurs 0,

string(200),

end of itab1,

str(200).

loop at person_tab.

concatenate person_tab-werks person_tab-persg person_tab-persk

person_tab-orgeh person_tab-stell person_tablastname person_tab-firstname

...................into str separated by ','.

move str to itab1-string.

append itab1.

clear itab1.

endloop.

Reward points if useful

Regards

Anji

6 REPLIES 6
Read only

Former Member
0 Likes
1,536

Hi

Declare another internal table with a single field STRING(200).

data : begin of itab1 occurs 0,

string(200),

end of itab1,

str(200).

loop at person_tab.

concatenate person_tab-werks person_tab-persg person_tab-persk

person_tab-orgeh person_tab-stell person_tablastname person_tab-firstname

...................into str separated by ','.

move str to itab1-string.

append itab1.

clear itab1.

endloop.

Reward points if useful

Regards

Anji

Read only

0 Likes
1,535

hi anji

i wont to convert to xstring there is no function that can do that?

regards

Read only

ferry_lianto
Active Contributor
0 Likes
1,535

Hi,

Please try this combination FM.

SOTR_SERV_TABLE_TO_STRING

SCMS_STRING_TO_XSTRING or SCMS_FTEXT_TO_XSTRING

Regards,

Ferry Lianto

Read only

0 Likes
1,535

hi ferry

u can give me example how to use this function becose

icant import to them table and get string (export)

regards

Read only

ferry_lianto
Active Contributor
0 Likes
1,535

Hi,

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,

Ferry Lianto

Read only

0 Likes
1,535

hi ferry

thankes for your time

but that is what i dont understand how i use here in fm

my table <b>person_tab</b>

best regards