0% found this document useful (0 votes)
13 views3 pages

Z ALV GRID Codigo

The document is an ABAP report named ZALV_GRID that defines data structures and retrieves data from the BSEG and BKPF tables for display in an ALV grid. It sets up field catalog definitions for the columns to be displayed, including company code, document number, fiscal year, plant, and amount. The report utilizes the REUSE_ALV_GRID_DISPLAY function to present the data with specified layout options.

Uploaded by

Bettina Garcia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Z ALV GRID Codigo

The document is an ABAP report named ZALV_GRID that defines data structures and retrieves data from the BSEG and BKPF tables for display in an ALV grid. It sets up field catalog definitions for the columns to be displayed, including company code, document number, fiscal year, plant, and amount. The report utilizes the REUSE_ALV_GRID_DISPLAY function to present the data with specified layout options.

Uploaded by

Bettina Garcia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

*&---------------------------------------------------------------------*

*& Report ZALV_GRID


*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zalv_grid.

TYPE-POOLS: slis. "se debe incluir versiones anteriores a 7.40

TYPES: BEGIN OF ty_bseg,


bukrs_it TYPE bseg-bukrs,
belnr_it TYPE bseg-belnr,
gjahr_it TYPE bseg-gjahr,
werks_it TYPE bseg-werks,
wrbtr_it TYPE bseg-wrbtr,
END OF ty_bseg.

**"Tabla con los datos:


DATA: it_bseg TYPE STANDARD TABLE OF ty_bseg,
it_bkpf TYPE STANDARD TABLE OF bkpf.

**"Tabla fieldcat (define campos de la tabla)


DATA: it_fcat TYPE STANDARD TABLE OF slis_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv.

DATA: wa_layout TYPE slis_layout_alv,


vl_variant TYPE disvariant.
REFRESH: it_fcat, it_bkpf, it_bseg.

***Armar fieldcat (definir columnas del ALV)


CLEAR: wa_fcat.
wa_fcat-fieldname = 'BUKRS_IT'.
wa_fcat-ref_tabname = 'BSEG'.
wa_fcat-ref_fieldname = 'BUKRS'.
wa_fcat-key = 'X'.
wa_fcat-no_zero = 'X'.
APPEND wa_fcat TO it_fcat.

CLEAR: wa_fcat.
wa_fcat-fieldname = 'BELNR_IT'.
wa_fcat-outputlen = 10.
wa_fcat-seltext_s = 'Nº doc.'.
wa_fcat-seltext_m = TEXT-002.
wa_fcat-seltext_l = TEXT-002.
wa_fcat-key = 'X'.
wa_fcat-no_zero = 'X'.
APPEND wa_fcat TO it_fcat.

CLEAR: wa_fcat.
wa_fcat-fieldname = 'GJAHR_IT'.
wa_fcat-ref_tabname = 'BSEG'.
wa_fcat-ref_fieldname = 'GJAHR'.
APPEND wa_fcat TO it_fcat.

CLEAR: wa_fcat.
wa_fcat-fieldname = 'WERKS_IT'.
wa_fcat-ref_tabname = 'BSEG'.
wa_fcat-ref_fieldname = 'WERKS'.
APPEND wa_fcat TO it_fcat.
CLEAR: wa_fcat.
wa_fcat-fieldname = 'WRBTR_IT'.
wa_fcat-ref_tabname = 'BSEG'.
wa_fcat-ref_fieldname = 'WRBTR'.
APPEND wa_fcat TO it_fcat.

"Obtener los datos y llenar las tablas internas


SELECT bukrs belnr gjahr werks wrbtr
FROM bseg
INTO TABLE it_bseg.

SELECT * FROM bkpf


INTO TABLE it_bkpf.

*"Layout
CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'.
wa_layout-zebra = 'X'.
*
** Para la variante o disposición
vl_variant-report = 'ZALV_GRID'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = 'BKPF' "Estructura o tabla transparente del
ddic.
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE = 'TITULO ALV GRID BSEG'
* I_GRID_SETTINGS =
IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT = vl_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* O_PREVIOUS_SRAL_HANDLER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_bseg "Tabla con los datos
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy