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

CL_GUI_ALV_GRID - word wrap functionality

Pavithrra
Participant
0 Likes
2,134

Dear Team,

I have a requirement where i need to display the long text in the output table in the last column like the below format:

Here is the text1

Line 2

Line 3

Line 4

Is it possible to populate the above format in the class CL_GUI_ALV_GRID- >set_table_for_first_display.

Currently, I have used the word wrap functionality and populated inside the internal table but not sure how to proceed further in the fieldcatalog,

I have checked in the other  threads they mentioned about the Reuse_alv_list_display and Reuse_alv_grid_dispaly.

Sorry I am new to this ALV coding. Thanks for your time in advance, Can you please help me.

Thanks,

Pavi

1 ACCEPTED SOLUTION
Read only

guilherme_frisoni
Contributor
0 Likes
1,784

Hi Pavithrra,

what you want is not possible.

You wont be able to word wrap texts inside a specific cell in ALV.

I kindly suggest a cell first N chars and with a hotspot function. When clicked you open a popup with the complete text.

Regards,

Frisoni

8 REPLIES 8
Read only

Former Member
0 Likes
1,784

Hi Pavithra,

Try with END OF LIST Event

Regards

Thulasi

Read only

0 Likes
1,784

Thanks Thulasi,

Read only

guilherme_frisoni
Contributor
0 Likes
1,785

Hi Pavithrra,

what you want is not possible.

You wont be able to word wrap texts inside a specific cell in ALV.

I kindly suggest a cell first N chars and with a hotspot function. When clicked you open a popup with the complete text.

Regards,

Frisoni

Read only

0 Likes
1,784

THanks  Guilherme Frisoni. Currently, I am doing in the similar way as you said but do you have any sample code to show the text in the hotspot. I have concatenated them inside the cell.


Regards,

Pavithrra

Read only

0 Likes
1,784

Hi Pavithrra,

you can use this FM:

              CALL FUNCTION 'ISU_POPUP_TEXT_EDIT'
                 EXPORTING
                   x_title       = 'Title'
                   x_no_change   = 'X'
                 CHANGING
                   xy_texttab    = gt_text
                 EXCEPTIONS
                   general_fault = 1
                   OTHERS        = 2.

Where GT_TEXT is a table with your text, similar to text table returned in READ_TEXT FM.

Regards,

Frisoni

Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,784

Hi,

Try to append the internal table as required.

 

TYPES:

BEGIN   of ty_tab,

order    type c,

item     type c,

END OF ty_tab,

BEGIN OF ty_final.

INCLUDE type ty_tab.

TYPES: text type string,

END OF ty_final.

DATA: it_tab type table of ty_tab,

       wa_tab like line of  it_tab,

       it_final type table of ty_final,

       wa_final like line  of it_final,

       lv_flag  type c.

START-OF-SELECTION.

DO 5 TIMES.

wa_tab-order = 1.

wa_tab-item  = sy-index.

append wa_tab to it_tab.

ENDDO.

SORT it_tab by order ascending.

loop at it_tab into wa_tab.

CLEAR lv_flag.

MOVE-CORRESPONDING wa_tab to wa_final.

AT END OF order.

PERFORM get_text using    wa_tab-order

                  changing lv_flag.

ENDAT.

IF lv_flag IS INITIAL.

APPEND wa_final to it_final.

CLEAR  wa_final.

ENDIF.

endloop.

FORM GET_TEXT  USING  value(P_WA_TAB_ORDER)

                CHANGING P_LV_FLAG.

wa_final-text = 'Service Engineer Name'.

append wa_final to it_final.

wa_final-text = 'ABC'.

append wa_final to it_final.

P_LV_FLAG = 'X'.

ENDFORM.                    " GET_TEXT

Hope it helpful.

Regards,

Venkat.

Read only

0 Likes
1,784

Hi,

In class: CL_GUI_ALV_GRID there is attribute : CO_WEBSTYLE_WRAP

it might be helpful for you

Read only

0 Likes
1,784

Thanks Venkat  for your time. I will try this option also in a separate program.