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 display multiple lines of texts in a single rows in ALV

Former Member

Hi,

I have a unique requirement in which i have to display multiple lines if texts for a single rows in ALV Grid. Right now in my output it is coming in single line which is not visible fully because that text is more than 255 character. So i want to display the test by splitting into multiple lines and show it on output. Please suggest some solution for this if this is possible in ALV.

Thanks,

Raghav

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this thread, it may help you

Regards,

Selva

9 REPLIES 9

nirajgadre
Active Contributor
0 Kudos

Hi,

I guess it is not possible to display the multiple lines on the single line of the ALV grid.

Try to create the hotspot in one of the column in the ALV display and call the POP up screen to display the required text in that pop up on the selection of particular line in at user command event.

Former Member
0 Kudos

Hi,

Check this thread, it may help you

Regards,

Selva

Former Member
0 Kudos

Hi,

I don't think this is possible in ALV.

You can split the text at say 25 chars and populate the internal table in the next records

(all other fields in the next record will be blank)

Ex: If your field has 'abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxy' ...

the first record will contain 'abcdefghijklmnopqrstuvwxy' along with other field values and the second record

will contain only 'abcdefghijklmnopqrstuvwxy'.

Field1 Field2 Field3

A XXX abcdefghijklmnopqrstuvwxy

abcdefghijklmnopqrstuvwxy ...

Regards,

Srini.

Former Member
0 Kudos

Hi Raghavendra,

Its not possible to display multiple line in one row of an alv, but i think you can acheive it by splitting the whole text into multiple sub-text.

For example, if your requirement is as below:

Field #1 Field #2

1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(200 characters)

2 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(220 character)

then you can break Field#2 value into say 50 character and then populate the internal table with repetative entries of Field#1 and the finally sort it by Field#1 value... as a result of which you output will be somewhat as below:

Field#1 Field#2

1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

2 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

yyyyyyyyyyyyyyyyyyyy

Hope it will help you in meeting your requirement.

Regards,

Shradha

Former Member
0 Kudos

Hi Raghvendra,

This is possible in alv_list_display. I m not sure about the alv grid.

When creating the field catalog give the row no as well to ur field.

1. Take example of matnr. its length is 18 char and u want to show this into two separeate line with length 9 char each.

2. In ur internal table add another field MAT_9 with 9 char.

3. While defining fieldcatalog define ur Mat_9 as

Ex: LS_FIELDCAT-FIELDNAME = 'Mat_9'.

LS_FIELDCAT-ROW_POS = 2.

LS_FIELDCAT-col_POS = Same as matnr.

APPEND LS_FIELDCAT TO XT_FIELDCAT.

4. Now set the output length of both of them as 9 char.

LS_FIELDCAT-OUTPUTLEN = 9.

5. Give the column position for mat_9 same as Mat. so that when data will overflow it will populated in the next column.

6. Pass the int. table and filedcat in ur ALV display function module.

7 Hope this will help u.

Rudhir

Former Member
0 Kudos

Hi,

Just want to rewrite the point 5.

5. Give the column position for mat_9 same as Mat. so that when data will overflow it will populated in the next row.

Sorry for inconvenience.

Rudhir

0 Kudos

Hi,

Try this.

REPORT <Report Name> NO STANDARD PAGE HEADING line-SIZE <linesize>.

Also try to use SCROLL LIST Statement.


AT LINE-SELECTION. 
  CALL SELECTION-SCREEN 500 STARTING AT 10 10. 
  SCROLL LIST TO COLUMN sy-staco 
              TO PAGE page LINE sy-staro. 

0 Kudos

Sometimes i think i arrived at The Twilight Zone.. where i can make heads nor tails from the relevancy between question and answer.

Good laugh though...

Former Member
0 Kudos

If you use the "Excel inplace" to display the output, this will work but it won't look correct in ALV view.

I do this via function module RKD_WORD_WRAP. This splits the text without splitting the words in the text. Then I recreate the string from the output...



DATA: lt_lines TYPE STANDARD TABLE OF tline-tdline,
            lv_old_text(200) TYPE c VALUE 'asdklf jkas jd fjasl fasdf l jasd fhiasd jklf hasjkh fu ihas jkfh jdhf jh', "your text is here
            lv_new_text TYPE string,
            lv_line TYPE tline-tdline.

  CALL FUNCTION 'RKD_WORD_WRAP'
    EXPORTING
      textline  = lv_old_text    "the old text with no split
      outputlen = 10            "the max. length of the new lines
    TABLES
      out_lines = lt_lines.         "the split lines

  LOOP AT lt_lines INTO lv_line.
    IF lv_new_text IS INITIAL.
      lv_new_text = lv_line.
    ELSE.
      CONCATENATE lv_new_text cl_abap_char_utilities=>newline lv_line INTO lv_new_text.
    ENDIF.
  ENDLOOP.