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: 

Mergecell functionality in OOPS ALV

Former Member
0 Kudos

Hi:

Is there any method through which we can apply the mergecell funcitonality in ALV like similarly we do in MS-Excel.

2 REPLIES 2

Former Member
0 Kudos

hI

In order to display an ALV report with specific columns already sorted by default you will need to build a

sort catalogue. This is fairly straight forward and is done in the following way:

Step 1. Add data declaration for sort catalogue

Step 2. Add code to build sort catalogue table

Step 3. Update 'gd_tree->set_table_for_first_display' method call to include parameter 'it_sort'

  • ALV data declarations

data: it_sortcat type LVC_T_SORT,

it_sortcatdb type LVC_T_SORT.

perform build_sortcat.

&----


*& Form build_sortcat

&----


  • Build Sort catalog

----


FORM build_sortcat .

wa_sort-spos = 1.

wa_sort-fieldname = 'EBELN'.

wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field

  • gd_sortcat-tabname

APPEND wa_sort TO it_sortcat.

wa_sort-spos = 2.

wa_sort-fieldname = 'EBELP'.

  • gd_sortcat-tabname

APPEND wa_sort TO it_sortcat.

ENDFORM. " build_sortcat

CALL METHOD gd_tree->set_table_for_first_display

EXPORTING

is_layout = gd_layout

CHANGING

it_fieldcatalog = gd_fieldcat

it_sort = it_sortcat

it_outtab = it_report.

0 Kudos

Hi Naresh;

Thanks. Your answer was eally helpful. I need one more functionality in it. When it'll sort, it'll will remove the extra lines with blank contents. I've a requirement that those line should not disappear.

e.g. current functionality...

a

-

a

-

a

-

b

-

b

-

c

-

it'll be like

a

b

c

but I want like

a

-

-

-

b

-

c

Please suggest