SAP ABAP4 Learning - Simple Example of Alv 1 - Write Excel Automatic

xiaoxiao2021-03-06  105

Report zhello.

Tables: mara.

* Define an internal table DATA: Begin of Itab Occurs 10, Matnr Like Mara-Matnr, Matnr Like Mara-Matnr, Matnr Like Mara-Mat, Meins Like Mara-Matnr, End Of Itab.

* TYPE-POOLS: SLIS.

* Define a row of Data: l_alv_filed type slis_fieldcat_alv of the inner table displayed.

* Define a list of frames displayed Data: l_alv_filedcat type slis_t_fieldcat_alv.clear l_alv_filed.

* Define the attributes of the first column * Define the display position, the field displayed. The same value as the name in the inner table * Display the title name L_Alv_Filed-col_pos = 1. 'matnr'.l_Alv_filed-seltext_m =' The first column '.append l_alv_filed to l_alv_filedcat.

L_alv_filed-col_pos = 2.l_alv_filed-fieldName = 'mtart'.l_alv_filed-seltext_m =' second column '.append l_alv_filed to l_alv_filedcat.

L_alv_filed-col_pos = 3.l_alv_filed-fieldname = 'meins'.l_alv_filed-seltext_m =' third column '.append l_alv_filed to l_alv_filedcat.

* Output screen Select-Options: p_matnr for mara-matnr.

* Query the data of the following three fields, then put in this Introduction Select Matnr Matart Meins Into Corresponding Fields of Table Itab from Mara Where Matnr in P_matnr.

Append itab.

* The following function is then called. Then * passed the defined display frame and the internal table. * Reuse_alv_list_displaycall function 'reuse_alv_grid_display' exporting it_fieldcat = l_alv_filedcat tables t_outtab = iTab.

转载请注明原文地址:https://www.9cbs.com/read-105153.html

New Post(0)