ALV Grid using HR_DISPLAY_BASIC_LIST

HR_DISPLAY_BASIC_LIST
Share on Facebook4Share on LinkedIn1Tweet about this on TwitterShare on Google+1
Please Share!!

ALV display can be done with the FM HR_DISPLAY_BASIC_LIST.

A small program to explore the basics of this FM.

[adToAppearHere]

TABLES:
marc.

DATA: BEGIN OF data_table OCCURS 0,
matnr LIKE marc-matnr,
werks LIKE marc-werks,
pstat LIKE marc-pstat,
mmsta LIKE marc-mmsta,
END OF data_table.

DATA: BEGIN OF fieldname_table OCCURS 3,
title(60) TYPE c,
table(6) TYPE c,
field(10) TYPE c,
type(1) TYPE c,
END OF fieldname_table.

DATA: headline(80).
DATA: BEGIN OF error_tab OCCURS 10. “Error table
INCLUDE STRUCTURE hrerror.
DATA: END OF error_tab.

PERFORM get_data.
PERFORM set_column_headers.
PERFORM setup_control.

*&———————————————————————*
*& Form get_data
*&———————————————————————*
FORM get_data .

SELECT * UP TO 500 ROWS FROM marc INTO CORRESPONDING FIELDS OF TABLE
data_table.
ENDFORM. ” get data

*&——————————————————————–*
*& Form set_column_headers
*&——————————————————————–*
* text
*———————————————————————*
FORM set_column_headers.

fieldname_table-title = ‘Material Number’.
fieldname_table-table = ‘MARC’.
fieldname_table-field = ‘MATNR’.
fieldname_table-type = ”.

APPEND fieldname_table.

fieldname_table-title = ‘Plant’.
fieldname_table-field = ‘WERKS’.
APPEND fieldname_table.

fieldname_table-title = ‘Maintenance status’.
fieldname_table-field = ‘PSTAT’.
APPEND fieldname_table.

fieldname_table-title = ‘Plant-Specific Material Status’.
fieldname_table-field = ‘MMSTA’.
APPEND fieldname_table.

ENDFORM.

*&———————————————————————*
*& Form setup_control
*&———————————————————————*
FORM setup_control .

CALL FUNCTION ‘HR_DISPLAY_BASIC_LIST’
EXPORTING
file_name = sy-repid
head_line1 = ‘head1’
foot_note1 = ‘foot1’
dyn_pushbutton_text1 = ‘Push1’
dyn_pushbutton_text2 = ‘Push2′
LIST_LEVEL = ’01’
no_alv_grid = ‘X’
TABLES
data_tab = data_table
fieldname_tab = fieldname_table .

ENDFORM.

Sample Output of the above piece of code.

 

 

You might also like to check our other post on alternative to REUSE_ALV_GRID_DISPLAY, titled, Why are developers so fond of REUSE_ALV_GRID_DISPLAY.

If you want to get such practical issues and resolutions straight to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

Thank you very much for your time!!

If you liked it, please share it.

 

 

 

Image source : www.youtube.com

Share on Facebook4Share on LinkedIn1Tweet about this on TwitterShare on Google+1
Please Share!!

About the Author

SAP Yard
SAP Yard
SAPYard is one stop page for all Technical Folks in SAP. You would find un-conventional explanations, tutorials, and tricks. Please like our Facebook Page and also join our LinkedIn Group.

2 Comments on "ALV Grid using HR_DISPLAY_BASIC_LIST"

  1. Thanks Bhav.. our tag: Together we learn.. 🙂

  2. Interesting …
    Raju
    Thanks for sharing

Comments are closed.