Sei sulla pagina 1di 4

> ESSE VAI FICAR NO TOPO DO PROGRAMA, APOS A DEFINIO "TABLES" ************************************************************************ * defines ************************************************************************ define insere_campo.

clear t_fieldcat. t_fieldcat-fieldname = &1. t_fieldcat-tabname = &2. t_fieldcat-reptext_ddic = &3. t_fieldcat-inttype = &4. t_fieldcat-outputlen = &5. t_fieldcat-emphasize = &6. append t_fieldcat. end-of-definition.

* alv - types type-pools: vrm, slis. * alv - tabelas internas data: t_listheader type slis_t_listheader, t_fieldcat type slis_t_fieldcat_alv with header line. * alv - variveis globais data: vg_listheader type slis_listheader, "Cabealho vg_layout type slis_layout_alv, "layout para sada vg_print type slis_print_alv, "Ctrl de impresso vg_repid like sy-repid, vg_variante like disvariant. "Variante de exibio

> NUNCA MUDA

***************************************** * inicializa_alv ***************************************** form inicializa_alv. vg_repid = sy-repid. clear vg_variante. vg_variante-report = vg_repid. call function 'REUSE_ALV_VARIANT_DEFAULT_GET' exporting i_save = 'A' changing cs_variant = vg_variante exceptions not_found = 2. check not sy-subrc is initial. endform. " inicializa_alv

> SOMENTE ALTERAR OS NOMES DE CAMPO, NOME DA TABELA E TIPO DE DADOS (C) OU (P) *******************************************

* define_colunas ******************************************* form define_colunas. insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo insere_campo endform. > POR ENQUANTO NO MUDA, APENAS TIRAR O PARAMETRO QUE CHAMA O MONTA_CABEARIO ************************************** * apresenta_alv ************************************** form apresenta_alv. * opes de impresso vg_layout-expand_all = 'X'. "Abrir subitens vg_layout-colwidth_optimize = 'X'. "Largura melhor possvel da coluna vg_layout-edit = ' '. "Permitir a edio vg_LAYOUT-DETAIL_POPUP = 'X'. vg_print-print = ' '. vg_print-prnt_title = 'X'. vg_print-prnt_info = 'X'. vg_print-no_print_selinfos = ' '. vg_print-reserve_lines = 1. vg_print-no_print_listinfos = ' '. vg_print-no_print_hierseq_item = ' '. vg_print-no_coverpage = ' '. call function 'REUSE_ALV_GRID_DISPLAY' exporting i_callback_program = vg_repid i_callback_top_of_page = 'MONTA_CABECALHO' it_fieldcat = t_fieldcat[] is_layout = vg_layout i_default = 'X' is_print = vg_print tables t_outtab = t_erros exceptions program_error =1 others = 2. check not sy-subrc is initial. 'BUKRS' 'T_DOCS' text-021 'C' 1 ''. 'KUNNR' 'T_DOCS' text-024 'C' 1 ''. 'AUGDT' 'T_DOCS' text-030 'C' 1 ''. 'AUGBL' 'T_DOCS' text-031 'C' 1 ''. 'ZUONR' 'T_DOCS' text-022 'C' 1 ''. 'BELNR' 'T_DOCS' text-026 'C' 1 ''. 'BUZEI' 'T_DOCS' text-033 'C' 1 ''. 'BLDAT' 'T_DOCS' text-034 'C' 1 ''. 'XBLNR' 'T_DOCS' text-028 'C' 1 ''. 'BLART' 'T_DOCS' text-027 'C' 1 ''. 'DMBTR' 'T_DOCS' text-029 'P' 1 ''. 'KIDNO' 'T_DOCS' text-035 'C' 1 ''. 'ZTERM' 'T_DOCS' text-036 'C' 1 ''. 'DMBTR_BSIS' 'T_DOCS' text-029 'P' 1 ''. 'VKGRP' 'T_DOCS' text-037 'C' 1 ''. 'VBELN' 'T_DOCS' text-038 'C' 1 ''.

endform. > APENAS USAR SE SEU ALV VAI TER UM CABEALHO PREENCHER OS CAMPOS VG_LISTHEADER-INFO COM SUAS STRINGS QUE VO SAIR NA TELA *************************************** * monta_cabecario *************************************** form monta_cabecalho. "#EC CALLED data: vl_high(20) type c. * ttulo clear t_listheader[]. clear vg_listheader. vg_listheader-typ = 'H'. vg_listheader-info = text-039. append vg_listheader to t_listheader. * empresa clear vg_listheader. vg_listheader-typ = 'S'. concatenate text-021 p_bukrs into vg_listheader-info separated by space. append vg_listheader to t_listheader. * representante clear vg_listheader. vg_listheader-typ = 'S'. concatenate text-022 p_zuonr into vg_listheader-info separated by space. append vg_listheader to t_listheader. * perodo liquidaes clear vg_listheader. vg_listheader-typ = 'S'. if not s_augdt-high is initial. concatenate c_ate s_augdt-high into vl_high separated by space. endif. concatenate text-023 s_augdt-low vl_high into vg_listheader-info separated by space. append vg_listheader to t_listheader. * define cabealho da ALV call function 'REUSE_ALV_COMMENTARY_WRITE' exporting it_list_commentary = t_listheader. endform.

Potrebbero piacerti anche