¡Caminando hacia el éxito!

Aprende en Comunidad

Avalados por :

Cómo insertar inicio de lista y fin de lista en un ALV GRID en SAP ABAP

  • Creado 01/03/2024
  • Modificado 01/03/2024
  • 39 Vistas
0
Cargando...

Hola, me gustaría insertar un "inicio de lista" y un "fin de lista" en un ALV GRID, ¿es posible? El problema es que el inicio es demasiado grande, por lo que necesitamos mostrarlo solo en la primera página y al mismo tiempo necesitamos que se muestre un fin de lista.

Aquí enviamos nuestro código, cuando usamos ALV List funciona bien pero con ALV GRID no. Nos muestra el fin de lista como un inicio de lista y el inicio de lista desaparece.

...

realizar evento_formulario.

*

realizar imprimir_datos.

...

&----


*& Formulario evento_formulario

&----


formulario evento_formulario.

  • Establecer evento TOP_OF_PAGE y rutina en la que se maneja

ls_event-name = slis_ev_top_of_page.

ls_event-form = 'CABECERA_ALV'.

añadir ls_event a event_tab.

borrar ls_event.

*

  • Establecer evento TOP_OF_LIST y rutina en la que se maneja

ls_event-name = slis_ev_top_of_list.

ls_event-form = 'XINICIO_DE_LISTA'.

añadir ls_event a event_tab.

borrar ls_event.

ls_event-name = slis_ev_end_of_list .

ls_event-form = 'XFIN_DE_LISTA'.

añadir ls_event a event_tab.

borrar ls_event .

endform. " evento_formulario

&----


*& Formulario imprimir_datos

&----


  • texto

----


  • --> p1 texto

  • <-- p2 texto

----


formulario imprimir_datos.

  • Mostrar datos con función de módulo

data: w_callback like sy-repid.

w_callback = sy-repid.

  • LLAMAR FUNCIÓN 'REUSE_ALV_LIST_DISPLAY'

llamar función 'REUSE_ALV_GRID_DISPLAY'

exportar

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = w_callback

  • --------------" activar si se desea manejar una interfaz de usuario personalizada

    • i_callback_pf_status_set = 'MI_ESTADO'

i_callback_user_command = 'COMANDO_USUARIO'

i_structure_name = 'ZZPFIT00032'

  • i_background_id = ' '

is_layout = layout

it_fieldcat = tb_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • it_sort = tb_u_sort[]

  • IT_FILTER =

  • <
Pedro Pascal
Se unió el 07/03/2018
Pinterest
Telegram
Linkedin
Whatsapp

4 Respuestas

0
Cargando...

Hola,

Mira este código.

REPORT ZBHALV_LIST1.

TABLES:MARA.

SELECT-OPTIONS: MATNR FOR MARA-MATNR.

DATA:BEGIN OF ITAB OCCURS 0,

MATNR LIKE MARA-MATNR,

ERSDA LIKE MARA-ERSDA,

MTART LIKE MARA-MTART,

MBRSH LIKE MARA-MBRSH,

END OF ITAB.

SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR

IN MATNR.

TYPE-POOLS SLIS.

DATA:FCAT TYPE slis_t_fieldcat_alv.

DATA:LAYOUT TYPE slis_layout_alv.

DATA:EVE TYPE slis_t_event WITH HEADER LINE.

DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.

DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.

SORT-UP = 'X'.

SORT-SPOS = 1.

SORT-FIELDNAME = 'ERSDA'.

SORT-tabname = 'MARA'.

APPEND SORT.

SORT-SPOS = 2.

SORT-FIELDNAME = 'MTART'.

SORT-tabname = 'MARA'.

APPEND SORT.

EVE-NAME = 'TOP_OF_PAGE'.

EVE-FORM = 'TOPOFPAGE'.

APPEND EVE.

EVE-NAME = 'TOP_OF_LIST'.

EVE-FORM = 'TOPOFLIST'.

APPEND EVE.

EVE-NAME = 'END_OF_LIST'.

EVE-FORM = 'ENDOFLIST'.

APPEND EVE.

LAYOUT-ZEBRA = 'X'.

LAYOUT-no_hline = 'X'.

LAYOUT-NO_VLINE = 'X'.

LAYOUT-window_titlebar = 'DETALLES DEL MATERIAL'.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = SY-REPID

I_INTERNAL_TABNAME = 'ITAB'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = SY-REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = FCAT

  • 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.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-REPID

  • I_CALLBACK_PF_STATUS_SET =

  • I_CALLBACK_USER_COMMAND =

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Muchas gracias, pero no puedo usar ALV BLOCK...

Claudia

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Hi

it is possible in following way.......

REPORT ZALV1.

****************** TABLE DECLARATION ***********************************

TABLES : VBAP. " tables declaration

***************** TYPE POOLS *******************************************

TYPE-POOLS : SLIS. " slis type pool

***************** INTERNAL TABLE DECLARATION ***************************

