Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
TYPE
TYPE
TYPE
TYPE
TYPE
C
C
C
C
C
MATCHCODE
MATCHCODE
MATCHCODE
MATCHCODE
MATCHCODE
OBJECT
OBJECT
OBJECT
OBJECT
OBJECT
C_VKORG,
Z_AYUDA_CANAL,
Z_AYUDA_SECTOR,
Z_AYUDA_CLIENTE,
Z_AYUDA_TCLIENTE.
********--------------------------------***********
*
Start-of-selection.
*
********--------------------------------***********
SELECTION-SCREEN END OF BLOCK SEL.
START-OF-SELECTION.
END-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
********--------------------------------***********
*&
Form BUILD_EVENTS
*
********--------------------------------***********
*
la tabla de eventos
*
********--------------------------------***********
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
ENDFORM.
" BUILD_EVENTS
********--------------------------------***********
*&
Form BUILD_LAYOUT
********--------------------------------***********
*
Diseo para crear ALV grid
********--------------------------------***********
form build_layout.
gd_layout-no_input
= 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text
= 'Totals'(201).
ENDFORM.
" BUILD_LAYOUT
********--------------------------------***********
*&
Form DISPLAY_ALV_REPORT
********--------------------------------***********
*
Presentacin del ALV grid
********--------------------------------***********
FORM display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program
= gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
is_layout
it_fieldcat
= gd_layout
= fieldcatalog[]
it_events
is_print
i_save
= gt_events
= gd_prntparams
= 'X'
tables
t_outtab
exceptions
program_error
others
if sy-subrc <> 0.
ENDIF.
ENDFORM.
= TI_KNA1
= 1
= 2.
" DISPLAY_ALV_REPORT
********--------------------------------***********
*&
Form DATA_RETRIEVAL
********--------------------------------***********
* Recuperar los datos del formulario y llenar la tabla interna TI_KNA1*
********--------------------------------***********
FORM data_retrieval.
*************************************************************************
*
*
SELECT KNA1~KUNNR KNA1~NAME1 KNA1~NAME2 KNVP~PARVW KNVV~KDGRP
INTO CORRESPONDING FIELDS OF TABLE TI_KNA1 FROM KNA1
INNER JOIN KNVV ON KNA1~KUNNR = KNVV~KUNNR
INNER JOIN TVTW ON KNVV~VTWEG = TVTW~VTWEG
INNER JOIN TSPA ON KNVV~SPART = TSPA~SPART
INNER JOIN KNVP ON KNA1~KUNNR = KNVP~KUNNR
INNER JOIN TVKO ON KNVP~VKORG = TVKO~VKORG
WHERE KNVV~KUNNR = KNVP~KUNNR AND KNVP~VKORG = KNVV~VKORG
AND KNVP~SPART = KNVV~SPART AND KNVP~VTWEG = KNVV~VTWEG
*AND TVKO~VKORG = KNVV~VKORG.
AND TVKO~VKORG = KNVV~VKORG AND BRSCH ='0001'.
*SELECT * INTO CORRESPONDING FIELDS OF TABLE TI_KNA1 FROM TVKO.
ENDFORM.
" DATA_RETRIEVAL
*
*
*************************************************************************
********--------------------------------***********
* Form TOP-OF-PAGE
*
********--------------------------------***********
*
ALV Encabezado
*
********--------------------------------***********
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c,
distribuidoras(10) type c.
* Titulo
wa_header-typ = 'H'.
wa_header-info = 'Reporte de Clientes Directos e Indirectos por distribuidoras
propias e independientes'.
append wa_header to t_header.
clear wa_header.
* Fecha
wa_header-typ = 'S'.
wa_header-key = 'Fecha: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info.
append wa_header to t_header.
clear: wa_header.
"fecha de hoy
* Nombre de Distrbuidora
wa_header-typ = 'S'.
wa_header-key = 'Distribuidora: '.
wa_header-info = Distrib.
append wa_header to t_header.
clear: wa_header.
* Total No. de registros seleccionados
describe table TI_KNA1 lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. de registros seleccionados: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
ENDFORM.
********--------------------------------***********
*&
Form BUILD_FIELDCATALOG
********--------------------------------***********
*
catlogo de campo para el ALV
********--------------------------------***********
form build_fieldcatalog.
fieldcatalog-fieldname
fieldcatalog-seltext_m
fieldcatalog-col_pos
fieldcatalog-outputlen
fieldcatalog-emphasize
fieldcatalog-key
=
=
=
=
=
=
'KUNNR'.
'Territorio'.
0.
10.
'X'.
'X'.
" BUILD_FIELDCATALOG
********--------------------------------***********
*&
Form BUILD_PRINT_PARAMS
*
********--------------------------------***********
*Parmetros de configuracin para imprimir los datos
********--------------------------------***********
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
ENDFORM.
" BUILD_PRINT_PARAMS
********--------------------------------***********
*&
Form END_OF_PAGE
*
********--------------------------------***********
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10)
type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
ENDFORM.
********--------------------------------***********
*&
Form END_OF_LIST
*
********--------------------------------***********
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10)
type c.
skip.
write:/40 'Page:', sy-pagno .
ENDFORM.