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 string to table with no word split

helmut_sieberer
Participant
0 Likes
3,400

Hello,

hope i can get some help with my problem.

i know there are function modules that convert a string to a table.

for example SCMS_STRING_TO_FTEXT.

but i couldn't find a fm that does it considering not to split words.

for example:

looks like this:

................this is a te

st

should look like this

.................this is a

test

thanks very much for your help

Helmut

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,762

HI,

Try with below syntax:

DATA: dobj TYPE string,

result_tab type table of string.

dobj = 'This is an example'.

SPLIT dobj AT space INTO TABLE result_tab.

It will split the string into table.

15 REPLIES 15
Read only

Former Member
0 Likes
1,763

HI,

Try with below syntax:

DATA: dobj TYPE string,

result_tab type table of string.

dobj = 'This is an example'.

SPLIT dobj AT space INTO TABLE result_tab.

It will split the string into table.

Read only

0 Likes
1,762

Hello,

i have no seperator

if i use space i would get every word in a extra line

Greets

Read only

0 Likes
1,762

FM TEXT_SPLIT maybe?

Read only

0 Likes
1,762

Try F IQAPI_WORD_WRAP

Rob

Read only

0 Likes
1,762

Rob,

That's definitely the better solution. Didn't know that one yet.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,762

Hello Rob,

Again you have put me in dilemma ;-(

I try with IQAPI_WORD_WRAP for Micky's Statement for lenght 35 characters. It returns me table with 3 lines.

THAT'S DEFINITELY THE BETTER
SOLUTION. DIDN'T KNOW THAT ONE
YET.

I try with RKD_WORD_WRAP for Micky's Statement for lenght 35 characters. It returns me table with 2 lines.

THAT'S DEFINITELY THE BETTER
SOLUTION. DIDN'T KNOW THAT ONE YET.

Please enlighten me 😛

BR,

Suhas

Read only

0 Likes
1,762

Micky's statement?

Rob

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,762

>

> Rob,

>

> That's definitely the better solution. Didn't know that one yet.

Yeah

Read only

0 Likes
1,762

I see - probably a question for OSS

The OP can take whichever he likes.

Rob

Read only

0 Likes
1,762

The OR Condition in this IF makes the RKD_WORD_WRAP to WRAP it in 2 lines.


    IF ( <F> EQ DELIMITER AND IPOS NE 0 ) OR
       ( STRING_LENGTH LE OUTPUTLEN ).              "aw170997/31I/H83654

Regards,

Naimesh Patel

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,762

Hello Naimesh,

But why do we have the discrepancy, we should not be having it.

Cheers,

Suhas

Read only

0 Likes
1,762

Yes, we must not be having any discrepancy.

It looks like SAP didn't bother to apply the same patch to FM IQAPI_WORD_WRAP.

But the applied patch in the RKD_WORD_WRAP is not good enough:

With the same input text from Micky

That's definitely the better solution. Didn't know that one yet.

RKD_WORD_WRAP with input parameters:

DELIMITER = single quote

OUTPUTLEN = 35

Output table:


THAT'
S DEFINITELY THE BETTER SOLUTION. D
IDN'T KNOW THAT ONE YET.

Which is wrong.

I was expecting that it would generate 4 entries and FM IQAPI_WORD_WRAP generated 4 entries for the same input parameters:


THAT'
S DEFINITELY THE BETTER SOLUTION. D
IDN'
T KNOW THAT ONE YET.

Which one is better ??

@ Micky,

Thanks for building great test data

Regards,

Naimesh Patel

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,762

Hello Naimesh,

THAT'
S DEFINITELY THE BETTER SOLUTION. D
IDN'
T KNOW THAT ONE YET.

This is not correct "word wrapping". This is basically splitting the string into block of 35 characters each

BR,

Suhas

Read only

0 Likes
1,762

At least I'm good for something...you're welcome.

Read only

0 Likes
1,762

"Word Wrapping" should be a type of split at Space (which is delimiter) in specified Length. So, Delimiter would have always higher preference than Length.

FM IQAPI_WORD_WRAP is consistent with its priorities: First Delimiter and than Length

Where as FM RKD_WORD_WRAP is not consistent.


THAT'
" For this first line Delimiter took preference
S DEFINITELY THE BETTER SOLUTION. D
IDN'T KNOW THAT ONE YET.
" For this last line, Length took preference 

Regards,

Naimesh Patel