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: 

long text in reportoutput

Former Member
0 Kudos
83

Hi Experts:

iam designing a report on cost center details.

in report output i nedd to display fields order nuber, allocation, hours and with assosiated long text .

the text is coming by using FM 'READ_TEXT_INLINE'.

in the FM the text is storing in paramaters tables ( INLINES, LINES --internal tables) my text contain morethan 300 characters , which is stored in internal table LINES as 19 rows )

now my query is i want to display this text in report output because the user wants to export the test in excel file.

please tell me how can i write the logic for this.

output format

order no allocation hours ltext.

1

2

3

4

regards

neeru

3 REPLIES 3

Former Member
0 Kudos
48

Hi Neeru,

I too worked on the same scenario. here you will be getting the text into the internal table here you need to wrap the using the FM, by giving how much length you want to accoomodate for each row and then move that to actual internal table which should be sent to Excel sheet.

if you want some more details, ask me i can clarify.

cheers,

Priya

0 Kudos
48

Hi Swapna,

thanks for your reply.

>>>you need to wrap the using the FM.

can u explain the logic in moredetail.

my output may contain morethan 20 lines. (planing to use grid display)

so for each line the assosiated text may be displayed ( even if it is not diplayed in output, but at least the user want too see full text in Excel file).

possible send me some sample code

regards

neeru

0 Kudos
48

Hi Neeru,

Once you get the text from the FM 'READ_TEXT_INLINE', you move that to one internal table, here it is IT_T_ALL, this internal table can be moved to the FM 'REUSE_ALV_GRID_DISPLAY' for grid display but for Excel sheet download you need to do the below part, move the content to IT_OUT table and Wrap the text using the below FM, based upon the line size you can give the output length field, here it is 85. Usually length of the string will be 255 so i took 85 so that it can be splitted into 3 lines. IT_OUT is the output table, which you are sending it to the FM for Excel Download.

  • Moving DATA to final Download File

LOOP AT IT_T_ALL.

CLEAR: V_TEXT,V_TEXT1,V_TEXT2,V_TEXT3,V_TEXT4,V_TEXT5.

<b>you should move all your table fields to table IT_OUT</b>

MOVE IT_T_ALL-PERNR TO IT_OUT-PERNR. "Employee number

MOVE IT_T_ALL-BUKRS TO IT_OUT-BUKRS. "Comapny Code

MOVE IT_T_ALL-BUTXT TO IT_OUT-BUTXT. "Comapny Code Desc

IF NOT IT_T_ALL-MTEXT IS INITIAL.

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

TEXTLINE = it_t_all-mtext

DELIMITER = ' '

OUTPUTLEN = 85

IMPORTING

OUT_LINE1 = V_TEXT

OUT_LINE2 = V_TEXT1

OUT_LINE3 = V_TEXT2

  • TABLES

  • OUT_LINES = it_out

EXCEPTIONS

OUTPUTLEN_TOO_LARGE = 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.

ELSE.

MOVE ' ' TO IT_OUT-MTEXT.

MOVE ' ' TO IT_OUT-MTEXT1.

APPEND IT_OUT.

CONTINUE.

ENDIF.

IF NOT IT_T_ALL-MTEXT IS INITIAL.

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

TEXTLINE = it_t_all-mtext1

DELIMITER = ' '

OUTPUTLEN = 85

IMPORTING

OUT_LINE1 = V_TEXT3

OUT_LINE2 = V_TEXT4

OUT_LINE3 = V_TEXT5

  • TABLES

  • OUT_LINES =

EXCEPTIONS

OUTPUTLEN_TOO_LARGE = 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.

ENDIF.

MOVE v_text TO IT_OUT-MTEXT.

MOVE v_text3 TO IT_OUT-MTEXT1.

APPEND IT_OUT.

CLEAR IT_OUT.

IF v_text1 IS NOT INITIAL OR v_text4 IS NOT INITIAL.

MOVE v_text1 TO IT_OUT-MTEXT.

MOVE v_text4 TO IT_OUT-MTEXT1.

APPEND IT_OUT.

CLEAR IT_OUT.

ELSE.

CONTINUE.

ENDIF.

IF v_text2 IS NOT INITIAL OR v_text5 IS NOT INITIAL.

MOVE v_text2 TO IT_OUT-MTEXT.

MOVE v_text5 TO IT_OUT-MTEXT1.

APPEND IT_OUT.

CLEAR IT_OUT.

ELSE.

CONTINUE.

ENDIF.

ENDLOOP.

ELSE.

MESSAGE I113(ZR).

EXIT.

ENDIF.

ENDFORM. " GET_EMP_DATA

See the coding and try to understand what I'm doing.

the out put will be like this

<b>

empno Company Code Comapny Code desc Text</b>

100567 US200 North America you

have to split it

up to 3 line

100570 US200 North America xxxxxxxxxxxxx

xxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxx

Hope this helps.

Priya

<b>Note:</b>there is some formatting problem, but Excel sheet should show you the output as first line with details including Text field and next 2 lines with only with the remaining text under the TEXT field and while keeping remaining fields blank, once the text is completed then once again fresh row with details should be shown.