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 Header

Former Member
0 Kudos

Hello all,

I need to create a multiline ALV Header line the following

B C D

A B1 B2 B3 C1 C2 C3 D1 D2 D3

The values are in a single row. What i need is just to place the (B1, B2, B3) group bellow a cell identifying B.

How can i do this?

Thank you

Nuno Miguel Silva

7 REPLIES 7

former_member181995
Active Contributor
0 Kudos

Nuno,

i would suggest you to use Classical report rahter than ALV to achieve this.it would be easier.

Amit.

Former Member
0 Kudos

hi check this...

i hope we can write different headings on the header line in one single line but not in multi lines...

http://www.sap-img.com/fu037.htm

Former Member
0 Kudos

I don't think its possible ..

Former Member
0 Kudos

Hi,

This is not possible...

But for Alv header refer to following link,

http://www.sap-img.com/fu037.htm

Regards,

Dhan

former_member184657
Active Contributor

Former Member
0 Kudos

Hi,

It is possible but a bit tricky, you have to use two FM's at the same time, but it is for list display not grid display,

There is a FM , REUSE_ALV_BLOCK

I cant remember the exact name , better if you can search it in SE37, Using this you can display two ALV in the same screen, Now after that you set the second ALV for the Second header and DATA, The first one wont contain any DATA but only the HEADER LINE. You can do it by changing the field catalog properties of the first one, If i can find the code i will give you. But remember one thing you have to do it , by calling that FM twice, if you need 3 Lines you have to call it 3 times.

Regards,

Khan.

former_member188685
Active Contributor
0 Kudos

You can do this using ALV list with some extra coding..

But in other cases(Grid etc it is not possible).

If you use this aproach you will loose some Functionalities, Your Report Output will Distorted.

cehck this image..

http://img100.imageshack.us/img100/3846/output6ef.th.gif

REPORT ZTEST_ALV message-id zz .
 
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.
 
*-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.

or else go for Hierarchy Report.