Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV- Reports

Former Member
0 Kudos

Hi Friends,

can u get me some material link to gain the knowledge about ALV reports, coz i dont have any idea about ALV

Thanks in Advance.

Thanks&Regards

Rinky

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
7 REPLIES 7

0 Kudos

Here is a sample program which uses the function module based ALV grid.



REPORT ZRICH_0003 . 

* Tables. 
TABLES: MARA. 

* Global ALV Data Declarations 
TYPE-POOLS: SLIS. 

* Internal Tables 
DATA: BEGIN OF ITAB OCCURS 0, 
      MATNR TYPE MARA-MATNR, 
      MAKTX TYPE MAKT-MAKTX, 
      END OF ITAB. 

DATA: FIELDCAT  TYPE SLIS_T_FIELDCAT_ALV. 

* Selection Screen 
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002 . 
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. 
SELECTION-SCREEN END OF BLOCK B1. 

START-OF-SELECTION. 

  PERFORM GET_DATA. 
  PERFORM CALL_ALV. 

********************************************************************* 
*      Form  GET_DATA 
********************************************************************* 
FORM GET_DATA. 

  SELECT MARA~MATNR MAKT~MAKTX 
          INTO CORRESPONDING FIELDS OF TABLE ITAB 
               FROM MARA 
                 INNER JOIN MAKT 
                  ON MARA~MATNR = MAKT~MATNR 
                   WHERE MARA~MATNR IN S_MATNR 
                     AND MAKT~SPRAS = SY-LANGU. 

ENDFORM. 

************************************************************************ 
*  CALL_ALV 
************************************************************************ 
FORM CALL_ALV. 

  DATA: VARIANT TYPE  DISVARIANT. 

  VARIANT-REPORT = SY-REPID. 
  VARIANT-USERNAME = SY-UNAME. 

  PERFORM BUILD_FIELD_CATALOG. 

* Call ABAP List Viewer (ALV) 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
       EXPORTING 
            IT_FIELDCAT = FIELDCAT 
            IS_VARIANT  = VARIANT 
            I_SAVE      = 'U' 
       TABLES 
            T_OUTTAB    = ITAB. 

ENDFORM. 

************************************************************************ 
* BUILD_FIELD_CATALOG 
************************************************************************ 
FORM BUILD_FIELD_CATALOG. 

  DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE. 
  DATA: LABEL(30) TYPE C. 

  CLEAR: FIELDCAT. REFRESH: FIELDCAT. 

  PERFORM UPDATE_CATALOG USING 'Material Number' 
                            'ITAB' 
                            'MATNR' 
                            '18' 
                            SPACE 
                            SPACE 
                            'L'. 

  PERFORM UPDATE_CATALOG USING 'Material Description' 
                            'ITAB' 
                            'MAKTX' 
                            '40' 
                            SPACE 
                            SPACE 
                            'L'. 


ENDFORM. 

************************************************************************ 
* UPDATE_CATALOG 
************************************************************************ 
FORM UPDATE_CATALOG USING COL_HEAD 
                          TABLE 
                          FIELD 
                          OUTPUTLEN 
                          DO_SUM 
                          NO_OUT 
                          JUST. 

  DATA: TMP_FC TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE. 

  TMP_FC-REPTEXT_DDIC = COL_HEAD. 
  TMP_FC-FIELDNAME    = FIELD. 
  TMP_FC-TABNAME      = TABLE. 
  TMP_FC-OUTPUTLEN    = OUTPUTLEN. 
  TMP_FC-JUST         = JUST. 
  TMP_FC-DECIMALS_OUT = 0. 
  TMP_FC-DO_SUM      = DO_SUM. 
  TMP_FC-NO_OUT      = NO_OUT. 
  APPEND TMP_FC TO FIELDCAT. 

ENDFORM.

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

0 Kudos

Welcome to SDN and the ABAP world!!!

Please make sure to award points for helpful answers and mark your posts as solved when answered completely. Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos

HI,

Go to SE38 & type BCALV & press F4.It will give you all the examples for ALV Report Programming.

Former Member
0 Kudos

Please reward the persons helping you and close the posts as they get answered.

Srinivas

Former Member
0 Kudos

see se38 with 'BALV*', you will lot of examples

Cheers,

Satya