Re: Alv Vacio
Hola que tal, te voy a enviar como los defino yo en un reporte de sd que tengo aca espero te guien para solucionar.
FORM print_list .
* Se imprime ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = w_layout
it_fieldcat = w_field[]
i_save = 'X'
is_variant = w_es_variant
it_events = i_events
is_print = w_print
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = t_print
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
y para el catalogo esto:
FORM fill_catalog .
* Area de trabajo de catálogo
DATA: wa_field LIKE w_field WITH HEADER LINE.
* Se llena catálogo
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = w_repid
i_internal_tabname = 'T_PRINT'
i_inclname = w_repid
CHANGING
ct_fieldcat = w_field
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* se eliminan los campos key para que el reporte se emita según lo
* especificado.
CLEAR wa_field-key.
MODIFY w_field FROM wa_field TRANSPORTING key WHERE NOT key IS
INITIAL.
LOOP AT w_field INTO wa_field.
CASE wa_field-fieldname.
WHEN 'MBLNR'.
wa_field-seltext_l = 'Doc. Mat. '. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'SMBLN'.
wa_field-seltext_l = 'Doc. Mat. Anulado'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'ZEILE'.
wa_field-seltext_l = 'Posición'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'MATNR'.
wa_field-seltext_l = 'Material'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'MENGE'.
wa_field-seltext_l = 'Cantidad'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'MEINS'.
wa_field-seltext_l = 'Unidad Medida Base'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'CHARG'.
wa_field-seltext_l = 'Lote'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'SGTXT'.
wa_field-seltext_l = 'Texto'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'WERKS'.
wa_field-seltext_l = 'Centro'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'LGORT'.
wa_field-seltext_l = 'Almacén'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'BWART'.
wa_field-seltext_l = 'Clase de Movimiento'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'KUNNR'.
wa_field-seltext_l = 'Cliente'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'KDAUF'.
wa_field-seltext_l = 'Pedido Cliente'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'KDPOS'.
wa_field-seltext_l = 'Pos.pedido Cliente'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'NAME1'.
wa_field-seltext_l = 'Nombre ClientE'. "Titulo large
wa_field-ddictxt = 'L'.
MODIFY w_field FROM wa_field.
WHEN 'MBLNR2'.
wa_field-seltext_l = 'Documento Material'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
wa_field-no_out = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'USNAM'.
wa_field-seltext_l = 'Nombre del Usuario'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
WHEN 'XBLNR'.
wa_field-seltext_l = 'Nº Entrega'. "Titulo large
wa_field-ddictxt = 'L'.
wa_field-do_sum = 'X'.
MODIFY w_field FROM wa_field.
EXIT.
ENDCASE.
ENDLOOP.
Espero te sirva para algo.
__________________
Krystian Parada
Consultor Tecnico ABAP
|