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

Split sentence

Former Member
0 Likes
527

Hi all,

can you provide me the code for:

split the sentence when count to 50 character. Thank

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
506

Hi,

Can u please check this code, i think it will guide u in this....

REPORT ZSTRING.

DATA: LENGTH TYPE I,

REMAINING_LENGTH TYPE I ,

NEXT_POINTER TYPE I ,

FIRST_HALF(25) TYPE C ,

SECOND_HALF(25) TYPE C ,

TEMP TYPE I .

PARAMETER: WORD(50) TYPE C . "INPUT WORD

START-OF-SELECTION.

LENGTH = STRLEN( WORD ). "Length of the input String

SEARCH WORD FOR '/'.

IF SY-SUBRC = 0 .

IF SY-FDPOS > 0.

MOVE WORD+0(SY-FDPOS) TO FIRST_HALF.

ENDIF.

TEMP = SY-FDPOS + 1.

IF TEMP <> LENGTH.

NEXT_POINTER = SY-FDPOS + 1.

REMAINING_LENGTH = ( LENGTH - SY-FDPOS ) - 1.

MOVE WORD+NEXT_POINTER(REMAINING_LENGTH) TO SECOND_HALF.

ENDIF.

ENDIF.

WRITE:/'Input String:', WORD

.

WRITE:/'First Half:', FIRST_HALF.

WRITE:/'Second Half:', SECOND_HALF.

*-- End of Program

Regards.

4 REPLIES 4
Read only

former_member194669
Active Contributor
0 Likes
506

Search for FM called RK*WORD_WRAP in SE37

aRs

Read only

0 Likes
506

how to display one string of sentence into the texteditcontrol?

Read only

0 Likes
506

I didn't get your reqirement fully? can u please explain more on this

aRs

Read only

Former Member
0 Likes
507

Hi,

Can u please check this code, i think it will guide u in this....

REPORT ZSTRING.

DATA: LENGTH TYPE I,

REMAINING_LENGTH TYPE I ,

NEXT_POINTER TYPE I ,

FIRST_HALF(25) TYPE C ,

SECOND_HALF(25) TYPE C ,

TEMP TYPE I .

PARAMETER: WORD(50) TYPE C . "INPUT WORD

START-OF-SELECTION.

LENGTH = STRLEN( WORD ). "Length of the input String

SEARCH WORD FOR '/'.

IF SY-SUBRC = 0 .

IF SY-FDPOS > 0.

MOVE WORD+0(SY-FDPOS) TO FIRST_HALF.

ENDIF.

TEMP = SY-FDPOS + 1.

IF TEMP <> LENGTH.

NEXT_POINTER = SY-FDPOS + 1.

REMAINING_LENGTH = ( LENGTH - SY-FDPOS ) - 1.

MOVE WORD+NEXT_POINTER(REMAINING_LENGTH) TO SECOND_HALF.

ENDIF.

ENDIF.

WRITE:/'Input String:', WORD

.

WRITE:/'First Half:', FIRST_HALF.

WRITE:/'Second Half:', SECOND_HALF.

*-- End of Program

Regards.