05-12-2009 10:32 AM
Hi,
I have a requirement wherein I need to display 2 headers using ALV Grid. I am using cl_gui_alv_grid->set_table_for_first display.
Header1 Header2
Col1 Col2 Col3 Col4 Col5
1 2 3 4 5
Please suggest if this is possible, if yes, how to acheive it.
Thanks,
Smita
05-12-2009 2:13 PM
This is not achieveable if you use the header created by the ALV. You need to create headers in the Splitter container.
Create a Splitter container with 2 Rows first. In the first Row, create 2 columns. Now, use these two container to display your Headers. User the Bottom part for the ALV.
Check Report RSDEMO_SPLITTER_CONTROL for Splitter control.
Regards,
Naimesh Patel
05-20-2009 12:33 PM
HI nimish,
please develop a smal gm. so tha it will help full for us..
05-14-2009 1:00 PM
Hi,
just check out this program BCALV_TEST_HIERSEQ_LIST_EVENTS,must be possible with small manupulations.
05-15-2009 4:00 PM
Hello Smita,
I suppose there is no direct way to achieve this. I once simulated this by using two ALV grids. The first grid only displayed the header and the second grid both the header and the rows. However my requirement was simple as no toolbar or title was required for the grid.
[Simulating a grid with 2 headers|http://picasaweb.google.com/lh/photo/UufBPgLYLkKjhuDV6CYtwg?feat=directlink]
Hope this helps.
Thank you,
Ramneek
05-20-2009 12:32 PM
HI RAM,
I have did same like what you said. but iam not getting. Below is the pgm what i have dev. please correct it and let me knwo.
TYPE-POOLS: SLIS.
DATA: I_CATLOG TYPE slis_t_fieldcat_alv,
W_CATLOG TYPE SLIS_FIELDCAT_ALV,
I_CATLOG2 TYPE slis_t_fieldcat_alv,
W_CATLOG2 TYPE SLIS_FIELDCAT_ALV,
V_PGM TYPE SY-REPID.
data: begin of itab1 occurs 0,
HEADER1(10) TYPE C,
HEADER2(10) TYPE C,
end of itab1.
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
MATNR LIKE VBAP-MATNR,
MATWA LIKE VBAP-MATWA,
end of itab.
select vbeln
posnr
MATNR
MATWA
from vbap
up to 20 rows
into table itab.
w_catlog-seltext_l = 'HEADER1'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 10.
W_CATLOG-tabname = 'ITAB1'.
append w_catlog2 to i_catlog2.
clear w_catlog2.
w_catlog-seltext_l = 'HEADER2'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 10.
W_CATLOG-tabname = 'ITAB1'.
append w_catlog2 to i_catlog2.
clear w_catlog2.
*----
w_catlog-seltext_l = 'Sales Document'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 10.
w_catlog-fieldname = 'VBELN'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
w_catlog-seltext_l = 'ITEM'.
w_catlog-datatype = 'NUMC'.
w_catlog-outputlen = 6.
w_catlog-fieldname = 'POSNR'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
w_catlog-seltext_l = 'MATERIAL'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 18.
w_catlog-fieldname = 'MATNR'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
w_catlog-seltext_l = 'Material entered'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 18.
w_catlog-fieldname = 'MATWA'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_PGM
IT_FIELDCAT = I_CATLOG2
TABLES
T_OUTTAB = ITAB1
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.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_PGM
IT_FIELDCAT = I_CATLOG
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.
05-20-2009 2:46 PM
Well I don't think you can use the function 'REUSE_ALV_GRID_DISPLAY' twice in the same report to display two ALV grids. You will have to create a screen with two grids and then call this screen in your report to display the two grids.
Please do let me know if you need more information on this.
Thank you,
Ramneek
05-21-2009 6:50 AM
Hi,
I hope it is possible with ALV list display only.
REPORT ZSAI_ALV_5.
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.
BREAK-POINT.
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.
Edited by: sai kumar B on May 21, 2009 7:55 AM
05-21-2009 9:07 PM
No way. It is not possible in ALV. But you can do in different manner. That is append the header values in the internal table at first 2 record and make the color differentiate using ALV.
---
Ravi