Documente Academic
Documente Profesional
Documente Cultură
*
*
*----------------------------------------------------------------------* Tabelas
*----------------------------------------------------------------------DATA: t_fieldcat TYPE TABLE OF slis_fieldcat_alv.
DATA: t_vbap
TYPE TABLE OF y_vbap with header line.
DATA: t_listheader TYPE TABLE OF slis_listheader,
t_color
TYPE TABLE OF slis_specialcol_alv,
t_sort
TYPE TABLE OF slis_sortinfo_alv,
t_linecolor TYPE TABLE OF slis_specialcol_alv,
t_print
TYPE TABLE OF y_print.
*---------------------------------------------------------------------START-OF-SELECTION.
*---------------------------------------------------------------------PERFORM F_SELECT.
*---------------------------------------------------------------------END-OF-SELECTION.
*---------------------------------------------------------------------PERFORM F_MONTA_TABELA.
PERFORM F_SORT.
PERFORM F_PRINT.
*---------------------------------------------------------------------*&---------------------------------------------------------------------*
*&
Form F_SELECT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form F_SELECT .
select a~VBELN a~POSNR a~MATNR a~ARKTX a~KMPMG a~CHARG a~BRGEW a~NTGEW
a~NETWR b~GBSTA
into table t_vbap
from vbap as a inner join vbup as b on a~vbeln = b~vbeln AND a~posnr = b~posnr
where a~vbeln in s_vbeln.
LOOP AT t_vbap INTO w_vbap.
CLEAR w_print.
w_print-vbeln = w_vbap-vbeln.
w_print-posnr = w_vbap-posnr.
w_print-matnr = w_vbap-matnr.
w_print-arktx = w_vbap-arktx.
w_print-kmpmg = w_vbap-kmpmg.
w_print-charg = w_vbap-charg.
w_print-brgew = w_vbap-brgew.
w_print-ntgew = w_vbap-ntgew.
w_print-netwr = w_vbap-netwr.
w_print-gbsta = w_vbap-gbsta.
CASE w_print-gbsta.
WHEN 'A'.
w_alv-color-col = '6'.
WHEN 'B'.
w_alv-color-col = '2'.
WHEN 'C'.
w_alv-color-col = '5'.
ENDCASE.
ENDLOOP.
endform.
" F_SELECT
*&---------------------------------------------------------------------*
*&
Form F_SORT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form F_SORT .
IF p_mat IS NOT INITIAL.
w_sort-fieldname = 'MATNR'.
w_sort-up
= 'X'.
w_sort-subtot = 'X'.
APPEND w_sort TO t_sort.
ENDIF.
IF p_ordem IS NOT INITIAL.
w_sort-fieldname = 'VBELN'.
w_sort-up
= 'X'.
w_sort-subtot = 'X'.
APPEND w_sort TO t_sort.
ENDIF.
endform.
" F_SORT
*&---------------------------------------------------------------------*
*&
Form F_PRINT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form F_PRINT .
CASE 'X'.
*---------------------------------------------------------------------*QUANDO ESCOLHIDO RELATRIO ALV GRID DISPLAY
*----------------------------------------------------------------------
WHEN p_rad1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout
= w_layout
it_fieldcat
= t_fieldcat
it_sort
= t_sort
TABLES
t_outtab
= t_print.
*---------------------------------------------------------------------*QUANDO ESCOLHIDO RELATRIO ALV LIST DISPLAY
*---------------------------------------------------------------------WHEN p_rad2.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout
= w_layout
it_fieldcat
= t_fieldcat
it_sort
= t_sort
TABLES
t_outtab
= t_print.
ENDCASE.
endform.
" F_PRINT
*&---------------------------------------------------------------------*
*&
Form F_MONTA_TABELA
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form F_MONTA_TABELA .
CLEAR w_fieldcat.
refresh t_linecolor.
IF p_ordem IS INITIAL.
w_fieldcat-no_out = 'X'.
ENDIF.
w_fieldcat-col_pos = 1 .
w_fieldcat-fieldname = 'VBELN'.
w_fieldcat-seltext_m = 'N ORDEM'.
APPEND w_fieldcat TO t_fieldcat.
IF p_ordem IS INITIAL.
w_fieldcat-no_out = 'X'.
ENDIF.
w_fieldcat-col_pos = 2 .
w_fieldcat-fieldname = 'POSNR'.
w_fieldcat-seltext_m = 'ITEM'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 3 .
w_fieldcat-fieldname = 'MATNR'.
w_fieldcat-seltext_m = 'MATERIAL'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 4 .
w_fieldcat-fieldname = 'ARKTX'.
w_fieldcat-seltext_m = 'DENOMINAO'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 5 .
w_fieldcat-fieldname = 'KMPMG'.
w_fieldcat-seltext_m = 'QTD. ORDEM'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 6 .
w_fieldcat-fieldname = 'CHARG'.
w_fieldcat-seltext_m = 'LOTE'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 7 .
w_fieldcat-fieldname = 'BRGEW'.
w_fieldcat-seltext_m = 'PESO BRUTO'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 8 .
w_fieldcat-fieldname = 'NTGEW'.
w_fieldcat-seltext_m = 'PESO LQ.'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 9 .
w_fieldcat-fieldname = 'NETWR'.
w_fieldcat-seltext_m = 'VALOR LQ.'.
APPEND w_fieldcat TO t_fieldcat.
w_fieldcat-col_pos = 10 .
w_fieldcat-fieldname = 'GBSTA'.
w_fieldcat-seltext_m = 'STATUS'.
APPEND w_fieldcat TO t_fieldcat.
w_layout-zebra
= 'X'. "Zebra
w_layout-expand_all
= 'X'. "Abrir subitens
w_layout-colwidth_optimize = 'X'. "Largura melhor possvel da coluna
w_layout-coltab_fieldname = 'COLOR'.
endform.
" F_MONTA_TABELA