Application Development 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: 

RKD_WORD_WRAP with string input

Former Member
0 Kudos

hi all,

I need to split a string with RKD_WORD_WRAP, but it seems it takes only chars as input, so I would like to do this: create a char variable dynamically as long as the string in input and then pass it to the RKD_WORD_WRAP. Can anybody please tell me how can I do it? I think I should use field symbol but I don't know them very much.

Thanks in advance.

Gabriele

8 REPLIES 8

former_member156446
Active Contributor
0 Kudos

RKD_WORD_WRAP has a limitation to split at a maximum of 3 lines..I wanted you to know about it before proceeding...

[My weblog to split values>>|https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/repalcementtoRKD_WORD_WRAP]

0 Kudos

> RKD_WORD_WRAP has a limitation to split at a maximum of 3 lines..I wanted you to know about it before proceeding...

I used in this way with no lines but table for result for testing:


DATA the_string(300) TYPE c VALUE 'Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura  ché la diritta via era smarrita. Ahi quanto a dir qual era è cosa dura 5  esta selva selvaggia e aspra e forte    che nel pensier rinova la paura! '.

CALL FUNCTION 'RKD_WORD_WRAP'
  EXPORTING
    textline                  = the_string
   DELIMITER                 = ' '
   OUTPUTLEN                 = 15
 TABLES
   OUT_LINES                 = text_table

with this output

Nel mezzo del
cammin di
nostra vita mi
ritrovai per
una selva
oscura  ché la
diritta via
era smarrita.
Ahi quanto a
dir qual era è
cosa dura 5
esta selva
selvaggia e
aspra e forte
  che nel
pensier rinova
la paura!

so it works with many lines as need: they're just put in the table

now I'll check for split_string FM working ...

0 Kudos

Hello J@y,

Is it restricted to 3 lines only? I disagree with you my friend. You have the table OUT_LINES which has got all the data in multiple lines.

So where does the 3 lines restriction come into picture?

BR,

Suhas

0 Kudos

I used in a SAP script and I had to use the export parameters OUT_LINE1 OUT_LINE2 OUT_LINE3... tables OUT_LINES was not suitable for my requirement.... I guess its fine in your case.

Former Member
0 Kudos

HI Gabriele Montori,

Why don't you use the FM's

STRING_SPLIT

COPI_STRING_SPLIT

for more info.

hope it helps you.

Thanks

Former Member
0 Kudos

so concluding,

there is no FM that allow me to split a string in substring of a given length on a a given separator: I have to do it manually...

0 Kudos

>

> so concluding,

> there is no FM that allow me to split a string in substring of a given length on a a given separator: I have to do it manually...

I tried and failed to find one, and did it manually instead.

0 Kudos

Hello Gabriele,

I'm facing at the same prioblem.

You declared the_string(300) type c.

Is it possible to use an input variable at 720 digit?

I tried but is it trunc ... do you have another idea ?

tks a lot.