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: 

how to print long text in ALV

Former Member
0 Kudos

i want to print a description in text mode which is 5-6 lines some times it have a blank line also so

how to print in ALV .i m using READ_TEXT function but sumtime it not works when text exceed 4-5 lines

what i sud do.

7 REPLIES 7

Former Member
0 Kudos

Hi,

Use the Option STRLEN to find length of the string. Then use the FM TEXT_SPLIT and concatenate for ur reqrs.

Regards

Thiru

Former Member
0 Kudos

I think the data what you get by read_text can only handle data with 132 Char.

I suggest to write a direct select query and store it in a internal table

For this check your long text ->Header and check what kind of data comes in

Text

Text Id

Object

and Write a select query on the respective table and store it in internal table and display the data from it.

if you could specify for what kind of data your long text is stored can help you with the select query too

Regards

Bhanu Malik

0 Kudos

but we can print only one table in ALV . how to relete two table

0 Kudos

**but this conditon only apply if u wana show the data in single line.**

**I think u should use different variables to store different lines of the internal tables using sy-tabix**

**e,g**

**loop at ltext into wa_ltext**

**if sy-tabix =1**

**a = wa_ltext.**

**elseif sy-tabix = 2.**

**b = wa_text.**

**endif**

**endloop.**

    • ur alv field for ltext data.*

**concatenate a b into itab-ltext separat by spaces.**

**and then use field in ur alv.**

Edited by: ZAHID HAMEED on Apr 7, 2010 1:30 PM

Edited by: ZAHID HAMEED on Apr 7, 2010 1:34 PM

Edited by: ZAHID HAMEED on Apr 7, 2010 1:34 PM

0 Kudos

hi,

there is another way u can use yours internal table field like long text field. that is.

parameters: salno type vbak-vbeln.

data: begin of itab occurs 0,

vbeln type vbak-vbeln,

matnr type vbap-matnr,

longtext type thead occurs 0,

end of itab.

data: itabstxl type standard table of stxl with header line.

select single vbakvbeln vbapmatnr into (itab-vbeln, itab-matnr)

from vbak inner join vbap

on vbakvbeln = vbapvbeln

where vbak~vbeln = salno.

select single tdobject tdname tdid tdspras from stxl

into (itabstxl-tdobject,itabstxl-tdname,itabstxl-tdid,itabstxl-tdspras)

where relid = 'TX'

and tdobject = 'VBBK'

and tdname = salno "YOUR OWN TDNAME e,g

and tdid = 'Z003'

and tdspras = 'EN'.

call function 'READ_TEXT'

exporting

  • CLIENT = SY-MANDT

id = itabstxl-tdid

language = itabstxl-tdspras

name = itabstxl-tdname

object = itabstxl-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

tables

lines = itab-longtext

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

break abaper.

I HOPE THIS WILL SOLVE THIS WILL SOLVE THE PROBLEM OF THE OTHERS AS WELL.

0 Kudos

hi,

there is another way u can use yours internal table field like long text field. that is.

parameters: salno type vbak-vbeln.

data: begin of itab occurs 0,

vbeln type vbak-vbeln,

matnr type vbap-matnr,

longtext type thead occurs 0,

end of itab.

data: itabstxl type standard table of stxl with header line.

select single vbakvbeln vbapmatnr into (itab-vbeln, itab-matnr)

from vbak inner join vbap

on vbakvbeln = vbapvbeln

where vbak~vbeln = salno.

select single tdobject tdname tdid tdspras from stxl

into (itabstxl-tdobject,itabstxl-tdname,itabstxl-tdid,itabstxl-tdspras)

where relid = 'TX'

and tdobject = 'VBBK'

and tdname = salno "YOUR OWN TDNAME e,g

and tdid = 'Z003'

and tdspras = 'EN'.

call function 'READ_TEXT'

exporting

  • CLIENT = SY-MANDT

id = itabstxl-tdid

language = itabstxl-tdspras

name = itabstxl-tdname

object = itabstxl-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

tables

lines = itab-longtext

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

append itab.

break abaper.

I HOPE THIS WILL SOLVE THIS WILL SOLVE THE PROBLEM OF THE OTHERS AS WELL.

Former Member
0 Kudos

Try below code for formatting text which is extracted form function module "READ_TEXT"

data : g_br_string type string.
data : it_lines_br type standard table of tline.
data : wa_lines_br type tline.

call function 'FORMAT_TEXTLINES'
          exporting
            cursor_column = 0
            cursor_line   = 0
            endline       = 99999
            formatwidth   = 72
            linewidth     = 72
            startline     = 1
            language      = sy-langu
          tables
            lines         = it_lines_br.  "output of read_text"

clear g_br_string.
      loop at it_lines_br into wa_lines_br.
        concatenate g_br_string wa_lines_br into g_br_string.
        clear wa_lines_br.
      endloop.

Move g_br_string to <final internal table>-column.

Regards

Vinod