Posts

Showing posts from July, 2011

Simplest ALV Code

Well, if not you, I reluctant to code for ALV. It's so much stereotype. And most of the boring job is to create the field catalog. Here is a quick and simple way to create ALV in just 3-4 lines of code :) To achieve this we will use the class  CL_ALV_TABLE . Even if you are not aware of object oriented programming, you can use these simple lines of codes to generate ALV report. I_TAB can be any table. You can declare it as normal table (either through type / like db table / or even OCCURS 0 type table).   DATA : lo_alv  TYPE   REF   TO  cl_salv_table,         lx_salv_msg  TYPE   REF   TO  cx_salv_msg,         l_msg( 40 )  TYPE   c  .    TRY .        CALL   METHOD  cl_salv_table=>factory *    EXPORTING *      list_display   = IF_SALV_C_BOOL_SAP=>FALSE *      r_container    = *      container_name =          IMPORTING           r_salv_table   = lo_alv          CHANGING           t_table        = i_tab           .      CATCH  cx_salv_msg  INTO  lx_salv