* display report
IF NOT p_disp IS INITIAL.
PERFORM display_alv_report.
*&---------------------------------------------------------------------
*& Form display_alv_report
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
*
FORM display_alv_report.
DATA: ldt_listfooter TYPE slis_t_listheader.
gdf_repid = sy-repid.
PERFORM build_field_catalog.
PERFORM build_alv_header.
PERFORM build_alv_layout.
* set up header and footer data (to add page number and end of report)
PERFORM setup_report_header_footer
TABLES gdt_listheader
ldt_listfooter
gdt_events
USING gcf_end_rept.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gdf_repid
i_callback_user_command = gcf_alv_cmd
is_layout = gdt_layout
it_fieldcat = gdt_fieldcat
it_events = gdt_events
is_print = gds_print
i_save = gcf_a
TABLES
t_outtab = gdt_rept
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " display_alv_report
*&---------------------------------------------------------------------
*
*& Form build_field_catalog
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
FORM build_field_catalog.
IF sy-batch = gcf_x.
MESSAGE i000 WITH text-m11.
ENDIF.
PERFORM assign_fields USING:
'VKORG' 'IT_REPT' 'C' ' ' text-t01,
'KTOKD' 'IT_REPT' 'C' ' ' text-t02,
'KUNAG' 'IT_REPT' 'C' ' ' text-t03,
'NAMAG' 'IT_REPT' 'C' ' ' text-t04,
'PARVW' 'IT_REPT' 'C' ' ' text-t14, " Added by EJ3K946466 702061451 20.03.2012
'KUNWE' 'IT_REPT' 'C' ' ' text-t05,
'NAMWE' 'IT_REPT' 'C' ' ' text-t06,
'NAME2' 'IT_REPT' 'C' ' ' text-t07,
'CITY' 'IT_REPT' 'C' ' ' text-t08,
'STATE' 'IT_REPT' 'C' ' ' text-t09,
'PSTCD' 'IT_REPT' 'C' ' ' text-t10,
'STADD' 'IT_REPT' 'C' ' ' text-t11,
'TELNO' 'IT_REPT' 'C' ' ' text-t12,
'FAXNO' 'IT_REPT' 'C' ' ' text-t13.
ENDFORM. " build_field_catalog
*&---------------------------------------------------------------------
*
*& Form build_alv_header
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
FORM build_alv_header.
CLEAR gds_listheader.
REFRESH gdt_listheader.
* Main heading
CLEAR gdt_listheader.
gds_listheader-typ = gcf_h.
gds_listheader-info = sy-title.
APPEND gds_listheader TO gdt_listheader.
* General ALV header info: date/time/username
* (this will appear on all ALV grids)
CLEAR gds_listheader.
gds_listheader-typ = gcf_s.
gds_listheader-key = 'Date/Time/User:'.
WRITE sy-datum TO gds_listheader-info.
WRITE '/' TO gds_listheader-info+11(1).
WRITE sy-uzeit TO gds_listheader-info+13.
WRITE '/' TO gds_listheader-info+22(1).
WRITE sy-uname TO gds_listheader-info+24.
APPEND gds_listheader TO gdt_listheader.
ENDFORM. " build_alv_header
*&---------------------------------------------------------------------
*& Form build_alv_layout
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
*
FORM build_alv_layout.
gdt_layout-cell_merge = gcf_x.
gdt_layout-colwidth_optimize = gcf_x.
gdt_layout-zebra = gcf_x.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gdf_repid
i_callback_user_command = gcf_alv_cmd
is_layout = gdt_layout
it_fieldcat = gdt_fieldcat
it_events = gdt_events
is_print = gds_print
i_save = gcf_a
TABLES
t_outtab = gdt_rept
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF NOT p_disp IS INITIAL.
PERFORM display_alv_report.
*&---------------------------------------------------------------------
*& Form display_alv_report
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
*
FORM display_alv_report.
DATA: ldt_listfooter TYPE slis_t_listheader.
gdf_repid = sy-repid.
PERFORM build_field_catalog.
PERFORM build_alv_header.
PERFORM build_alv_layout.
* set up header and footer data (to add page number and end of report)
PERFORM setup_report_header_footer
TABLES gdt_listheader
ldt_listfooter
gdt_events
USING gcf_end_rept.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gdf_repid
i_callback_user_command = gcf_alv_cmd
is_layout = gdt_layout
it_fieldcat = gdt_fieldcat
it_events = gdt_events
is_print = gds_print
i_save = gcf_a
TABLES
t_outtab = gdt_rept
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " display_alv_report
*&---------------------------------------------------------------------
*
*& Form build_field_catalog
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
FORM build_field_catalog.
IF sy-batch = gcf_x.
MESSAGE i000 WITH text-m11.
ENDIF.
PERFORM assign_fields USING:
'VKORG' 'IT_REPT' 'C' ' ' text-t01,
'KTOKD' 'IT_REPT' 'C' ' ' text-t02,
'KUNAG' 'IT_REPT' 'C' ' ' text-t03,
'NAMAG' 'IT_REPT' 'C' ' ' text-t04,
'PARVW' 'IT_REPT' 'C' ' ' text-t14, " Added by EJ3K946466 702061451 20.03.2012
'KUNWE' 'IT_REPT' 'C' ' ' text-t05,
'NAMWE' 'IT_REPT' 'C' ' ' text-t06,
'NAME2' 'IT_REPT' 'C' ' ' text-t07,
'CITY' 'IT_REPT' 'C' ' ' text-t08,
'STATE' 'IT_REPT' 'C' ' ' text-t09,
'PSTCD' 'IT_REPT' 'C' ' ' text-t10,
'STADD' 'IT_REPT' 'C' ' ' text-t11,
'TELNO' 'IT_REPT' 'C' ' ' text-t12,
'FAXNO' 'IT_REPT' 'C' ' ' text-t13.
ENDFORM. " build_field_catalog
*&---------------------------------------------------------------------
*
*& Form build_alv_header
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
FORM build_alv_header.
CLEAR gds_listheader.
REFRESH gdt_listheader.
* Main heading
CLEAR gdt_listheader.
gds_listheader-typ = gcf_h.
gds_listheader-info = sy-title.
APPEND gds_listheader TO gdt_listheader.
* General ALV header info: date/time/username
* (this will appear on all ALV grids)
CLEAR gds_listheader.
gds_listheader-typ = gcf_s.
gds_listheader-key = 'Date/Time/User:'.
WRITE sy-datum TO gds_listheader-info.
WRITE '/' TO gds_listheader-info+11(1).
WRITE sy-uzeit TO gds_listheader-info+13.
WRITE '/' TO gds_listheader-info+22(1).
WRITE sy-uname TO gds_listheader-info+24.
APPEND gds_listheader TO gdt_listheader.
ENDFORM. " build_alv_header
*&---------------------------------------------------------------------
*& Form build_alv_layout
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
*
FORM build_alv_layout.
gdt_layout-cell_merge = gcf_x.
gdt_layout-colwidth_optimize = gcf_x.
gdt_layout-zebra = gcf_x.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gdf_repid
i_callback_user_command = gcf_alv_cmd
is_layout = gdt_layout
it_fieldcat = gdt_fieldcat
it_events = gdt_events
is_print = gds_print
i_save = gcf_a
TABLES
t_outtab = gdt_rept
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete