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: 

ALV Help plz urgent

Former Member
0 Kudos

Hi,

Can anyone help me with ALV that how to display ALV Column Heading in Multiple Line.

Means Multiple line Coulmn heading of ALV.

Please fell free to contact me at

usmanmalik_sap@yahoo.com

Regards,

Muhammad Usman Malik

SAP ABAP Consultant

Siemens Pakistan

+92-333-2700972

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ali,

call function 'REUSE_ALV_EVENTS_GET'

importing

et_events = it_event

exceptions

list_type_wrong = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

if not it_event[] is initial.

read table it_event into wa_event with key name = 'TOP_OF_PAGE'.

if sy-subrc = 0.

<b> wa_event-form = 'TOP_OF_PAGE'.</b>

modify it_event from wa_event index sy-tabix.

endif.

<b>*&----


*& Form TOP_OF_PAGE

*&----


  • TOP_OF_PAGE

*----


form top_of_page.

data : v_concate(50) type c.

data : v_space(10) type c.

concatenate 'VIKRANTH' 'rajesh' into v_concate.

wa_comment-typ = 'S'.

wa_comment-key = 'USER :'.

wa_comment-info = v_concate.

append wa_comment to it_comment.

wa_comment-typ = 'S'.

wa_comment-key = 'DATE:'.

wa_comment-info = sy-datum.

append wa_comment to it_comment.

wa_comment-typ = 'S'.

wa_comment-key = 'TIME:'.

wa_comment-info = sy-timlo.

append wa_comment to it_comment.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = it_comment.

clear it_comment.

endform. "TOP_OF_PAGE</b>

Thanks

Vikranth Khimavath

7 REPLIES 7

Former Member
0 Kudos

sorry you cannot do that.

if it is in top-of-page then you can do by hiding the coloumn heading.

regards

shiba dutta

Former Member
0 Kudos

Welcome to SDN.

Copy Paste below code and execute the same. The output contains mutiple lines in header but I dont know how to do it in ALV. May be of some help to you.

REPORT ztestvib MESSAGE-ID zz LINE-SIZE 50.

TYPE-POOLS: slis.

DATA: x_fieldcat TYPE slis_fieldcat_alv,

it_fieldcat TYPE slis_t_fieldcat_alv,

l_layout TYPE slis_layout_alv,

x_events TYPE slis_alv_event,

it_events TYPE slis_t_event.

DATA: BEGIN OF itab OCCURS 0,

vbeln LIKE vbak-vbeln,

posnr LIKE vbap-posnr,

male TYPE i,

female TYPE i,

END OF itab.

SELECT vbeln

posnr

FROM vbap

UP TO 20 ROWS

INTO TABLE itab.

x_fieldcat-fieldname = 'VBELN'.

x_fieldcat-seltext_l = 'VBELN'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 1.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

x_fieldcat-fieldname = 'POSNR'.

x_fieldcat-seltext_l = 'POSNR'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 2.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

x_fieldcat-fieldname = 'MALE'.

x_fieldcat-seltext_l = 'MALE'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 3.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

x_fieldcat-fieldname = 'FEMALE'.

x_fieldcat-seltext_l = 'FEMALE'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 3.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

x_events-name = slis_ev_top_of_page.

x_events-form = 'TOP_OF_PAGE'.

APPEND x_events TO it_events.

CLEAR x_events .

l_layout-no_colhead = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = l_layout

it_fieldcat = it_fieldcat

it_events = it_events

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

&----


*& Form top_of_page

&----


  • text

----


FORM top_of_page.

*-To display the headers for main list

FORMAT COLOR COL_HEADING.

WRITE: / sy-uline(103).

WRITE: / sy-vline,

(8) ' ' ,

sy-vline,

(8) ' ' ,

sy-vline,

(19) 'SEX'(015) CENTERED,

sy-vline.

WRITE: / sy-vline,

(8) 'VBELN'(013) ,

sy-vline,

(8) 'POSNR'(014) ,

sy-vline,

(8) 'MALE'(016) ,

sy-vline,

(8) 'FMALE'(017) ,

sy-vline.

FORMAT COLOR OFF.

ENDFORM. "top_of_page

0 Kudos

Thank you very much

got it

Former Member
0 Kudos

hiusman,

just copy and paste below code. this is my sample program it is working fine.

*****************************************

REPORT ZMAHI_HEADING LINE-SIZE 50..

TYPE-POOLS: SLIS.

DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

L_LAYOUT TYPE SLIS_LAYOUT_ALV,

IT_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN LIKE VBAK-VBELN,

POSNR LIKE VBAP-POSNR,

MALE TYPE I,

FEMALE TYPE I,

END OF ITAB.

SELECT VBELN POSNR FROM VBAP UP TO 10 ROWS INTO TABLE ITAB.

X_FIELDCAT-FIELDNAME = 'VBELN'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 1.

X_FIELDCAT-HOTSPOT = 'X'.

X_FIELDCAT-OUTPUTLEN = 10 .

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'POSNR'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 2."1.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'MALE'.

X_FIELDCAT-OUTPUTLEN = 14 .

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 3.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'FEMALE'.

X_FIELDCAT-OUTPUTLEN = 15 .

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 3.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

IT_EVENTS-NAME = 'TOP_OF_PAGE'."SLIS_EV_TOP_OF_PAGE.

IT_EVENTS-FORM = 'TOP_OF_PAGE'.

APPEND IT_EVENTS.

CLEAR IT_EVENTS .

L_LAYOUT-NO_COLHEAD = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = L_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

IT_EVENTS = IT_EVENTS[]

TABLES

T_OUTTAB = ITAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

&----


*& Form TOP_OF_PAGE

&----


FORM TOP_OF_PAGE.

*-To display the headers for main list

FORMAT COLOR COL_HEADING.

WRITE: / SY-ULINE(54).

WRITE: / SY-VLINE,

(8) 'SALES',

SY-VLINE,

(8) 'LINE'(021),

SY-VLINE,

(28) 'NATIONALITY' CENTERED,

SY-VLINE.

WRITE: / SY-VLINE,

(8) 'ORDER', "'PLANE'(053) ,

SY-VLINE,

(8) 'ITEM'(056) ,

SY-VLINE,

(12) 'INDIAN'(070) ,

SY-VLINE,

(13) 'MUSLIM'(077) ,

SY-VLINE.

FORMAT COLOR OFF.

ENDFORM. "TOP_OF_PAGE

thanks,

maheedhar.t

0 Kudos

Hi People,

i got multiple lines but the Functionality of ALV is not working here. if there is something missing in the code u people sended then plz update it.

thanks

Usman Malik

0 Kudos

can u plz explain the problem once again so i can help you.

thanks,

maheedhar.t

Former Member
0 Kudos

Hi Ali,

call function 'REUSE_ALV_EVENTS_GET'

importing

et_events = it_event

exceptions

list_type_wrong = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

if not it_event[] is initial.

read table it_event into wa_event with key name = 'TOP_OF_PAGE'.

if sy-subrc = 0.

<b> wa_event-form = 'TOP_OF_PAGE'.</b>

modify it_event from wa_event index sy-tabix.

endif.

<b>*&----


*& Form TOP_OF_PAGE

*&----


  • TOP_OF_PAGE

*----


form top_of_page.

data : v_concate(50) type c.

data : v_space(10) type c.

concatenate 'VIKRANTH' 'rajesh' into v_concate.

wa_comment-typ = 'S'.

wa_comment-key = 'USER :'.

wa_comment-info = v_concate.

append wa_comment to it_comment.

wa_comment-typ = 'S'.

wa_comment-key = 'DATE:'.

wa_comment-info = sy-datum.

append wa_comment to it_comment.

wa_comment-typ = 'S'.

wa_comment-key = 'TIME:'.

wa_comment-info = sy-timlo.

append wa_comment to it_comment.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = it_comment.

clear it_comment.

endform. "TOP_OF_PAGE</b>

Thanks

Vikranth Khimavath