05-16-2007 10:23 AM
i want to have layout described below using ALV,,is it feasible,
Management
Joininees Separations
2 3
4 1
i.e. i want to have Management as fixed header. and joinees & separations are the fields in Internal table.
05-16-2007 10:27 AM
Hello,
U can acheive this using Hierarchical list desplay
Check this :
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
i_callback_program = v_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
is_layout = wa_layout
it_fieldcat = lt_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_DEFAULT = 'X'
i_save = 'X'
* IS_VARIANT =
it_events = lt_events
* IT_EVENT_EXIT =
i_tabname_header = 'T_HEADER'
i_tabname_item = 'T_ITEM'
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
is_keyinfo = lv_keyinfo
* IS_PRINT =
* IS_REPREP_ID =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = it_header
t_outtab_item = it_item
exceptions
program_error = 1
others = 2.
Regards,
Deepu.K
05-16-2007 10:25 AM
Hi,
Yes you can do this using ALV.
Reward points if it is helpful.
Regards,
Sangeetha.A
05-16-2007 10:26 AM
using function module REUSE_ALV_COMMENTARY_WRITE. for ALV header.
sample code for it
FORM TOP_OF_PAGE.
DATA : P_REPORT_HEADER TYPE SLIS_T_LISTHEADER,
P_REPORT_FOOTER TYPE SLIS_T_LISTHEADER,
GS_LINE TYPE LINE OF SLIS_T_LISTHEADER,
FS_LINE TYPE LINE OF SLIS_T_LISTHEADER.
GS_LINE-TYP = 'H' .
GS_LINE-INFO = 'Employee Details'.
APPEND GS_LINE TO P_REPORT_HEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'S' .
GS_LINE-INFO = 'Thanks for visiting'.
APPEND GS_LINE TO P_REPORT_HEADER.
CLEAR GS_LINE.
FS_LINE-TYP = 'S' .
FS_LINE-INFO = 'Thanks for visiting'.
APPEND FS_LINE TO P_REPORT_FOOTER.
CLEAR FS_LINE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = P_REPORT_HEADER
I_LOGO = 'WIPROLOGO'
I_END_OF_LIST_GRID = 'X'
.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = P_REPORT_FOOTER
I_LOGO = 'WIPRO_LOGO'
I_END_OF_LIST_GRID = 'X'.
ENDFORM. "top_of_page
05-16-2007 10:27 AM
Hi Nidhi,
Bulid a list header in ALV.Use top of page event of ALV.
Refer this code :
FORM build_listheader USING p_it_listheader TYPE slis_t_listheader.
DATA: itab_listheader TYPE slis_listheader.
REFRESH p_it_listheader.
CLEAR itab_listheader.
itab_listheader-typ = 'H'.
itab_listheader-info = 'Management'.
APPEND itab_listheader TO p_it_listheader.
ENDFORM. " BUILD_LISTHEADER
form BUILD_EVENTCAT using p_i_eventcat TYPE SLIS_T_EVENT.
DATA: I_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_I_EVENTCAT
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.
CLEAR I_EVENT.
read table p_i_eventcat with key name = slis_ev_top_of_page into I_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE' to I_event-form.
append I_event to p_i_eventcat.
endif.
endform. " BUILD_EVENTCAT
FORM top_of_page .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
.
ENDFORM. " TOP_OF_PAGE
Reward points if helpful.
Regards,
Hemant
05-16-2007 10:27 AM
Hello,
U can acheive this using Hierarchical list desplay
Check this :
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
i_callback_program = v_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
is_layout = wa_layout
it_fieldcat = lt_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_DEFAULT = 'X'
i_save = 'X'
* IS_VARIANT =
it_events = lt_events
* IT_EVENT_EXIT =
i_tabname_header = 'T_HEADER'
i_tabname_item = 'T_ITEM'
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
is_keyinfo = lv_keyinfo
* IS_PRINT =
* IS_REPREP_ID =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = it_header
t_outtab_item = it_item
exceptions
program_error = 1
others = 2.
Regards,
Deepu.K
05-16-2007 10:54 AM
Thanx deepu,,
will u please tel me more about the data u entered in this how do enter the values.
05-16-2007 10:27 AM
Hello,
U can do it in ALV header.
Please check this sample code
* Displaying the top of page
PERFORM REPORT_HEADING.
*&---------------------------------------------------------------------*
*& Form REPORT_HEADING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM REPORT_HEADING .
* Work Area TOP-OF-PAGE commentary
DATA: WA_COMMENTARY TYPE SLIS_LISTHEADER,
L_F_INFO(132),
L_F_DATUM(10),
L_F_TIME(8),
L_F_LOW LIKE PRPS-POSID,
L_F_HIGH LIKE PRPS-POSID,
L_F_DATL(10),
L_F_DATH(10).
CLEAR : WA_COMMENTARY,
IT_COMMENTARY,
IT_COMMENTARY[].
CONCATENATE TEXT-013 SY-REPID INTO L_F_INFO
SEPARATED BY ' '.
WA_COMMENTARY-TYP = 'H'.
WA_COMMENTARY-INFO = L_F_INFO.
APPEND WA_COMMENTARY TO IT_COMMENTARY.
WRITE SY-DATUM TO L_F_DATUM.
WRITE SY-UZEIT TO L_F_TIME.
CONCATENATE TEXT-017 L_F_DATUM TEXT-018 L_F_TIME INTO L_F_INFO
SEPARATED BY ' '.
WA_COMMENTARY-TYP = 'S'.
WA_COMMENTARY-INFO = L_F_INFO.
APPEND WA_COMMENTARY TO IT_COMMENTARY.
ENDFORM
*&---------------------------------------------------------------------*
*& Form ALV_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALV_DISPLAY .
DATA: IT_VARIANT LIKE DISVARIANT.
* For storing the variant layout
IT_VARIANT-REPORT = SY-REPID.
CLEAR G_T_OUTTAB.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = IT_VARIANT-REPORT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'A'
IS_VARIANT = IT_VARIANT
TABLES
T_OUTTAB = G_T_OUTTAB
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.
ENDFORM. " ALV_DISPLAY
*&---------------------------------------------------------------------*
*& Form TOP-OF-PAGE
*&---------------------------------------------------------------------*
* For Top of page
*----------------------------------------------------------------------*
FORM TOP_OF_PAGE. "#EC CALLED
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_COMMENTARY.
ENDFORM. "top_of_page
If useful reward.
Vasanth
05-16-2007 10:29 AM
Yes it is possible to give a fixed header to the ALV grid. You can either specify a form for the TOP_OF_PAGE or use the header parameter in the layout to specify the same.
Sudha
05-16-2007 10:33 AM
I had a similar problem sometime back and could not find a solution for it. I don't think multiple headers are possible (for the scenario you are asking) in alv.
regards,
Priyank
05-16-2007 10:37 AM
Hi Nidhi,
You can use fieldcat defination to display your header part as per ur requirement.
or see the following code -
data : begin of wa_itab ,
col1(15),
col2(15),
col3(15),
end of itab.
data : itab like wa_itab occurs 0 with header line.
wa_itab-col1 = 'Management'.
append wa_itab to itab.
clear wa_itab.
wa_itab-col1 = ' Joininees'.
append wa_itab to itab.
clear wa_itab.
wa_itab-col2 = ' Separations'.
append wa_itab to itab.
clear wa_itab.
wa_itab-col1 = 2. " here 2 is the value from other internal table
append wa_itab to itab.
clear wa_itab.
wa_itab-col1 = 3.
append wa_itab to itab.
clear wa_itab.
etc....
Now youcan display your itab using grid_display function.
reward points if helpful answer.
Thanks .
paresh
05-16-2007 10:59 AM
hi nidhi
you can perform your rquirement using the code below...
form top_of_page.
wa_header-typ = 'H'.
wa_header-info = 'Management'.
append wa_header to t_header.
clear wa_header.
describe table itab_final lines line.
wa_header-typ ='A'.
concatenate 'Joininees Separations:' into wa_header-info seperated by space.
append wa_header to t_header.
clear wa_header.
Call Function REUSE_WRITE_COMMENTRY_LINE.
header = t_header.
z_logo = 'MYSAPLOGO'.
endform.
REWARD IT PLEASE....!!