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: 

Display two lines under one column in ALV

Former Member
0 Kudos

Hello Friends,

I have a situation... i need to display two or three lines under single column in ALV report.

example:

col1 col2 col3 col4

AAA 10 456.78 TEST PURPOSE HBDFJEHBEJBE EBDF B EFH

EDEHFKHEKFHEKJCFEKJFHKEJHFKEHFEFJK

DJFHGCGD

AAA 20 121.78 TEST PURPOSE HBDFJEHBEJBE EBDF B EFH

BBB 10 11.78 TEST PURPOSE HBDFJEHBEJBE EBDF B EFH EJ

EFKBEJF KEFHEKJFHEJ KFEHKE HFKEH

MEFBHEJFB EFBEJ EFGJEGF JEGFEGEKJE KEFHK

EFKEFEKLKL

Anyone has idea?

Thanks in advance

Regards

Raghu

6 REPLIES 6

Former Member
0 Kudos

output should be like below...

Col1 || col2 || col3 || col4

AAA || 10 || 12.44 || ABCDEFGHIJKLMNOPQR

DMBKSDNK DKEJWHDK

SDBWJKB

0 Kudos

col4 may contains two or three lines.

how can I acheive this?

0 Kudos

Thanks for your reply.

with your code my purpose was not solved.

ALV should display like below..... col4 might be number of lines . all lines should disply in one column. like wrap text in excel.

========||========||=========||========================||

COL1........||COL2.......||COL3..........||COL4.......................................||

========||========||=========||========================||

A..............||10............||10.25.........||TEXT LINE1-----XXXXXXXXXXX||

................||................||.................||XXXXXXXXXXXXXXXXXXXXXX||

................||................||.................||XXXXXXXXXXXXXXXXXXXXXX||

=====================================================

A.............||20.............||45..............||XXXXXXXXXXXXXXXXXXXXXX||

=====================================================

pls help me.

thanks

raghu

Edited by: Raghunath.b on Nov 21, 2008 5:13 PM

Edited by: Raghunath.b on Nov 21, 2008 5:18 PM

0 Kudos

It is not possible to put more than one line into one cell of the ALV.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

You can do this by doing some additional coding..

Ex..

**  Let's assume you are using the internal table t_output for displaying the ALV...
**  and t_final contains the data..t_text which contains the multiple lines texts...for the
** column col4...

     DATA: s_output LIKE LINE OF t_output.
     DATA: v_flag      TYPE xfeld.

     LOOP AT t_final INTO s_final.

* Clear the work areas.
        CLEAR: v_flag,
                     s_output.

* Move all the data.
       MOVE ls_final TO s_output.

        LOOP AT t_text WHERE col1 = s_final-col1.

* First time move all the columns to the output internal table...for the rest of the records 
* just populate the col4..

            IF v_flag IS INITIAL.                     " For the first time.
               s_output-col4 = t_text-text.         " Move the text.
               APPEND s_output TO t_output.
               v_flag = 'X'.
            ELSE.
               clear s_output.
               s_output-col4 = t_text-text.         " Move the text.
               APPEND s_output TO t_output.
            ENDIF.

        ENDLOOP.

* IF there is no text found just append the output internal table with blank col4.
        IF sy-subrc <> 0.
               APPEND s_output TO t_output.
        ENDIF.

     ENDLOOP.

Hope the example is clear...

Thanks

Naren

raymond_giuseppi
Active Contributor
0 Kudos

(if grid) Just declare col1-3 as sort keys (programmatically or by defining a default variant) and split the text to append as many lines as necessary, by default the ALV wont display them when they have identical values (add an hidden field to keep the text sorted)

DATA

col1_col2_col3_col4_____i
A____10___10___aaaaaaaa_1
A____10___10___bbbbbbbb_2
A____10___20___cccccccc_1
B____10___10___dddddddd_1

ALV should look like

col1_col2_col3_col4____
A____10___10___aaaaaaaa
_______________bbbbbbbb
__________20___cccccccc
B____10___10___dddddddd

Regards