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

text wrapping issue

Former Member
0 Likes
1,516

Hi folks,

I have an issue related to text wrap. I am reading the set of text data using the function module below.

data: begin of WA_LINES occurs 0.

include structure TLINE.

data: end of WA_LINES.

DATA: output(200),

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

id = 'PAOF'

language = 'E'

name = adv_tbl-IDTXT

object = 'TEXT'

ARCHIVE_HANDLE = 0

  • IMPORTING

  • header = header

TABLES

lines = WA_lines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

loop at wa_lines

for example if the first two lines of the data in 'wa_lines' is something like this..

1. The job requires an expertise in word processing. The person should be

2. excellent in communication skills and good knowledge of basic programming

3. skills in certain software tools.

when I write the data into a file

it appears as

The job requires an expertise in word processing. The person should <b>beexcellent</b> in communication skills and good knowledge of basic <b>programmingskills</b> in certain software tools.

The text wraps up at the end of the line and provides no space when reading the data from the second line

Hence I added the code

concatenate v_space wa_lines-tdline into output. it did not work.

How can I insert the space before reading the next line?

Thanks,

SK

7 REPLIES 7
Read only

Former Member
0 Likes
1,095

Can you please post the code where you write to the file?

Read only

0 Likes
1,095

Hi,

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

LOGICAL_FILENAME = 'ABC'

IMPORTING

FILE_NAME = FNAME.

OPEN DATASET FNAME FOR OUTPUT in binary mode MESSAGE msg.

IF sy-subrc <> 0.

WRITE / msg.

STOP.

ENDIF.

            • AFTER ADDING THE DATA TO 'output'

l = strlen( output ).

TRANSFER output TO FNAME length l.

Thanks for the quick reply,

SK

Read only

0 Likes
1,095

hi,

instead of

concatenate v_space wa_lines-tdline into output

use

concatenate whatever whatever separated by space.

Read only

Former Member
0 Likes
1,095

I had same type of issue ,use FM SWA_STRING_SPLIT after READ_TEXT FM.

See the code below :

loop at WA_lines

concatenate all the text into one string separted by space .assume string is descrip.

endloop.

data: itab_d like swastrtab occurs 0 with header line.

data: descrip type string.

CALL FUNCTION 'SWA_STRING_SPLIT'

EXPORTING

INPUT_STRING = descrip

MAX_COMPONENT_LENGTH = 25 -> <b>here you can metion length for each line</b>* TERMINATING_SEPARATORS =

  • OPENING_SEPARATORS =

TABLES

STRING_COMPONENTS = itab_d

  • EXCEPTIONS

  • MAX_COMPONENT_LENGTH_INVALID = 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.

now download itab_d internal table..

Thanks

Seshu

Read only

0 Likes
1,095

I shall try that and get back.

Thanks,

SK

Read only

0 Likes
1,095

hi seshu,

I have the code going like this...

loop at wa_lines from 2.

if wa_lines-tdline ne ' ' or not ( wa_lines-tdline is initial ).

if ( wa_lines-tdline(20) = 'POSITION DESCRIPTION' ) .

concatenate wa_lines-tdline '|' into output.

elseif

( ( wa_lines-tdline(17) = 'SKILL REQUIREMENT' ).

concatenate '|' wa_lines-tdline '|' into output.

else.

            • here is where I need that functionality How can i add that piece here?

output = wa_lines-tdline.

endif.

l = strlen( output ).

TRANSFER output TO FNAME length l.

clear: output, l.

endif.

endloop.

from the code it is evident that I do not want the entire text data coming from WA_LINES to be wrapped, only the data in few lines in the middle that has the job description that run into 3 to 4 lines (that does not satisfy the first two 'if' conditions need such functionality).

How can i do that without disturbing the flow ?

Any help would be really appreciated.

Thanks,

SK

Read only

Former Member
0 Likes
1,095

Thanks it helped. I figured it out. I shall ward th epoints here.

SK