Skip to Content
0

Multiline Column Header in ALV Display

May 16, 2017 at 04:41 AM

384

avatar image
Former Member

Hi,

I need to display multiline header in alv display. I am using salv factory method for this. Below is the image of expected output. I need this using oops concept. Not traditional reuse_alv_grid_display method. The data to be displayed is stored in internal table with fileds:

1. Sales_ord_num

2. Start_date

3. End_date

4. First_name

5. last_name

Thanks.

cust-blocks.png (4.7 kB)
10 |10000 characters needed characters left characters exceeded

As a side note, personally, I try to avoid using ALV to emulate look and feel of Excel. E.g. in this example why do you have "Date" on top of the "Start Date" and "End Date"? Someone is not clear that those both are dates? What value does the second line really add?

In most cases I find that the users are quite happy to find that a longer label can be displayed in a tooltip. This keeps the screen uncluttered and custom reports somewhat standardized.

Just sayin'...

0
Former Member

You are right. But the actual data is not this. I am not displaying dates or customer name.It was just for demonstration purposes.

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Rajkumar Narasimman May 16, 2017 at 06:27 AM
0

Hi Karan,

For Multiple header, you can either use classical ALV or Hierarchical ALV (REUSE_ALV_HIERSEQ_LIST_DISPLAY CL_SALV_HIERSEQ_TABLE).

In Hierarchical ALV, we will pass two internal tables one for header and another for Item. When calling the FM just empty the Header internal table and pass the values in item internal table and display the output. Hope it works for your requirement.

Regards

Rajkumar Narasimman

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Raj,

Thanks for the reply. But this is not exactly what i am looking for. I have implemented alv using factory method and i do not want to change that.

Regards,

Karan

0
Sandra Rossi May 16, 2017 at 06:29 AM
0
Show 6 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi sandra,

Thanks for reply. In the link you provided, they are using cl_gui_alv_grid class and then adding methods to it. But i do not need this. I just want to achieve this using factory method.

Regards,

Karan

0

SALV is a wrapper of the ALV grid control. You have to retrieve the ALV grid control instance from SALV. For this, please refer to https://blogs.sap.com/2008/11/24/power-of-abap-objects-overcome-the-restrictions-of-salv-model/

0
Former Member

Hi Sandra,

Thanks for the input. I have created the code and it met my requirement. The issues i am facing are that:

1. I copied pf status from standard and it is showing icons correctly. But there is no code in pai. Can you tell how to copy standard code for pai?

2. The custom container is not displayed on screen fully.

Regards,

Karan

0

Well done!

Please, in the future, follow the forum rules: open a new question for a new question, with a link to this thread so that people get the context.

For 1 and 2: I guess you didn't do it well. I feel that you wanted to define a full screen ALV, and add custom buttons. If yes, then you don't need a custom container:

  • create the ALV full screen this way: CALL METHOD cl_salv_table=>factory IMPORTING r_salv_table = yourinstance CHANGING t_table = yourinternaltable.
  • pass the name of your copied GUI status using SET_SCREEN_STATUS of CL_SALV_TABLE
  • the additional buttons are to be handled by using the event ADDED_FUNCTION of CL_SALV_EVENTS_TABLE (instance to obtain using method GET_EVENTS of CL_SALV_TABLE).
  • call method DISPLAY of CL_SALV_TABLE
1
Former Member

Hi sandra,
I am following below the demonstrated prog:

demonstrated prog: http://www.tricktresor.de/wp-content/downloads/ALV/zz_alv_merge_cells.abap.txt.

But i am unable to get standard toolbar that appears when we use nomal or salv alv list/grid display. I have created new class and calling its z_display method as per the link.

Thanks

0

Hi, you should better open a new question, as per forum rules of engagement, with a link to this thread for providing the context.

Quickly, Enno Wulff defined the GUI status "0200", which contains the toolbar. In the new question, you should explain if you created it or not.

By the way, as says Enno Wulff, this tweak of ALV is not supported by SAP, and some functions cannot work correctly, like sorting, filtering, etc.

0