Pages

Friday, 29 August 2014

ALV Report Part 01 - Simple ALV Report Using Function

This is my learning note about ALV. I remember when the first time i learn ABAP and its reporting. My first ALV report retrieve data from flight table and display it in ALV list.





The Source code is something like this :

 REPORT z_alv_01.  
 TABLES : sflight.  
 DATA  : gt_sflight TYPE STANDARD TABLE OF sflight.  
 SELECT-OPTIONS : s_carrid FOR sflight-carrid.  
 START-OF-SELECTION.  
 * Get data from table SFLIGHT  
  SELECT * FROM sflight INTO TABLE gt_sflight UP TO 10 ROWS  
   WHERE carrid IN s_carrid.  
 * Call Function for display ALV List  
   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'  
    EXPORTING  
     I_STRUCTURE_NAME  = 'SFLIGHT'  
     i_callback_program = sy-repid  
    TABLES  
     t_outtab      = gt_sflight  
    EXCEPTIONS  
     program_error   = 1  
     OTHERS       = 2.  

Then if i want to change this alv list into grid model, i just change this line code :
   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'   

into :
   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'   

Alv list become grid like below.


Thats all my note about simple ALV using FM.
One of My first ALV report in my life as ABAPer.

No comments:

Post a Comment