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

Smartforms text display

Former Member
0 Likes
738

Hi all,

In my smartform, I've a variable "address_line" (length = 300 chars) which is formed by concatenating the address street, city etc.

And I've put it in a field of a template, the displayed length of a line is 160 chars. It is expected that the contents in the "address_line" would automatically displayed in 2 lines.

However, it only displays one line with the contents overlapped.

I've tried this:

line 1: &address_line+0(160)&

line 2: &address_line+160(300)&

but the problem is that the word at 160-161th place is separated and cut to 2 lines.

How to make it to display neatly?

Many Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
678

Hi,

If a long text is to be displayed in SAP Script in two or three lines without missing any word then use the FM

RKD_WORD_WRAP .

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

textline

OUTPUTLEN

IMPORTING

OUT_LINE1

OUT_LINE2

OUT_LINE3

TABLES

OUT_LINES

EXCEPTIONS

OUTPUTLEN_TOO_LARGE

OTHERS

where TEXTLINE is Source text line

OUTPUTLEN is Maximum output line width

OUT_LINE1,OUT_LINE2,OUT_LINE3 are output lines 1,2,3.

I have used this for SAP Script.U can try in your smartform.

Regards,

S.Subasree.

3 REPLIES 3
Read only

Former Member
0 Likes
679

Hi,

If a long text is to be displayed in SAP Script in two or three lines without missing any word then use the FM

RKD_WORD_WRAP .

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

textline

OUTPUTLEN

IMPORTING

OUT_LINE1

OUT_LINE2

OUT_LINE3

TABLES

OUT_LINES

EXCEPTIONS

OUTPUTLEN_TOO_LARGE

OTHERS

where TEXTLINE is Source text line

OUTPUTLEN is Maximum output line width

OUT_LINE1,OUT_LINE2,OUT_LINE3 are output lines 1,2,3.

I have used this for SAP Script.U can try in your smartform.

Regards,

S.Subasree.

Read only

Former Member
0 Likes
678

Hi Macy,

Try to use this logic for sepation of one variable into two part.

DATA: s1(30) TYPE c VALUE 'India is the best country.'.

DATA: p1(10) TYPE c,

p2(10) TYPE c.

DATA: counter TYPE i VALUE 15,

int TYPE i.

WHILE counter > 0.

IF s1+counter(1) = ' '.

EXIT.

ENDIF.

counter = counter - 1.

ENDWHILE.

WRITE:/ s1+0(counter).

int = 30 - counter.

WRITE:/ s1+counter(int).

*WRITE:/ s1.

Thanks

Dharmishta

Read only

Former Member
0 Likes
678

if it is not necessary to include the splitted word in the first line

itself then u can try:

take the length of first address line till the starting of the word which is splitting ie dont include the split word in the line1.

lets say display the first line len as 152 and start the display of second line from +153 ( depending upon the starting of the split word)

I've tried this:

line 1: &address_line+0(152)&

line 2: &address_line+153(300)&