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

Correct text line in SapScript

Former Member
0 Likes
2,621

Hi All!

Sorry, my English is very poor...

I have a variable with a text line. I´m going to show this text in the SapScript, but the text is very long...

How can I write de variable in 2 lines, without cut any word?

Thanks!

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
1,838

Hello,

DO like

&T001-BUTXT+0(15)& IN FIRST LINE

&T001-BUTXT+15(10)& IN SECOND LINE.

You can use FM : RKD_WORD_WRAP

Regards,

Naimesh

Hi All!

Sorry, my English is very poor...

I have a variable with a text line. I´m going to show this text in the SapScript, but the text is very long...

How can I write de variable in 2 lines, without cut any word?

Thanks!

10 REPLIES 10
Read only

Former Member
0 Likes
1,838

Hi,

Do not bother about your Language buddy...

If it is a standard text(Constant all the time). then define it as a std text in so10 transaction.

Because you are defining it , you make sure you enter the text in two lines without any break in words.

REgards,

Ravi

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,838

Please check out function module FORMAT_TEXTLINES.

Please remember to award points for helpful answers and mark your post as solved when solved completely. THanks.

Regards,

Rich Heilman

Read only

naimesh_patel
Active Contributor
0 Likes
1,839

Hello,

DO like

&T001-BUTXT+0(15)& IN FIRST LINE

&T001-BUTXT+15(10)& IN SECOND LINE.

You can use FM : RKD_WORD_WRAP

Regards,

Naimesh

Read only

0 Likes
1,838

&T001-BUTXT+0(15)& IN FIRST LINE

&T001-BUTXT+15(10)& IN SECOND LINE.

With this the words are cut...

Read only

Former Member
0 Likes
1,838

Hi all again! Thanks for your quickly request!

CALL FUNCTION 'FORMAT_TEXTLINES'

  • EXPORTING

  • CURSOR_COLUMN = 0

  • CURSOR_LINE = 0

  • ENDLINE = 99999

  • FORMATWIDTH = 72

  • LINEWIDTH = 132

  • STARTLINE = 1

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • NEW_CURSOR_COLUMN =

  • NEW_CURSOR_LINE =

TABLES

lines =

  • EXCEPTIONS

  • BOUND_ERROR = 1

  • OTHERS = 2

.

Where I have to put the variable in this function?? How is the result?

Read only

0 Likes
1,838

Please see the following example program.




report zrich_0001 .

data: lines type table of   tline with header line.


lines-tdline
   = 'This is the first line of the text and we need to format it'.
append lines.

lines-tdline
   = 'This is the second line of the text and we need to format it'.
append lines.

loop at lines.
  write:/ lines-tdline.
endloop.


call function 'FORMAT_TEXTLINES'
 EXPORTING
*   CURSOR_COLUMN           = 0
*   CURSOR_LINE             = 0
*   ENDLINE                 = 99999
    formatwidth             = 30
*   LINEWIDTH               = 132
*   STARTLINE               = 1
*   LANGUAGE                = SY-LANGU
* IMPORTING
*   NEW_CURSOR_COLUMN       =
*   NEW_CURSOR_LINE         =
  tables
    lines                   = lines.
* EXCEPTIONS
*   BOUND_ERROR             = 1
*   OTHERS                  = 2
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

skip 5.

loop at lines.
  write:/ lines-tdline.
endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,838

Hi,

try with FM <b>RKD_WORD_WRAP</b>.

Regards

vijay

Read only

0 Likes
1,838

Oks, I´m going to try it.

Thanks.

Read only

Former Member
0 Likes
1,838

Thanks!! I use FM: RKD_WORD_WRAP!!!

Read only

former_member378318
Contributor
0 Likes
1,838

Why are you concerned by this? Just ensure your output windown in SAP Script is at least 2 lines in height and SAP Script will handle the wrapping for you without cutting words.