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

Need to convert table to a string

Former Member
0 Likes
5,450

Hi all ,

Our requirement is to convert internal table to a stirng .

Suppose internal table is like this

-


123

456

789

XXX

-


Each entry in the table shdl have a fixed length in the output . Suppose it is 5 , then the output will be

'123 456 789 XXX '

Is there any ABAP class /FM can handle this ???

Regards

Goutam

Hi all ,

Our requirement is to convert internal table to a stirng .

Suppose internal table is like this

-


123

456

789

XXX

-


Each entry in the table shdl have a fixed length in the output . Suppose it is 5 , then the output will be

'123 456 789 XXX '

Is there any ABAP class /FM can handle this ???

Regards

Goutam

7 REPLIES 7
Read only

Former Member
0 Likes
1,687

Hi,

Go on concatenating the strings

loop at itab.

concatenate itab str into str

Endloop.

Read only

Former Member
0 Likes
1,687

Use this code.

data: v_fix type i value 5,
        v_index type i.
data: output(2000).

clear: v_index, output.
 
loop at itab.
 output+v_index(v_fix) = itab-fld.
 v_index = v_index + v_fix. 
endloop.

Regards,

Manoj

Read only

Former Member
0 Likes
1,687

loop at itab.

concatenate itab-field to w_string separated by SPACE.

endloop.

If you need a FM, then you can use the above logic to develop a FM of your own.

Regards,

Pavan

Read only

Former Member
0 Likes
1,687

SOTR_SERV_TABLE_TO_STRING

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,687

Hi,

use FM CONVERT_TABLE_TO_STIRNG.

Regards,

Sesh

Read only

Former Member
0 Likes
1,687

Function module available

Read only

Former Member
0 Likes
1,687

Hi,

You dont need func.module,

CONCATENATE LINES OF itab INTO str separated by space.

Regards,

Subramanian