0% found this document useful (0 votes)
14 views5 pages

ALV For All Entries

The document outlines an ABAP report program that retrieves and displays material data from the MARA and MAKT tables using ALV (ABAP List Viewer). It defines data structures for material information, processes the data, and sets up field catalog entries for display. The final output is presented in a grid format using the REUSE_ALV_GRID_DISPLAY function.

Uploaded by

DPMU ANAND -VZM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

ALV For All Entries

The document outlines an ABAP report program that retrieves and displays material data from the MARA and MAKT tables using ALV (ABAP List Viewer). It defines data structures for material information, processes the data, and sets up field catalog entries for display. The final output is presented in a grid format using the REUSE_ALV_GRID_DISPLAY function.

Uploaded by

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

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

*& Report Z_SAMPLE_ALV_FORALLENTRIES


*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_SAMPLE_ALV_FORALLENTRIES.

TYPES: BEGIN OF t_mara,


matnr type mara-matnr, "Material Number
laeda type mara-laeda, "Date of Last Change
ersda type mara-ersda, "Created On
ernam type mara-ernam, "Name of Person who Created the Object
END OF t_mara.
TYPES: BEGIN OF t_makt,
matnr type makt-matnr, "Material Number
maktx type makt-maktx, "Material description
END OF t_makt.

TYPES: BEGIN OF t_final,


matnr type mara-matnr, "Material Number
laeda type mara-laeda, "Date of Last Change
ersda type mara-ersda, "Created On
ernam type mara-ernam, "Name of Person who Created the Object
maktx type makt-maktx, "Material description
END OF t_final.

DATA : it_mara type standard table of t_mara,


wa_mara type t_mara,
it_makt type standard table of makt,
wa_makt type t_makt,
it_final type standard table of t_final,
wa_final type t_final.

DATA: it_fcat type slis_t_fieldcat_alv,


wa_fcat type slis_fieldcat_alv.

DATA: v_matnr type mara-matnr.


select-options s_matnr for v_matnr.
start-of-selection.
perform get_data.
perform data_process.
perform fcat.
perform display.

*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data.

select matnr
laeda
ersda
ernam from mara into table it_mara where matnr in s_matnr.

if it_mara is not initial.

SELECT MATNR
MAKTX FROM MAKT INTO TABLE it_makt for all entries in it_mara
where matnr = it_mara-matnr.
endif.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DATA_PROCESS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM data_process .
Loop at it_mara into wa_mara.

read table it_makt into wa_makt with key matnr = wa_mara-matnr.


wa_final-matnr = wa_mara-matnr.
wa_final-laeda = wa_mara-laeda.
wa_final-ersda = wa_mara-ersda.
wa_final-ernam = wa_mara-ernam.
wa_final-maktx = wa_makt-maktx.

append wa_final to it_final.


endloop.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fcat .
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME ='MATNR'.
WA_FCAT-TABNAME ='IT_FINAL'.
WA_FCAT-KEY = 'X'.
WA_FCAT-SELTEXT_L = 'MATERIAL NUMBER'.
APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME ='LAEDA'.
WA_FCAT-TABNAME ='IT_FINAL'.
WA_FCAT-SELTEXT_M ='DATE OF LAST CHANGED'.
APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.
WA_FCAT-COL_POS = 3.
WA_FCAT-FIELDNAME ='ersda'.
WA_FCAT-TABNAME ='IT_FINAL'.
WA_FCAT-SELTEXT_M ='created on'.
APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.
WA_FCAT-COL_POS = 4.
WA_FCAT-FIELDNAME ='ernam'.
WA_FCAT-TABNAME ='IT_FINAL'.
WA_FCAT-SELTEXT_M ='material group'.
APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.
WA_FCAT-COL_POs = 5.
WA_FCAT-FIELDNAME ='maktx'.
WA_FCAT-TABNAME ='IT_FINAL'.
WA_FCAT-SELTEXT_M ='material description'.
APPEND WA_FCAT TO IT_FCAT.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display .
CALL FUNCTION 'REUSE_ALV_GRID_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 = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = it_fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_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 =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

ENDFORM.
Output

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