DATA : BEGIN OF IT_VBAP OCCURS 0,

" internal table for sales document item

VBELN LIKE VBAP-VBELN, " sales document

POSNR LIKE VBAP-POSNR, " document item

ERNAM LIKE VBAP-ERNAM,

" name of the person who created the object

ERDAT LIKE VBAP-ERDAT, " date on which the record was created

MATNR LIKE VBAP-MATNR. " material number

DATA : END OF IT_VBAP.

DATA : BEGIN OF IT_MARA OCCURS 0, " general material data

MATNR LIKE MARA-MATNR, " material number

ERNAM LIKE MARA-ERNAM,

" name of the person who created the object

MATKL LIKE MARA-MATKL, " material group

MEINS LIKE MARA-MEINS, " base unit of measure

PSTAT LIKE MARA-PSTAT. " maintainence status

DATA : END OF IT_MARA.

******************VARIABLE

DECLARATION **********************************

DATA : REPID LIKE SY-REPID. " program name

DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

" field catalog table for vbap

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

DATA : IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,

" field catalog table for mara

WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.

DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA: GT_XEVENTS TYPE SLIS_T_EVENT.

DATA: GT_YEVENTS TYPE SLIS_T_EVENT. " events table

DATA : XS_EVENT TYPE SLIS_ALV_EVENT. " events type

DATA : GT_PRINT TYPE SLIS_PRINT_ALV. " print table

*******************MULTIPLE SELECT INPUT

PARAMETERS **********************

SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.

" multiple selection for sales document

****************** INITIALIZATION **************************************

***

INITIALIZATION.

REPID = SY-REPID.

*******************START OF

SELECTION ************************************

START-OF-SELECTION.

PERFORM POP_VBAP.

" populating the table with document item data

PERFORM POP_MARA.

" populating the table with general material data

PERFORM FIELD_CAT.

" mapping the fields for the field catalog

PERFORM EVENTS. " using the events

PERFORM BLOCK_LIST.

" displaying the data in blocked list

&----


&----


&----


&----


&----


&----

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Hi

it is possible in following way.......

REPORT ZALV1.

****************** TABLE DECLARATION ***********************************

TABLES : VBAP. " tables declaration

***************** TYPE POOLS *******************************************

TYPE-POOLS : SLIS. " slis type pool

***************** INTERNAL TABLE DECLARATION ***************************

DATA : BEGIN OF IT_VBAP OCCURS 0,

" internal table for sales document item

VBELN LIKE VBAP-VBELN, " sales document

POSNR LIKE VBAP-POSNR, " document item

ERNAM LIKE VBAP-ERNAM,

" name of the person who created the object

ERDAT LIKE VBAP-ERDAT, " date on which the record was created

MATNR LIKE VBAP-MATNR. " material number

DATA : END OF IT_VBAP.

DATA : BEGIN OF IT_MARA OCCURS 0, " general material data

MATNR LIKE MARA-MATNR, " material number

ERNAM LIKE MARA-ERNAM,

" name of the person who created the object

MATKL LIKE MARA-MATKL, " material group

MEINS LIKE MARA-MEINS, " base unit of measure

PSTAT LIKE MARA-PSTAT. " maintainence status

DATA : END OF IT_MARA.

******************VARIABLE

DECLARATION **********************************

DATA : REPID LIKE SY-REPID. " program name

DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

" field catalog table for vbap

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

DATA : IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,

" field catalog table for mara

WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.

DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA: GT_XEVENTS TYPE SLIS_T_EVENT.

DATA: GT_YEVENTS TYPE SLIS_T_EVENT. " events table

DATA : XS_EVENT TYPE SLIS_ALV_EVENT. " events type

DATA : GT_PRINT TYPE SLIS_PRINT_ALV. " print table

*******************MULTIPLE SELECT INPUT

PARAMETERS **********************

SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.

" multiple selection for sales document

****************** INITIALIZATION **************************************

***

INITIALIZATION.

REPID = SY-REPID.

*******************START OF

SELECTION ************************************

START-OF-SELECTION.

PERFORM POP_VBAP.

" populating the table with document item data

PERFORM POP_MARA.

" populating the table with general material data

PERFORM FIELD_CAT.

" mapping the fields for the field catalog

PERFORM EVENTS. " using the events

PERFORM BLOCK_LIST.

" displaying the data in blocked list

&----


----


----


FORM FIELD_CAT .

WA_FIELDCAT-FIELDNAME = 'VBELN'.

WA_FIELDCAT-TABNAME = 'IT_VBAP'.

WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.

WA_FIELDCAT-COL_POS =

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019

contacto@primeinstitute.com

(+51) 1641 9379
(+57) 1489 6964

© 2024 Copyright. Todos los derechos reservados.

Desarrollado por Prime Institute

¡Hola! Soy Diana, asesora académica de Prime Institute, indícame en que curso estas interesado, saludos!
Hola ¿Puedo ayudarte?