2008 Nov 25 7:48 AM
Hi,
I want to display heading in ALV report.I have done the code but it is not working, Please tell me what is the mistake i done.
**Comment Build for the top-of-page
PERFORM comment_build.
*Fill the fieldcatalog from perform
PERFORM fieldcat.
*Display the data in ALV from perform
PERFORM display_data.
FORM comment_build .
*ALV Header declarations
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'Form 1'.
APPEND WA_HEADER TO TAB_HEADER.
CLEAR WA_HEADER. "Date
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Date: '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO. "todays date
APPEND WA_HEADER TO TAB_HEADER.
CLEAR: WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'ENJOYSAP_LOGO'
IT_LIST_COMMENTARY = TAB_HEADER.
endform.
FORM fieldcat .
CLEAR tab_fieldcatalog.
REFRESH tab_fieldcatalog.
wa_fieldcatalog-fieldname = 'SNO'.
wa_fieldcatalog-tabname = 'tab_bkpf'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'SL.No'.
APPEND wa_fieldcatalog TO tab_fieldcatalog.
CLEAR wa_fieldcatalog.
endform.
FORM display_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set =
i_callback_user_command =
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = 'DGL_HTML_TOP_OF_PAGE'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = w_title1
I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = tab_fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT =
it_events = tab_event[]
IT_EVENT_EXIT =
is_print = wa_print
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = tab_bkpf[]
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. " DISPLAY_DATA
2008 Nov 25 8:04 AM
Hi,
Just use FM like this
FORM display_list_alv.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'PRINT_HEADER'
is_layout = wa_layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_list
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.
FORM print_header.
clear: wa_header, it_header.
"title
wa_header-typ = 'H'.
wa_header-info = text-022.
APPEND wa_header TO it_header.
IF it_cmp_info[] IS NOT INITIAL.
"company info
LOOP AT it_cmp_info INTO wa_cmp_info.
CLEAR wa_header.
wa_header-typ = 'S'.
* wa_header-info = text-023.
* CONCATENATE wa_cmp_info-butxt into wa_header.
CONCATENATE text-023 wa_cmp_info-butxt INTO wa_header-info.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-typ = 'S'.
CONCATENATE text-024 wa_cmp_info-cwaer INTO wa_header-info.
APPEND wa_header TO it_header.
ENDLOOP.
ELSE.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-info = text-025.
APPEND wa_header TO it_header.
ENDIF.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header.
ENDFORM.
Hi,
I want to display heading in ALV report.I have done the code but it is not working, Please tell me what is the mistake i done.
**Comment Build for the top-of-page
PERFORM comment_build.
*Fill the fieldcatalog from perform
PERFORM fieldcat.
*Display the data in ALV from perform
PERFORM display_data.
FORM comment_build .
*ALV Header declarations
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'Form 1'.
APPEND WA_HEADER TO TAB_HEADER.
CLEAR WA_HEADER. "Date
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Date: '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO. "todays date
APPEND WA_HEADER TO TAB_HEADER.
CLEAR: WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'ENJOYSAP_LOGO'
IT_LIST_COMMENTARY = TAB_HEADER.
endform.
FORM fieldcat .
CLEAR tab_fieldcatalog.
REFRESH tab_fieldcatalog.
wa_fieldcatalog-fieldname = 'SNO'.
wa_fieldcatalog-tabname = 'tab_bkpf'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'SL.No'.
APPEND wa_fieldcatalog TO tab_fieldcatalog.
CLEAR wa_fieldcatalog.
endform.
FORM display_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set =
i_callback_user_command =
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = 'DGL_HTML_TOP_OF_PAGE'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = w_title1
I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = tab_fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT =
it_events = tab_event[]
IT_EVENT_EXIT =
is_print = wa_print
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = tab_bkpf[]
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. " DISPLAY_DATA
2008 Nov 25 7:56 AM
Hi Dorothy,
I think you have to first call the FM 'REUSE_ALV_COMMENTARY_WRITE' and then update the table TAB_HEADER.
Regards
Vijai
2008 Nov 25 7:59 AM
the form TOP_OF_PAGE and form 'DGM_HTML_TOP-OF_PAGE' are missing. the code that shud appear in the header shud be written in these forms according to the code u have written.,. Try writing perform comment_build inside the forms..TOP_OF_PAGE or 'DGM_HTML_TOP-OF_PAGE'
Edited by: Suzie on Nov 25, 2008 9:00 AM
2008 Nov 25 8:00 AM
Hi,
you can do that in ur PBO module of screen.
module STATUS_0400 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
endmodule.
Give what ever heading u want in titlebar. If u double click on 'XXX' it will give u one pop-up, in that u can give ur heading.
Let me know if there are any issues.
Regards,
Kusuma.
2008 Nov 25 8:04 AM
Hi,
Just use FM like this
FORM display_list_alv.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'PRINT_HEADER'
is_layout = wa_layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_list
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.
FORM print_header.
clear: wa_header, it_header.
"title
wa_header-typ = 'H'.
wa_header-info = text-022.
APPEND wa_header TO it_header.
IF it_cmp_info[] IS NOT INITIAL.
"company info
LOOP AT it_cmp_info INTO wa_cmp_info.
CLEAR wa_header.
wa_header-typ = 'S'.
* wa_header-info = text-023.
* CONCATENATE wa_cmp_info-butxt into wa_header.
CONCATENATE text-023 wa_cmp_info-butxt INTO wa_header-info.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-typ = 'S'.
CONCATENATE text-024 wa_cmp_info-cwaer INTO wa_header-info.
APPEND wa_header TO it_header.
ENDLOOP.
ELSE.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-info = text-025.
APPEND wa_header TO it_header.
ENDIF.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header.
ENDFORM.
2008 Dec 22 11:34 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |