TYPE-POOLS: slis .
*---------------------------------------------------------------------*
* Data object declaration
*---------------------------------------------------------------------*
DATA: t_alv_fctlg TYPE slis_t_fieldcat_alv,
t_alv_event TYPE slis_t_event WITH HEADER LINE,
t_alv_isort TYPE slis_t_sortinfo_alv WITH HEADER LINE,
t_alv_filtr TYPE slis_t_filter_alv WITH HEADER LINE,
t_header TYPE slis_t_listheader,
d_alv_isort TYPE slis_sortinfo_alv,
d_alv_varnt TYPE disvariant,
d_alv_lscrl TYPE slis_list_scroll,
d_alv_sort_postn TYPE i,
d_alv_save(1) TYPE c,
d_alv_varnm LIKE disvariant-variant,
d_alv_qinfo TYPE slis_keyinfo_alv,
d_alv_fctlg TYPE slis_fieldcat_alv,
d_alv_stats TYPE slis_formname,
d_alv_ucomm TYPE slis_formname,
d_alv_print TYPE slis_print_alv,
d_alv_repid LIKE sy-repid,
d_alv_tabix LIKE sy-tabix,
d_alv_subrc LIKE sy-subrc,
d_alv_bg_id LIKE bapibds01-objkey VALUE 'ALV_BACKGROUND',
d_alv_screen_start_column TYPE i,
d_alv_screen_start_line TYPE i,
d_alv_screen_end_column TYPE i,
d_alv_screen_end_line TYPE i,
d_alv_layout TYPE slis_layout_alv.
CONSTANTS : c_top_of_page TYPE slis_formname VALUE 'F_TOP_OF_PAGE',
c_top_of_page_alv TYPE slis_formname
VALUE 'F_TOP_OF_PAGE_ALV',
c_end_of_page TYPE slis_formname VALUE 'F_END_OF_PAGE',
c_user_command TYPE slis_formname VALUE 'F_USER_COMMAND',
c_pf_status TYPE slis_formname VALUE 'F_PF_STATUS'.
* Variant
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE text-v01.
PARAMETERS: p_vari LIKE disvariant-variant no-display.
SELECTION-SCREEN END OF BLOCK 0.
** Process on value request
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
* PERFORM f_alv_variant_f4 CHANGING d_alv_varnt-variant.
*AT SELECTION-SCREEN.
* PERFORM f_alv_selscr_input.
*&---------------------------------------------------------------------*
*& FORM F_ALV_INIT
*&---------------------------------------------------------------------*
* Initialize ALV variables
*----------------------------------------------------------------------*
FORM f_alv_init.
d_alv_repid = sy-repid.
d_alv_save = 'A'.
d_alv_varnt-report = sy-repid.
ENDFORM. " f_alv_init
*---------------------------------------------------------------------*
* FORM F_ALV_BUILD_COMMENT *
*---------------------------------------------------------------------*
* Build ALV Header *
*---------------------------------------------------------------------*
FORM f_alv_build_comment TABLES ft_top_of_page TYPE slis_t_listheader
USING fu_typ fu_key fu_info.
* fu_typ = H, S, or A.
* H = Header (big), S = Selection (reg) , A = Action (small)
ft_top_of_page-typ = fu_typ.
ft_top_of_page-key = fu_key.
ft_top_of_page-info = fu_info.
APPEND ft_top_of_page.
ENDFORM. "f_alv_build_comment
*---------------------------------------------------------------------*
* FORM F_TOP_OF_PAGE *
*---------------------------------------------------------------------*
* TOP-OF-PAGE *
*---------------------------------------------------------------------*
FORM f_top_of_page_alv.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = t_header.
ENDFORM. "F_TOP_OF_PAGE_ALV
*---------------------------------------------------------------------*
* FORM f_end_of_page *
*---------------------------------------------------------------------*
* END-OF-PAGE *
*---------------------------------------------------------------------*
FORM f_end_of_page_alv.
ENDFORM. "f_end_of_page_alv
*&---------------------------------------------------------------------*
*& Form F_ALV_BUILD_EVENT
*&---------------------------------------------------------------------*
* Build ALV events (TOP-OF-PAGE, END-OF-PAGE, etc)
*----------------------------------------------------------------------*
FORM f_alv_build_event USING fu_pname fu_pform.
* DATA: lX_event TYPE slis_alv_event.
*
* CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
* EXPORTING
* i_list_type = 0
* IMPORTING
* et_events = t_alv_event.
*
* READ TABLE t_alv_event WITH KEY name = slis_ev_top_of_page.
*
* IF sy-subrc = 0.
* MOVE c_top_of_page TO t_alv_event-form.
* APPEND t_alv_event.
* ENDIF.
CLEAR t_alv_event.
t_alv_event-name = fu_pname.
t_alv_event-form = fu_pform.
APPEND t_alv_event.
ENDFORM. " F_BUILD_EVENT
*---------------------------------------------------------------------*
* FORM F_ALV_SET_UCOMM *
*---------------------------------------------------------------------*
* Set ALV user callback command *
*---------------------------------------------------------------------*
FORM f_alv_set_ucomm USING value(fu_ucomm) TYPE slis_formname.
CLEAR d_alv_ucomm.
d_alv_ucomm = fu_ucomm.
ENDFORM. "f_alv_set_ucomm
*&---------------------------------------------------------------------*
*& Form F_ALV_BUILD_LAYOUT
*&---------------------------------------------------------------------*
* Build ALV layout
*----------------------------------------------------------------------*
FORM f_alv_build_layout USING fu_field fu_value.
* No Headings
IF fu_field = 'NO_COLHEAD'.
d_alv_layout-no_colhead = fu_value.
* Headings not as hotspot
ELSEIF fu_field = 'NO_HOTSPOT'.
d_alv_layout-no_hotspot = fu_value.
* Striped pattern
ELSEIF fu_field = 'ZEBRA'.
d_alv_layout-zebra = fu_value.
* Columns separated by space
ELSEIF fu_field = 'NO_VLINE'.
d_alv_layout-no_vline = fu_value.
* Not suppress field replication
ELSEIF fu_field = 'CELL_MERGE'.
d_alv_layout-cell_merge = fu_value.
* For GRID only
ELSEIF fu_field = 'EDIT'.
d_alv_layout-edit = fu_value.
* For GRID only
ELSEIF fu_field = 'EDIT_MODE'.
d_alv_layout-edit_mode = fu_value.
* Totals for NUMC-Fields possible.
ELSEIF fu_field = 'NUMC_SUM'.
d_alv_layout-numc_sum = fu_value.
* Only display fields
ELSEIF fu_field = 'NO_INPUT'.
d_alv_layout-no_input = fu_value.
ELSEIF fu_field = 'F2CODE'.
d_alv_layout-f2code = fu_value.
* Report interface active
ELSEIF fu_field = 'REPREP'.
d_alv_layout-reprep = fu_value.
* No fix key columns - moving possible
ELSEIF fu_field = 'NO_KEYFIX'.
d_alv_layout-no_keyfix = fu_value.
* Expand all positions
ELSEIF fu_field = 'EXPAND_ALL'.
d_alv_layout-expand_all = fu_value.
* No standard authority check
ELSEIF fu_field = 'NO_AUTHOR'.
d_alv_layout-no_author = fu_value.
* Default status space or 'A'
ELSEIF fu_field = 'DEF_STATUS'.
d_alv_layout-def_status = fu_value.
* Text for item button
ELSEIF fu_field = 'ITEM_TEXT'.
d_alv_layout-item_text = fu_value.
ELSEIF fu_field = 'COLWIDTH_OPTIMIZE'.
d_alv_layout-colwidth_optimize = fu_value.
* line size = width of the list
ELSEIF fu_field = 'NO_MIN_LINESIZE'.
d_alv_layout-no_min_linesize = fu_value.
* if initial min_linesize = 80
ELSEIF fu_field = 'MIN_LINESIZE'.
d_alv_layout-min_linesize = fu_value.
* Default = 250
ELSEIF fu_field = 'MAX_LINESIZE'.
d_alv_layout-max_linesize = fu_value.
ELSEIF fu_field = 'WINDOW_TITLEBAR'.
d_alv_layout-window_titlebar = fu_value.
ELSEIF fu_field = 'NO_ULINE_HS'.
d_alv_layout-no_uline_hs = fu_value.
** Exceptions
ELSEIF fu_field = 'LIGHTS_FIELDNAME'.
d_alv_layout-lights_fieldname = fu_value.
ELSEIF fu_field = 'LIGHTS_TABNAME'.
d_alv_layout-lights_tabname = fu_value.
ELSEIF fu_field = 'LIGHTS_ROLLNAME'.
d_alv_layout-lights_rollname = fu_value.
ELSEIF fu_field = 'LIGHTS_CONDENSE'.
d_alv_layout-lights_condense = fu_value.
** Sums
* No choice for summing up
ELSEIF fu_field = 'NO_SUMCHOICE'.
d_alv_layout-no_sumchoice = fu_value.
* No total line
ELSEIF fu_field = 'NO_TOTALLINE'.
d_alv_layout-no_totalline = fu_value.
* No choice for subtotals
ELSEIF fu_field = 'NO_SUBCHOICE'.
d_alv_layout-no_subchoice = fu_value.
* No subtotals possible
ELSEIF fu_field = 'NO_SUBTOTALS'.
d_alv_layout-no_subtotals = fu_value.
* no sep. tot.lines by inh.units
ELSEIF fu_field = 'NO_UNIT_SPLITTING'.
d_alv_layout-no_unit_splitting = fu_value.
* Display totals before the items
ELSEIF fu_field = 'TOTALS_BEFORE_ITEMS'.
d_alv_layout-totals_before_items = fu_value.
* Show only totals
ELSEIF fu_field = 'TOTALS_ONLY'.
d_alv_layout-totals_only = fu_value.
* Text for 1st col. in total line
ELSEIF fu_field = 'TOTALS_TEXT'.
d_alv_layout-totals_text = fu_value.
* Text for 1st col. in subtotals
ELSEIF fu_field = 'SUBTOTALS_TEXT'.
d_alv_layout-subtotals_text = fu_value.
** Interaction
ELSEIF fu_field = 'BOX_FIELDNAME'.
d_alv_layout-box_fieldname = fu_value.
ELSEIF fu_field = 'BOX_TABNAME'.
d_alv_layout-box_tabname = fu_value.
ELSEIF fu_field = 'BOX_ROLLNAME'.
d_alv_layout-box_rollname = fu_value.
ELSEIF fu_field = 'EXPAND_FIELDNAME'.
d_alv_layout-expand_fieldname = fu_value.
ELSEIF fu_field = 'HOTSPOT_FIELDNAME'.
d_alv_layout-hotspot_fieldname = fu_value.
ELSEIF fu_field = 'CONFIRMATION_PROMPT'.
d_alv_layout-confirmation_prompt = fu_value.
ELSEIF fu_field = 'KEY_HOTSPOT'.
d_alv_layout-key_hotspot = fu_value.
ELSEIF fu_field = 'FLEXIBLE_KEY'.
d_alv_layout-flexible_key = fu_value.
ELSEIF fu_field = 'GROUP_BUTTONS'.
d_alv_layout-group_buttons = fu_value.
ELSEIF fu_field = 'GET_SELINFOS'.
d_alv_layout-get_selinfos = fu_value.
ELSEIF fu_field = 'GROUP_CHANGE_EDIT'.
d_alv_layout-group_change_edit = fu_value.
ELSEIF fu_field = 'NO_SCROLLING'.
d_alv_layout-no_scrolling = fu_value.
** Detailed screen
ELSEIF fu_field = 'DETAIL_POPUP'.
d_alv_layout-detail_popup = fu_value.
ELSEIF fu_field = 'DETAIL_INITIAL_LINES'.
d_alv_layout-detail_initial_lines = fu_value.
ELSEIF fu_field = 'DETAIL_TITLEBAR'.
d_alv_layout-detail_titlebar = fu_value.
ELSEIF fu_field = 'DETAIL_POPUP'.
d_alv_layout-detail_popup = fu_value.
** Variant
ELSEIF fu_field = 'HEADER_TEXT'.
d_alv_layout-header_text = fu_value.
ELSEIF fu_field = 'DEFAULT_ITEM'.
d_alv_layout-default_item = fu_value.
** Color
ELSEIF fu_field = 'INFO_FIELDNAME'.
d_alv_layout-info_fieldname = fu_value.
ELSEIF fu_field = 'COLTAB_FIELDNAME'.
d_alv_layout-coltab_fieldname = fu_value.
** Others
ELSEIF fu_field = 'LIST_APPEND'.
d_alv_layout-coltab_fieldname = fu_value.
ELSEIF fu_field = 'XIFUNCKEY'.
d_alv_layout-xifunckey = fu_value.
ELSEIF fu_field = 'XIDIRECT'.
d_alv_layout-xidirect = fu_value.
ELSEIF fu_field = 'DTC_LAYOUT'.
d_alv_layout-dtc_layout = fu_value.
ENDIF.
ENDFORM. " F_ALV_BUILD_LAYOUT
*&---------------------------------------------------------------------*
*& Form f_check_box
*&---------------------------------------------------------------------*
FORM f_alv_check_box USING fu_tname.
d_alv_layout-box_fieldname = 'CHKBX'.
d_alv_layout-box_tabname = fu_tname.
ENDFORM. " F_CHECK_BOX
*&---------------------------------------------------------------------*
*& Form f_alv_sort
*&---------------------------------------------------------------------*
* Sort ALV catalog
*----------------------------------------------------------------------*
FORM f_alv_sort USING fu_table fu_field fu_ascnd fu_subtot fu_group.
DATA: ld_isort TYPE slis_sortinfo_alv.
d_alv_sort_postn = d_alv_sort_postn + 1.
ld_isort-tabname = fu_table.
ld_isort-fieldname = fu_field.
IF fu_ascnd = 'X'.
ld_isort-up = 'X'.
ELSE.
ld_isort-down = 'X'.
ENDIF.
ld_isort-spos = d_alv_sort_postn.
ld_isort-subtot = fu_subtot.
ld_isort-group = fu_group.
APPEND ld_isort TO t_alv_isort.
ENDFORM. " F_ALV_SORT
*&---------------------------------------------------------------------*
*& Form F_ALV_BUILD_CATALOG
*&---------------------------------------------------------------------*
FORM f_alv_build_catalog USING ft_fctlg TYPE slis_t_fieldcat_alv
fu_tbnam fu_fname fu_dscrp
fu_reftb fu_refld
fu_noout fu_outln fu_hotsp fu_jstfy
fu_dosum fu_rowpos fu_colpos
fu_icon fu_spgroup fu_keysel.
DATA: lv_fctlg TYPE slis_fieldcat_alv.
lv_fctlg-seltext_s = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
lv_fctlg-seltext_l = fu_dscrp.
lv_fctlg-reptext_ddic = fu_dscrp.
lv_fctlg-tabname = fu_tbnam.
lv_fctlg-fieldname = fu_fname.
lv_fctlg-ref_tabname = fu_reftb.
lv_fctlg-ref_fieldname = fu_refld.
lv_fctlg-no_out = fu_noout.
lv_fctlg-outputlen = fu_outln.
lv_fctlg-hotspot = fu_hotsp.
lv_fctlg-just = fu_jstfy.
lv_fctlg-do_sum = fu_dosum.
lv_fctlg-row_pos = fu_rowpos.
lv_fctlg-col_pos = fu_colpos.
lv_fctlg-icon = fu_icon.
lv_fctlg-sp_group = fu_spgroup.
lv_fctlg-key_sel = fu_keysel.
APPEND lv_fctlg TO ft_fctlg.
ENDFORM. " F_ALV_BUILD_CATALOG
*&---------------------------------------------------------------------*
*& Form F_ALV_BUILD_CATALOG_CRNCY
*&---------------------------------------------------------------------*
FORM f_alv_build_catalog_crncy USING ft_fctlg TYPE slis_t_fieldcat_alv
fu_tbnam fu_fname fu_dscrp
fu_reftb fu_refld fu_outln fu_dosum
fu_curky fu_cfild fu_ctbnm fu_jstfy
fu_rowpos fu_colpos fu_noout.
DATA: lv_fctlg TYPE slis_fieldcat_alv,
ld_lngth TYPE i.
ld_lngth = STRLEN( fu_dscrp ).
IF ld_lngth > 25.
lv_fctlg-seltext_l = fu_dscrp.
ELSEIF ld_lngth > 10.
lv_fctlg-seltext_l = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
ELSE.
lv_fctlg-seltext_s = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
lv_fctlg-seltext_l = fu_dscrp.
ENDIF.
lv_fctlg-tabname = fu_tbnam.
lv_fctlg-fieldname = fu_fname.
lv_fctlg-ctabname = fu_reftb.
lv_fctlg-cfieldname = fu_refld.
lv_fctlg-outputlen = fu_outln.
lv_fctlg-do_sum = fu_dosum.
lv_fctlg-just = fu_jstfy.
lv_fctlg-currency = fu_curky.
lv_fctlg-cfieldname = fu_cfild.
lv_fctlg-ctabname = fu_ctbnm.
lv_fctlg-datatype = 'CURR'.
lv_fctlg-row_pos = fu_rowpos.
lv_fctlg-col_pos = fu_colpos.
lv_fctlg-no_out = fu_noout.
APPEND lv_fctlg TO ft_fctlg.
ENDFORM. " F_ALV_BUILD_CATALOG_CRNCY
*&---------------------------------------------------------------------*
*& Form F_ALV_CATALOG_EXPNT
*&---------------------------------------------------------------------*
FORM f_alv_catalog_expnt USING ft_fctlg TYPE slis_t_fieldcat_alv
fu_tbnam fu_fname fu_dscrp
fu_reftb fu_refld
fu_outln fu_decml fu_expnt fu_jstfy
fu_rowpos fu_colpos fu_noout.
DATA: lv_fctlg TYPE slis_fieldcat_alv,
ld_lngth TYPE i.
ld_lngth = STRLEN( fu_dscrp ).
IF ld_lngth > 25.
lv_fctlg-seltext_l = fu_dscrp.
ELSEIF ld_lngth > 10.
lv_fctlg-seltext_l = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
ELSE.
lv_fctlg-seltext_s = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
lv_fctlg-seltext_l = fu_dscrp.
ENDIF.
lv_fctlg-tabname = fu_tbnam.
lv_fctlg-fieldname = fu_fname.
lv_fctlg-ref_tabname = fu_reftb.
lv_fctlg-ref_fieldname = fu_refld.
lv_fctlg-outputlen = fu_outln.
lv_fctlg-decimals_out = fu_decml.
lv_fctlg-exponent = fu_expnt.
lv_fctlg-datatype = 'FLTP'.
lv_fctlg-just = fu_jstfy.
lv_fctlg-row_pos = fu_rowpos.
lv_fctlg-col_pos = fu_colpos.
lv_fctlg-no_out = fu_noout.
APPEND lv_fctlg TO ft_fctlg.
ENDFORM. " F_ALV_CATALOG_EXPNT
*&---------------------------------------------------------------------*
*& Form F_ALV_BUILD_CATALOG_QTY
*&---------------------------------------------------------------------*
*& field catalog for quantity unit
*&---------------------------------------------------------------------*
FORM f_alv_build_catalog_qty USING ft_fctlg TYPE slis_t_fieldcat_alv
fu_tbnam fu_fname fu_dscrp
fu_reftb fu_refld fu_noout
fu_outln fu_dosum fu_jstfy
fu_meins fu_qfild fu_qtbnm
fu_rowpos fu_colpos.
DATA: lv_fctlg TYPE slis_fieldcat_alv.
lv_fctlg-seltext_s = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
lv_fctlg-seltext_l = fu_dscrp.
lv_fctlg-reptext_ddic = fu_dscrp.
lv_fctlg-tabname = fu_tbnam.
lv_fctlg-fieldname = fu_fname.
lv_fctlg-ref_tabname = fu_reftb.
lv_fctlg-ref_fieldname = fu_refld.
lv_fctlg-no_out = fu_noout.
lv_fctlg-outputlen = fu_outln.
lv_fctlg-do_sum = fu_dosum.
lv_fctlg-just = fu_jstfy.
lv_fctlg-quantity = fu_meins.
lv_fctlg-qfieldname = fu_qfild.
lv_fctlg-qtabname = fu_qtbnm.
lv_fctlg-row_pos = fu_rowpos.
lv_fctlg-col_pos = fu_colpos.
APPEND lv_fctlg TO ft_fctlg.
ENDFORM. " F_ALV_BUILD_CATALOG_QTY
*&---------------------------------------------------------------------*
*& Form F_ALV_BUILD_CATALOG_INPUT
*&---------------------------------------------------------------------*
FORM f_alv_build_catalog_input USING ft_fctlg TYPE slis_t_fieldcat_alv
fu_tbnam fu_fname fu_dscrp
fu_reftb fu_refld
fu_noout fu_outln fu_hotsp fu_jstfy
fu_dosum fu_rowpos fu_colpos
fu_icon fu_spgroup fu_keysel
fu_input fu_edit.
DATA: lv_fctlg TYPE slis_fieldcat_alv.
lv_fctlg-seltext_s = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
lv_fctlg-seltext_l = fu_dscrp.
lv_fctlg-reptext_ddic = fu_dscrp.
lv_fctlg-tabname = fu_tbnam.
lv_fctlg-fieldname = fu_fname.
lv_fctlg-ref_tabname = fu_reftb.
lv_fctlg-ref_fieldname = fu_refld.
lv_fctlg-no_out = fu_noout.
lv_fctlg-outputlen = fu_outln.
lv_fctlg-hotspot = fu_hotsp.
lv_fctlg-just = fu_jstfy.
lv_fctlg-do_sum = fu_dosum.
lv_fctlg-row_pos = fu_rowpos.
lv_fctlg-col_pos = fu_colpos.
lv_fctlg-icon = fu_icon.
lv_fctlg-sp_group = fu_spgroup.
lv_fctlg-key_sel = fu_keysel.
lv_fctlg-input = fu_input.
lv_fctlg-edit = fu_edit.
APPEND lv_fctlg TO ft_fctlg.
ENDFORM. " F_ALV_BUILD_CATALOG_INPUT
*&---------------------------------------------------------------------*
*& Form F_GET_CATALOG
*&---------------------------------------------------------------------*
* @FT_FCTLG = internal table to store field catalog result
* @FU_TABLE = internal table name
* @FU_STRCT = Table/Structure name
* description: Purpose to get field attribute from data dictionary
* (Table/Structure) and save as ALV field catalog
FORM f_alv_get_catalog TABLES ft_fctlg TYPE slis_t_fieldcat_alv
USING fu_table
fu_strct.
DATA: ld_table TYPE slis_tabname,
ld_strct LIKE dd02l-tabname,
ld_fctlg TYPE slis_fieldcat_alv,
lt_fctlg TYPE slis_t_fieldcat_alv.
ld_table = fu_table.
ld_strct = fu_strct.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_internal_tabname = ld_table
i_structure_name = ld_strct
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = lt_fctlg
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
* ld_fctlg-currency = 'IDR'.
* MODIFY lt_fctlg FROM ld_fctlg TRANSPORTING currency
* WHERE datatype EQ 'CURR'.
APPEND LINES OF lt_fctlg TO ft_fctlg.
ENDFORM. " F_GET_CATALOG
*&---------------------------------------------------------------------*
*& Form F_ALV_LIST_DISPLAY
*&---------------------------------------------------------------------*
* Generate ALV classic display
*----------------------------------------------------------------------*
FORM f_alv_list_display TABLES ft_table
USING fu_table TYPE slis_tabname
fu_fsave.
d_alv_varnt-report = d_alv_repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = d_alv_repid
i_callback_pf_status_set = d_alv_stats
i_callback_user_command = d_alv_ucomm
* I_STRUCTURE_NAME =
is_layout = d_alv_layout
it_fieldcat = t_alv_fctlg
it_sort = t_alv_isort[]
i_default = 'X'
i_save = fu_fsave
is_variant = d_alv_varnt
it_events = t_alv_event[]
is_print = d_alv_print
i_screen_start_column = d_alv_screen_start_column
i_screen_start_line = d_alv_screen_start_line
i_screen_end_column = d_alv_screen_end_column
i_screen_end_line = d_alv_screen_end_line
TABLES
t_outtab = ft_table[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " F_ALV_LIST_DISPLAY
*---------------------------------------------------------------------*
* FORM F_ALV_GRID_DISPLAY *
*---------------------------------------------------------------------*
* Generate ALV grid display *
*---------------------------------------------------------------------*
FORM f_alv_grid_display TABLES ft_table.
d_alv_varnt-report = d_alv_repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = d_alv_repid
i_callback_pf_status_set = d_alv_stats
i_callback_user_command = d_alv_ucomm
i_background_id = d_alv_bg_id
is_layout = d_alv_layout
it_fieldcat = t_alv_fctlg
it_sort = t_alv_isort[]
i_default = 'X'
i_save = d_alv_save
is_variant = d_alv_varnt
it_events = t_alv_event[]
is_print = d_alv_print
i_screen_start_column = d_alv_screen_start_column
i_screen_start_line = d_alv_screen_start_line
i_screen_end_column = d_alv_screen_end_column
i_screen_end_line = d_alv_screen_end_line
TABLES
t_outtab = ft_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " F_ALV_GRID_DISPLAY
FORM f_alv_grid_display_neu TABLES ft_table
USING fu_scol fu_sline fu_ecol fu_eline fu_default.
d_alv_varnt-report = d_alv_repid.
* d_alv_layout-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = d_alv_repid
i_callback_pf_status_set = d_alv_stats
i_callback_user_command = d_alv_ucomm
i_background_id = d_alv_bg_id
is_layout = d_alv_layout
it_fieldcat = t_alv_fctlg
it_sort = t_alv_isort[]
i_default = fu_default
i_save = d_alv_save
is_variant = d_alv_varnt
it_events = t_alv_event[]
is_print = d_alv_print
i_screen_start_column = fu_scol
i_screen_start_line = fu_sline
i_screen_end_column = fu_ecol
i_screen_end_line = fu_eline
TABLES
t_outtab = ft_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " F_ALV_GRID_DISPLAY_NEU
*&---------------------------------------------------------------------*
*& Form F_ALV_HIER_DISPLAY
*&---------------------------------------------------------------------*
* Generate ALV hierarchical display (header & item level)
*----------------------------------------------------------------------*
FORM f_alv_hier_display TABLES ft_headr
ft_items
USING fu_headr TYPE slis_tabname
fu_items TYPE slis_tabname
fu_fsave.
d_alv_varnt-report = d_alv_repid.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = d_alv_repid
i_callback_pf_status_set = d_alv_stats
i_callback_user_command = d_alv_ucomm
is_layout = d_alv_layout
i_save = fu_fsave
it_fieldcat = t_alv_fctlg
it_sort = t_alv_isort[]
it_events = t_alv_event[]
is_variant = d_alv_varnt
i_tabname_header = fu_headr
i_tabname_item = fu_items
is_keyinfo = d_alv_qinfo
is_print = d_alv_print
i_screen_start_column = d_alv_screen_start_column
i_screen_start_line = d_alv_screen_start_line
i_screen_end_column = d_alv_screen_end_column
i_screen_end_line = d_alv_screen_end_line
TABLES
t_outtab_header = ft_headr
t_outtab_item = ft_items
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " F_ALV_HIER_DISPLAY
*&---------------------------------------------------------------------*
*& Form F_GET_TABLES2
*&---------------------------------------------------------------------*
FORM f_alv_get_tables2 TABLES ft_headr ft_items.
CALL FUNCTION 'REUSE_ALV_HS_TABLES_GET'
TABLES
et_outtab_master = ft_headr
et_outtab_detail = ft_items
EXCEPTIONS
no_infos = 1
OTHERS = 2.
ENDFORM. " F_GET_TABLES
*---------------------------------------------------------------------*
* FORM f_alv_get_tables *
*---------------------------------------------------------------------*
FORM f_alv_get_tables1 TABLES ft_table.
CALL FUNCTION 'REUSE_ALV_TABLES_GET'
TABLES
et_outtab = ft_table
EXCEPTIONS
no_infos = 1
OTHERS = 2.
ENDFORM. " F_GET_TABLES
*&---------------------------------------------------------------------*
*& Form f_alv_variant_f4
*&---------------------------------------------------------------------*
FORM f_alv_variant_f4 CHANGING fc_varnt.
DATA: rs_variant LIKE disvariant.
rs_variant-report = d_alv_repid.
rs_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = rs_variant
i_save = 'A'
IMPORTING
es_variant = rs_variant
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
fc_varnt = rs_variant-variant.
p_vari = rs_variant-variant.
ENDIF.
ENDFORM. " ALV_VARIANT_F4
*&---------------------------------------------------------------------*
*& Form f_alv_selscr_input
*&---------------------------------------------------------------------*
* PAI of ALV selection screen
*----------------------------------------------------------------------*
FORM f_alv_selscr_input.
DATA : rs_variant LIKE disvariant.
IF NOT p_vari IS INITIAL.
MOVE d_alv_varnt TO rs_variant.
MOVE p_vari TO rs_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = d_alv_save
CHANGING
cs_variant = rs_variant.
d_alv_varnt = rs_variant.
ELSE.
CLEAR d_alv_varnt.
d_alv_varnt = d_alv_repid.
ENDIF.
ENDFORM. " f_alv_selscr_input
*&---------------------------------------------------------------------*
*& Form F_BUILD_PRINT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_D_ALV_PRINT text
*----------------------------------------------------------------------*
FORM f_build_print CHANGING fc_print TYPE slis_print_alv.
fc_print-no_print_listinfos = 'X'.
fc_print-no_print_selinfos = 'X'.
fc_print-no_coverpage = 'X'.
ENDFORM. " F_BUILD_PRINT
*&---------------------------------------------------------------------*
*& Form F_ALV_BUILD_CATALOG_INPUT
*&---------------------------------------------------------------------*
FORM f_alv_build_catalog_checkbox
USING ft_fctlg TYPE slis_t_fieldcat_alv
fu_tbnam fu_fname fu_dscrp
fu_reftb fu_refld
fu_noout fu_outln fu_hotsp fu_jstfy
fu_dosum fu_rowpos fu_colpos
fu_icon fu_spgroup fu_keysel
fu_input fu_edit fu_box.
DATA: lv_fctlg TYPE slis_fieldcat_alv.
lv_fctlg-seltext_s = fu_dscrp.
lv_fctlg-seltext_m = fu_dscrp.
lv_fctlg-seltext_l = fu_dscrp.
lv_fctlg-reptext_ddic = fu_dscrp.
lv_fctlg-tabname = fu_tbnam.
lv_fctlg-fieldname = fu_fname.
lv_fctlg-ref_tabname = fu_reftb.
lv_fctlg-ref_fieldname = fu_refld.
lv_fctlg-no_out = fu_noout.
lv_fctlg-outputlen = fu_outln.
lv_fctlg-hotspot = fu_hotsp.
lv_fctlg-just = fu_jstfy.
lv_fctlg-do_sum = fu_dosum.
lv_fctlg-row_pos = fu_rowpos.
lv_fctlg-col_pos = fu_colpos.
lv_fctlg-icon = fu_icon.
lv_fctlg-sp_group = fu_spgroup.
lv_fctlg-key_sel = fu_keysel.
lv_fctlg-input = fu_input.
lv_fctlg-edit = fu_edit.
lv_fctlg-checkbox = fu_box.
APPEND lv_fctlg TO ft_fctlg.
ENDFORM. " F_ALV_BUILD_CATALOG_INPUT
*---------------------------------------------------------------------*
* FORM F_ALV_GRID_DISPLAY_EXIT *
*---------------------------------------------------------------------*
* Generate ALV grid display with event exit *
*---------------------------------------------------------------------*
FORM f_alv_grid_display_exit TABLES ft_table
ft_evt_exit TYPE slis_t_event_exit.
d_alv_varnt-report = d_alv_repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = d_alv_repid
i_callback_pf_status_set = d_alv_stats
i_callback_user_command = d_alv_ucomm
i_background_id = d_alv_bg_id
is_layout = d_alv_layout
it_fieldcat = t_alv_fctlg
it_sort = t_alv_isort[]
i_default = 'X'
i_save = d_alv_save
is_variant = d_alv_varnt
it_events = t_alv_event[]
is_print = d_alv_print
it_event_exit = ft_evt_exit[]
i_screen_start_column = d_alv_screen_start_column
i_screen_start_line = d_alv_screen_start_line
i_screen_end_column = d_alv_screen_end_column
i_screen_end_line = d_alv_screen_end_line
TABLES
t_outtab = ft_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " F_ALV_GRID_DISPLAY
Friday, June 4, 2010
include program : ZAB_ALV
Include ZAB_ALV - for create ALV Layout
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment