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: 

Correct text line in SapScript

former_member329522
Participant
0 Kudos

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

naimesh_patel
Active Contributor
0 Kudos

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

10 REPLIES 10

former_member181962
Active Contributor
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

naimesh_patel
Active Contributor
0 Kudos

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

0 Kudos

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

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

With this the words are cut...

former_member329522
Participant
0 Kudos

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?

0 Kudos

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

former_member188685
Active Contributor
0 Kudos

Hi,

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

Regards

vijay

0 Kudos

Oks, I´m going to try it.

Thanks.

former_member329522
Participant
0 Kudos

Thanks!! I use FM: RKD_WORD_WRAP!!!

former_member378318
Contributor
0 Kudos

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.