Objects in normal reports

Hi friends,
If i want to create a simple report in alv through objects i have to create a screen and gui status to show the output utilizing the class cl_gui_alv_grid.
Is there any alternative i can avoid creating screen and gui status and show the output in selection screen.
Regards,
Praveen Lobo

Not sure if Bruces example is complete or not, but here is another which I found in my bag of tricks.
report zrich_0001.
* Used to limit user commands on selection-screen
include rsdbc1xx.
data: begin of i_alv occurs 0,
      matnr type mara-matnr,
      maktx type makt-maktx,
      end of i_alv.
data: alv_grid       type ref to cl_gui_alv_grid.
data: fieldcat  type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001 .
select-options: s_matnr for i_alv-matnr.
selection-screen end of block b1.
selection-screen begin of screen 1010.
selection-screen end of screen 1010.
* Events
at selection-screen output.
  if sy-dynnr = '1010'.
    current_scr-mode = 'S'.
    append 'SPOS' to current_scr-excl.
    append 'SCRH' to current_scr-excl.
    append 'ONLI' to current_scr-excl.
  endif.
start-of-selection.
  perform get_data.
  create object alv_grid
         exporting
               i_parent           =  cl_gui_container=>screen0.
*  Populate Field Catalog
  perform get_fieldcatalog.
  call method alv_grid->set_table_for_first_display
      changing
           it_outtab              = i_alv[]
           it_fieldcatalog        = fieldcat[].
  call selection-screen 1010.
* FORM GET_DATA
form get_data.
  select * into corresponding fields of table i_alv
        from mara
          inner join makt
            on mara~matnr = makt~matnr
               where mara~matnr in s_matnr
                 and makt~spras = sy-langu.
  sort i_alv ascending by matnr.
endform.
*      Form  Get_Fieldcatalog - Set Up Columns/Headers
form get_fieldcatalog.
  data: ls_fcat type lvc_s_fcat.
  refresh: fieldcat.
  clear: ls_fcat.
  ls_fcat-reptext    = 'Material Number'.
  ls_fcat-coltext    = 'Material Number'.
  ls_fcat-fieldname  = 'MATNR'.
  ls_fcat-ref_table  = 'I_ALV'.
  ls_fcat-outputlen  = '18'.
  ls_fcat-col_pos    = 1.
  append ls_fcat to fieldcat.
  clear: ls_fcat.
  ls_fcat-reptext    = 'Material Description'.
  ls_fcat-coltext    = 'Material Description'.
  ls_fcat-fieldname  = 'MAKTX'.
  ls_fcat-ref_table  = 'I_ALV'.
  ls_fcat-outputlen  = '40'.
  ls_fcat-col_pos    = 2.
  append ls_fcat to fieldcat.
endform.
Of course, I must recommend that you use the new ALV Object Model as Uwe has suggested.  If you are on a NetWeaver release, then it is available to you.
Regards,
RIch Heilman

Similar Messages

  • Can i use classes or grid control (alv) in normal report

    Hai,
    Can i use Grid control or classes in normal report.If yes what are the steps that i have to go for.
    thanks
    kiran

    Sure... here is a sample of an ALV in a report.  All you need to do is call a screen.  I believe that there is also a way to do it without having to create a screen.
    REPORT ZRICH_0001.
    DATA: BEGIN OF I_ALV OCCURS 0,
          MATNR TYPE MARA-MATNR,
          MAKTX TYPE MAKT-MAKTX,
          END OF I_ALV.
    DATA: ALV_CONTAINER  TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: ALV_GRID       TYPE REF TO CL_GUI_ALV_GRID.
    DATA: LAYOUT    TYPE LVC_S_LAYO.
    DATA: FIELDCAT  TYPE LVC_T_FCAT.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
    SELECT-OPTIONS: S_MATNR FOR i_ALV-MATNR.
    SELECTION-SCREEN END OF BLOCK B1.
    START-OF-SELECTION.
      PERFORM GET_DATA.
      CALL SCREEN 100.
    *      Module  status_0100  OUTPUT
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS '0100'.
      SET TITLEBAR '0100'.
      DATA: VARIANT TYPE  DISVARIANT.
      VARIANT-REPORT = SY-REPID.
      VARIANT-USERNAME = SY-UNAME.
    * Create Controls
      CREATE OBJECT ALV_CONTAINER
             EXPORTING
                   CONTAINER_NAME    = 'ALV_CONTAINER'.
      CREATE OBJECT ALV_GRID
             EXPORTING
                   I_PARENT          =  ALV_CONTAINER.
    *  ALV Specific. Data selection.
    *  Populate Field Catalog
      PERFORM GET_FIELDCATALOG.
      CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
               IS_LAYOUT              = LAYOUT
               IS_VARIANT             = VARIANT
               I_SAVE                 = 'U'
               I_STRUCTURE_NAME       = 'I_ALV'
          CHANGING
               IT_OUTTAB       = I_ALV[]
               IT_FIELDCATALOG = FIELDCAT[].
    ENDMODULE.
    *      Module  USER_COMMAND_0100  INPUT
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK' OR 'CANC'.
          IF NOT ALV_CONTAINER IS INITIAL.
            CALL METHOD ALV_CONTAINER->FREE.
            CLEAR: ALV_CONTAINER.
            FREE : ALV_CONTAINER.
          ENDIF.
          IF SY-SUBRC = 0.
            SET SCREEN 0.
            LEAVE SCREEN.
          ELSE.
            LEAVE PROGRAM.
          ENDIF.
        WHEN 'EXIT'.
          IF NOT ALV_CONTAINER IS INITIAL.
            CALL METHOD ALV_CONTAINER->FREE.
            CLEAR: ALV_CONTAINER.
            FREE : ALV_CONTAINER.
          ENDIF.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.
    * FORM GET_DATA
    FORM GET_DATA.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE I_ALV
            FROM MARA
              INNER JOIN MAKT
                ON MARA~MATNR = MAKT~MATNR
                   WHERE MARA~MATNR IN S_MATNR
                     AND MAKT~SPRAS = SY-LANGU.
      SORT I_ALV ASCENDING BY MATNR.
    ENDFORM.
    *      Form  Get_Fieldcatalog - Set Up Columns/Headers
    FORM GET_FIELDCATALOG.
      DATA: LS_FCAT TYPE LVC_S_FCAT.
      REFRESH: FIELDCAT.
      CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Material Number'.
      LS_FCAT-COLTEXT    = 'Material Number'.
      LS_FCAT-FIELDNAME  = 'MATNR'.
      LS_FCAT-REF_TABLE  = 'I_ALV'.
      LS_FCAT-OUTPUTLEN  = '18'.
      LS_FCAT-COL_POS    = 1.
      APPEND LS_FCAT TO FIELDCAT.
      CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Material Description'.
      LS_FCAT-COLTEXT    = 'Material Description'.
      LS_FCAT-FIELDNAME  = 'MAKTX'.
      LS_FCAT-REF_TABLE  = 'I_ALV'.
      LS_FCAT-OUTPUTLEN  = '40'.
      LS_FCAT-COL_POS    = 2.
      APPEND LS_FCAT TO FIELDCAT.
    ENDFORM.
    Regards,
    Rich Heilman

  • I have a normal report , i need to make it into ALV,

    Hi,
    i have a normal report and i need to make it into ALV Report in ECC5.0version. when i making it into ALV its giving blank.
    can any one help me out to make below code in to ALV report.
    REPORT ZSAMPLE line-size 260
                      line-count 65
                      no standard page heading.
    ====================================================================
    TABLES *********************************
    ====================================================================
    tables : bseg,
             bkpf,
             kna1,
             bsid,
             bsad,
             knb1.
    data : begin of customer_tab occurs 0,
              kunnr         like kna1-kunnr,
              name1         like kna1-name1,
              flag(1)       type c,
           end of customer_tab.
    data : begin of customerdoc_tab occurs 0,
              kunnr         like kna1-kunnr,
              belnr         like bkpf-belnr,
              gjahr         like bkpf-gjahr,
              monat         like bkpf-monat,
           end of customerdoc_tab.
    data : begin of doc_tab occurs 0,
              belnr         like bkpf-belnr,
              gjahr         like bkpf-gjahr,
              monat         like bkpf-monat,
           end of doc_tab.
    DATA: BEGIN OF BSID_TAB OCCURS 0,
             BUKRS LIKE BSID-BUKRS,
             PRCTR LIKE BSID-PRCTR,
             KUNNR LIKE BSID-KUNNR,
             FLAG(1),
             UMSKZ LIKE BSID-UMSKZ,
             BLART LIKE BSID-BLART,
             BELNR LIKE BSID-BELNR,
             BUZEI LIKE BSID-BUZEI,
             NETDT LIKE BSID-ZFBDT,
             ZFBDT LIKE BSID-ZFBDT,
             BUDAT LIKE BSID-BUDAT,
             BLDAT LIKE BSID-BLDAT,
             BSCHL LIKE BSID-BSCHL,
             DMBTR LIKE BSID-DMBTR,
             SHKZG LIKE BSID-SHKZG,
             ZBD1T LIKE BSID-ZBD1T,
             ZBD2T LIKE BSID-ZBD2T,
             ZBD3T LIKE BSID-ZBD3T,
             REBZG LIKE BSID-REBZG,
             REBZT LIKE BSID-REBZT,
             KOART LIKE BSEG-KOART,
             SK1DT LIKE FAEDE-SK1DT,
             SK2DT LIKE FAEDE-SK2DT,
             DAYSD LIKE SY-TABIX,
          END OF BSID_TAB.
    ranges : r_bukrs for bsid-bukrs,
             r_kunnr for kna1-kunnr.
    ===================================================================
    VARIABLES *******************************
    ===================================================================
    data : v_belnr     like  bseg-belnr,
           v_gjahr     like  bkpf-gjahr,
           v_monat     like  bkpf-monat,
           v_ttlc      type  p,
           v_flag(1)   type  c,
           V_COUNT1(4) TYPE  N,
           V_COUNT2(4) TYPE  N,
           V_COUNT3(4) TYPE  N,
           V_COUNT4(4) TYPE  N,
           V_COUNT5(4) TYPE  N,
           V_COUNT6(4) TYPE  N,
           V_COUNT7(4) TYPE  N,
           V_COUNT8(4) TYPE  N,
           V_COUNT9(4) TYPE  N,
           V_COUNT10(4) TYPE  N,
           V_NET1      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 1
           V_NET2      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 2
           V_NET3      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 3
           V_NET4      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 4
           V_NET5      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 5
           V_NET6      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 6
           V_NET7      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 7
           V_NET8      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 8
           V_NET9      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 9
           V_NET10      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 10
           V_NET11      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 11
           V_NET       LIKE  BSID-DMBTR, "Total Balance of Customer
           V_ttlNET1   LIKE  BSID-DMBTR,
           V_ttlNET2   LIKE  BSID-DMBTR,
           V_ttlNET3   LIKE  BSID-DMBTR,
           V_ttlNET4   LIKE  BSID-DMBTR,
           V_ttlNET5   LIKE  BSID-DMBTR,
           V_ttlNET6   LIKE  BSID-DMBTR,
           V_ttlNET7   LIKE  BSID-DMBTR,
           V_ttlNET8   LIKE  BSID-DMBTR,
           V_ttlNET9   LIKE  BSID-DMBTR,
           V_ttlNET10   LIKE  BSID-DMBTR,
           V_ttlNET11   LIKE  BSID-DMBTR,
           V_ttlNET    LIKE  BSID-DMBTR,
           v_kunnr     like  bseg-kunnr,
           V_BUTXT     like t001-butxt.
    ===================================================================
    SELECTION SCREEN ****************************
    ===================================================================
    selection-screen begin of block b1 with frame title text-001.
    parameters :     p_bukrs    like bseg-bukrs obligatory.
    select-options : s_kunnr    for  kna1-kunnr,
                     s_BRSCH    for  kna1-BRSCH,
                     s_REGIO    for  kna1-REGIO,
                     s_KTOKD    for  kna1-KTOKD,
                     s_BUSAB    for  knb1-BUSAB.
    selection-screen: end of block b1.
    selection-screen begin of block b2 with frame title text-003.
    PARAMETERS: DAT LIKE SY-DATUM DEFAULT SY-DATUM.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 01(30) TEXT-002.
    SELECTION-SCREEN POSITION POS_LOW.
    *PARAMETERS: RASTBIS1 LIKE RFPDO1-ALLGROGR DEFAULT '000'.
    *PARAMETERS: RASTBIS2 LIKE RFPDO1-ALLGROGR DEFAULT '030'.
    *PARAMETERS: RASTBIS3 LIKE RFPDO1-ALLGROGR DEFAULT '060'.
    *PARAMETERS: RASTBIS4 LIKE RFPDO1-ALLGROGR DEFAULT '090'.
    *PARAMETERS: RASTBIS5 LIKE RFPDO1-ALLGROGR DEFAULT '120'.
    PARAMETERS: RASTBIS1(4) type n DEFAULT '0000'.
    PARAMETERS: RASTBIS2(4) type n DEFAULT '0030'.
    PARAMETERS: RASTBIS3(4) type n DEFAULT '0060'.
    PARAMETERS: RASTBIS4(4) type n DEFAULT '0090'.
    PARAMETERS: RASTBIS5(4) type n DEFAULT '0120'.
    PARAMETERS: RASTBIS6(4) type n DEFAULT '0150'.
    PARAMETERS: RASTBIS7(4) type n DEFAULT '0180'.
    PARAMETERS: RASTBIS8(4) type n DEFAULT '0210'.
    PARAMETERS: RASTBIS9(4) type n DEFAULT '0240'.
    PARAMETERS: RASTBIS0(4) type n DEFAULT '0270'.
    SELECTION-SCREEN END OF LINE.
    Noted item removed as per FI instruction
    PARAMETERS: P_STAND AS CHECKBOX default 'X',
               P_NOTED AS CHECKBOX ,
                P_SPCAL AS CHECKBOX .
    selection-screen: end of block b2.
    selection-screen begin of block b3 with frame.
    PARAMETERS: allgline like RFPDO1-allgline .
    Parameters : p_balyes type c radiobutton group grp9 default 'X',
                 p_balno  type c radiobutton group grp9.
    selection-screen: end of block b3.
    Check for the Select option
    AT SELECTION-SCREEN.
    IF P_STAND = '' AND P_SPCAL = '' .
      MESSAGE E398(00) WITH 'PLEASE CHOOSE AT LEAST ONE G/L INDICATOR!'.
    ENDIF.
    Check for Company code Authorization
      authority-check object 'F_BKPF_BUK'
         ID 'BUKRS' FIELD p_bukrs
         ID 'ACTVT' FIELD '03'.
      if sy-subrc ne 0.
       message e398(00) with 'You are not Authorized for CC ' p_bukrs.
      Endif.
    ===================================================================
    START-OF-SELECTION ****************************
    ===================================================================
    START-OF-SELECTION.
    V_COUNT1 = RASTBIS1 + 1.
    V_COUNT2 = RASTBIS2 + 1.
    V_COUNT3 = RASTBIS3 + 1.
    V_COUNT4 = RASTBIS4 + 1.
    V_COUNT5 = RASTBIS5 + 1.
    V_COUNT6 = RASTBIS6 + 1.
    V_COUNT7 = RASTBIS7 + 1.
    V_COUNT8 = RASTBIS8 + 1.
    V_COUNT9 = RASTBIS9 + 1.
    V_COUNT10 = RASTBIS0 + 1.
    perform extract_data.
    ===================================================================
    At line Selection *****************************
    ===================================================================
    at line-selection.
    if sy-lilli >= 9 .
       refresh r_bukrs.
       move p_bukrs to r_bukrs-low.
       move 'I' to r_bukrs-sign.
       move 'EQ' to r_bukrs-option.
       append r_bukrs.
       refresh r_kunnr.
       move customer_tab-kunnr to r_kunnr-low.
       move 'I' to r_kunnr-sign.
       move 'EQ' to r_kunnr-option.
       append r_kunnr.
       submit ZFARVR0040  and return
        with p_bukrs = p_bukrs
        with dat     = dat
        with p_stand = p_stand
        with p_spcal = P_SPCAL
        with s_kunnr in r_kunnr.
    endif.
    ===================================================================
    Top of Page *******************************
    ===================================================================
    TOP-OF-PAGE.
      SELECT SINGLE BUTXT FROM T001 INTO V_BUTXT
                          WHERE BUKRS = p_BUKRS .
      WRITE:/73'Customers Aging Analysis',140'PAGE NO.',
      SY-PAGNO.
      WRITE:/002 'COMPANY',
             011 P_BUKRS,
             017 V_BUTXT,
             055 allgline centered,
             140 'DATE :',
             150 sy-datum .
      write:/002 'User',
             011 sy-UNAME,
             140 'Time :',
             150 sy-UZEIT.
      SKIP.
      format color col_heading intensified off.
      WRITE:/  SY-ULINE,
                  SY-VLINE,002 'Customer',
              012 SY-VLINE,013 'Name',
              043 SY-VLINE,048 'CURRENT',
              061 SY-VLINE,065 'FROM  ',V_COUNT1,
              079 SY-VLINE,083 'FROM  ',V_COUNT2,
              097 SY-VLINE,101 'FROM  ',V_COUNT3,
              115 SY-VLINE,119 'FROM  ',V_COUNT4,
              133 SY-VLINE,137 'FROM  ',V_COUNT5,
              151 SY-VLINE,155 'FROM  ',V_COUNT6,
              169 SY-VLINE,173 'FROM  ',V_COUNT7,
              187 SY-VLINE,191 'FROM  ',V_COUNT8,
              205 SY-VLINE,209 'FROM  ',V_COUNT9,
              223 SY-VLINE,228 'FROM  ',V_COUNT10,
              243 SY-VLINE,248 'TOTAL',
              268 SY-VLINE.
      WRITE:/      SY-VLINE,002 'Number',
               12  SY-VLINE,
               43  SY-VLINE,
               061 SY-VLINE,065 'TO    ',RASTBIS2,
               079 SY-VLINE,083 'TO    ',RASTBIS3,
               097 SY-VLINE,101 'TO    ',RASTBIS4,
               115 SY-VLINE,119 'TO    ',RASTBIS5,
               133 SY-VLINE,137 'FROM  ',RASTBIS6,
               151 SY-VLINE,155 'FROM  ',RASTBIS7,
               169 SY-VLINE,173 'FROM  ',RASTBIS8,
               187 SY-VLINE,191 'FROM  ',RASTBIS9,
               205 SY-VLINE,209 'FROM  ',RASTBIS0,
               223 SY-VLINE,
               243 SY-VLINE,
               268 SY-VLINE,
               SY-ULINE.
      format color off.
    ===================================================================
    END-OF-SELECTION ***************************
    ===================================================================
    end-of-selection.
    ===================================================================
    Form : Extract_Data *
    ===================================================================
    form extract_data.
    Select the Customers
       Select t1~kunnr t2~name1
         into corresponding fields of table  customer_tab
         from knb1 as t1 inner join kna1 as t2
              on t2~kunnr = t1~kunnr
                   where t1~bukrs = p_bukrs
                     and t1~kunnr in s_kunnr
                     and t1~BUSAB in s_busab
                     and t2~regio in s_regio
                     and t2~BRSCH in s_BRSCH
                     and t2~KTOKD in s_KTOKD.
       if sy-subrc <> 0.
          message e398(00) with 'No Customers Selected'.
       endif.
       sort customer_tab.
       describe table customer_tab lines v_ttlc.
       v_ttlc = v_ttlc + 10.
       loop at customer_tab.
          v_net1 = 0.
          v_net2 = 0.
          v_net3 = 0.
          v_net4 = 0.
          v_net5 = 0.
          v_net6 = 0.
          v_net7 = 0.
          v_net8 = 0.
          v_net9 = 0.
          v_net10 = 0.
          v_net11 = 0.
          v_net  = 0.
          perform calculate_ageing
                    using
                      p_bukrs
                      customer_tab-kunnr
                      dat
                      RASTBIS1
                      RASTBIS2
                      RASTBIS3
                      RASTBIS4
                      RASTBIS5
                      RASTBIS6
                      RASTBIS7
                      RASTBIS8
                      RASTBIS9
                      RASTBIS0
                      P_STAND
                      ' ' "noted item
                      P_SPCAL
                   changing
                      v_net1
                      v_net2
                      v_net3
                      v_net4
                      v_net5
                      v_net6
                      v_net7
                      v_net8
                      v_net9
                      v_net10
                      v_net11
                      v_net.
          if p_balyes = 'X' or v_net > 0.
            format color col_total.
            write:/  sy-vline,
                    002 customer_tab-kunnr,
                    012 SY-VLINE,013(30) customer_tab-name1,
                    043 SY-VLINE,044(16)  v_net1,
                    061 SY-VLINE,062(16)  v_net2,
                    079 SY-VLINE,080(16)  v_net3,
                    097 SY-VLINE,098(16)  v_net4,
                    115 SY-VLINE,116(16)  v_net5,
                    133 SY-VLINE,134(16)  v_net6,
                    151 SY-VLINE,152(16)  v_net7,
                    169 SY-VLINE,170(16)  v_net8,
                    187 SY-VLINE,188(16)  v_net9,
                    205 SY-VLINE,206(16)  v_net10,
                    223 SY-VLINE,224(16)  v_net11,
                    239 SY-VLINE,240(16)  v_net,
                    258 SY-VLINE.
             format color off.
             hide : customer_tab-kunnr.
             v_ttlnet1 = v_ttlnet1 + v_net1.
             v_ttlnet2 = v_ttlnet2 + v_net2.
             v_ttlnet3 = v_ttlnet3 + v_net3.
             v_ttlnet4 = v_ttlnet4 + v_net4.
             v_ttlnet5 = v_ttlnet5 + v_net5.
             v_ttlnet6 = v_ttlnet6 + v_net6.
             v_ttlnet7 = v_ttlnet7 + v_net7.
             v_ttlnet8 = v_ttlnet8 + v_net8.
             v_ttlnet9 = v_ttlnet9 + v_net9.
             v_ttlnet10 = v_ttlnet10 + v_net10.
             v_ttlnet11 = v_ttlnet11 + v_net11.
             v_ttlnet  = v_ttlnet  + v_net.
          endif.
       endloop.
       ULINE.
           format color col_total.
           write:/  sy-vline,
                    012 SY-VLINE,012(30) ' T O T A L',
                    043 SY-VLINE,044(16)  v_ttlnet1,
                    061 SY-VLINE,062(16)  v_ttlnet2,
                    079 SY-VLINE,080(16)  v_ttlnet3,
                    097 SY-VLINE,098(16)  v_ttlnet4,
                    115 SY-VLINE,116(16)  v_ttlnet5,
                    133 SY-VLINE,134(16)  v_ttlnet6,
                    151 SY-VLINE,152(16)  v_ttlnet7,
                    169 SY-VLINE,170(16)  v_ttlnet8,
                    187 SY-VLINE,188(16)  v_ttlnet9,
                    205 SY-VLINE,206(16)  v_ttlnet10,
                    223 SY-VLINE,224(16)  v_ttlnet11,
                    239 SY-VLINE,240(16)  v_ttlnet,
                    258 SY-VLINE.
          format color off.
       ULINE.
    endform.
    Function to Calculate Aging.
    Form calculate_ageing using
                            bukrs
                            kunnr
                            dat
                            RASTBIS1
                            RASTBIS2
                            RASTBIS3
                            RASTBIS4
                            RASTBIS5
                            RASTBIS6
                            RASTBIS7
                            RASTBIS8
                            RASTBIS9
                            RASTBIS0
                            P_STAND
                            P_NOTED
                            P_SPCAL
                          changing
                            v_net1
                            v_net2
                            v_net3
                            v_net4
                            v_net5
                            v_net6
                            v_net7
                            v_net8
                            v_net9
                            v_net10
                            v_net11
                            v_net.
    DATA: BEGIN OF BSID_TAB1 OCCURS 0,
             BUKRS LIKE BSID-BUKRS,
             PRCTR LIKE BSID-PRCTR,
             KUNNR LIKE BSID-KUNNR,
             FLAG(1),
             UMSKZ LIKE BSID-UMSKZ,
             BLART LIKE BSID-BLART,
             BELNR LIKE BSID-BELNR,
             BUZEI LIKE BSID-BUZEI,
             NETDT LIKE BSID-ZFBDT,
             ZFBDT LIKE BSID-ZFBDT,
             BUDAT LIKE BSID-BUDAT,
             BLDAT LIKE BSID-BLDAT,
             BSCHL LIKE BSID-BSCHL,
             DMBTR LIKE BSID-DMBTR,
             SHKZG LIKE BSID-SHKZG,
             ZBD1T LIKE BSID-ZBD1T,
             ZBD2T LIKE BSID-ZBD2T,
             ZBD3T LIKE BSID-ZBD3T,
             REBZG LIKE BSID-REBZG,
             REBZT LIKE BSID-REBZT,
             KOART LIKE BSEG-KOART,
             SK1DT LIKE FAEDE-SK1DT,
             SK2DT LIKE FAEDE-SK2DT,
             DAYSD LIKE SY-TABIX,
          END OF BSID_TAB1.
    RANGES: R_UMSKZ FOR BSID-UMSKZ.
    Data : V_ZFBDT     Like  bsid-ZFBDT,
           V_ZBD1T     Like  bsid-ZBD1T,
           V_ZBD2T     Like  bsid-ZBD2T,
           V_ZBD3T     Like  bsid-ZBD3T,
           V_LINES(8)  TYPE n.
    IF P_NOTED = 'X'.     "CHECK NOTED ITEMS
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'D'.
      APPEND R_UMSKZ.
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'L'.
      APPEND R_UMSKZ.
    ENDIF.
    IF P_STAND = 'X'.    "CHECK STANDARD ITEMS
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = ' '.
      APPEND R_UMSKZ.
    ENDIF.
    IF P_SPCAL = 'X'.    "CHECK SPECIAL G/L TRANSACTION
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'A'.
      APPEND R_UMSKZ.
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'B'.
      APPEND R_UMSKZ.
    ENDIF.
    SELECT * FROM BSID INTO CORRESPONDING FIELDS OF TABLE BSID_TAB
               WHERE BUKRS = BUKRS AND
                     budat <= dat  AND
                     KUNNR = KUNNR AND
                     UMSKZ in R_UMSKZ.
    SELECT * FROM BSAD appending CORRESPONDING FIELDS OF TABLE BSID_TAB
               WHERE BUKRS = BUKRS AND
                     budat <= dat  AND
                     augdt >= dat  AND
                     KUNNR = KUNNR AND
                     UMSKZ in R_UMSKZ.
    DESCRIBE TABLE BSID_TAB LINES V_LINES.
    LOOP AT BSID_TAB.
        if bsid_tab-BLART = 'DZ'.
          Select single ZFBDT ZBD1T ZBD2T ZBD3T
            into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
            from bsid where BUKRS = BUKRS
                        and kunnr = bsid_tab-kunnr
                        and BELNR = bsid_tab-REBZG.
          if sy-subrc = 0.
             bsid_tab-ZFBDT = V_ZFBDT.
             bsid_tab-ZBD1T = V_ZBD1T.
             bsid_tab-ZBD2T = V_ZBD2T.
             bsid_tab-ZBD3T = V_ZBD3T.
          else.
             Select single ZFBDT ZBD1T ZBD2T ZBD3T
               into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
               from bsad where BUKRS = BUKRS
                           and kunnr = bsid_tab-kunnr
                           and BELNR = bsid_tab-REBZG.
             if sy-subrc <> 0.
               bsid_tab-ZFBDT = V_ZFBDT.
               bsid_tab-ZBD1T = V_ZBD1T.
               bsid_tab-ZBD2T = V_ZBD2T.
               bsid_tab-ZBD3T = V_ZBD3T.
             endif.
          endif.
        endif.
        IF BSID_TAB-SHKZG = 'H'.
          BSID_TAB-DMBTR = BSID_TAB-DMBTR * ( - 1 ).
        ENDIF.
        bsid_tab-netdt = bsid_tab-ZFBDT.
      bsid_tab-netdt = bsid_tab-budat.
        bsid_tab-koart = 'D'.
        MODIFY BSID_TAB.
       PERFORM CALC_DUE_DATE USING BSID_TAB.
        BSID_TAB-DAYSD = DAT - BSID_TAB-NETDT.
        IF BSID_TAB-DAYSD <= RASTBIS1.
          V_NET1 = V_NET1 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS2.
          V_NET2 = V_NET2 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS3.
          V_NET3 = V_NET3 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS4.
          V_NET4 = V_NET4 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
          V_NET5 = V_NET5 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS6.
          V_NET6 = V_NET6 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS7.
          V_NET7 = V_NET7 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
          V_NET8 = V_NET8 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS9.
          V_NET9 = V_NET9 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <=  RASTBIS0.
          V_NET10 = V_NET10 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD >  RASTBIS0.
          V_NET11 = V_NET11 + BSID_TAB-DMBTR.
        ENDIF.
        V_NET = V_NET + BSID_TAB-DMBTR.
        MODIFY BSID_TAB.
    ENDLOOP.
    endform.
    Calculate Due Date
    FORM CALC_DUE_DATE USING P_BSID_TAB STRUCTURE BSID_TAB.
      DATA : REFE TYPE P.
    IF P_BSID_TAB-KOART = 'K' OR P_BSID_TAB-KOART = 'D'.
      IF P_BSID_TAB-ZFBDT IS INITIAL.
        P_BSID_TAB-ZFBDT = P_BSID_TAB-BLDAT.
      ENDIF.
    *Nettofälligkeit bestimmen--
      IF NOT P_BSID_TAB-ZBD3T IS INITIAL.
        REFE = P_BSID_TAB-ZBD3T.
      ELSE.
        IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
          REFE = P_BSID_TAB-ZBD2T.
        ELSE.
          REFE = P_BSID_TAB-ZBD1T.
        ENDIF.
      ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
      IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
      OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
        IF P_BSID_TAB-REBZG IS INITIAL.
          REFE = 0.
        ENDIF.
      ENDIF.
      P_BSID_TAB-NETDT = P_BSID_TAB-ZFBDT + REFE.
    *Skontofälligkeiten bestimmen--
      IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
        P_BSID_TAB-SK2DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD2T.
      ELSE.
        P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
      ENDIF.
      IF NOT P_BSID_TAB-ZBD1T IS INITIAL
      OR NOT P_BSID_TAB-ZBD2T IS INITIAL.
        P_BSID_TAB-SK1DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD1T.
      ELSE.
        P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
      ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
      IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
      OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
        IF P_BSID_TAB-REBZG IS INITIAL.
          P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
          P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
        ENDIF.
      ENDIF.
    ELSE.
       MESSAGE E122 RAISING ACCOUNT_TYPE_NOT_SUPPORTED.
    ENDIF.
    E_FAEDE = FAEDE.
    ENDFORM.

    Hi,
    As vijay said...
    1.Declare One final Internal table which you want to show the data
    2 . populate the fieldcatalog using the FM or Manually using the itab in step1
    3. Collect the Data into final internal table which you created in Step 1.
    4. pass the fieldcat and Internal table to ALV FM.
    chk out the prg below i have created your program but i donn knw wht are the output fields... chk your prg
    *REPORT ZALVTEST .
    REPORT ZSAMPLE line-size 260
    line-count 65
    no standard page heading.
    TYPE-POOLS: SLIS.
    ====================================================================
    TABLES *********************************
    ====================================================================
    tables : bseg,
    bkpf,
    kna1,
    bsid,
    bsad,
    knb1.
    data : begin of customer_tab occurs 0,
    kunnr like kna1-kunnr,
    name1 like kna1-name1,
    flag(1) type c,
    end of customer_tab.
    data : begin of customerdoc_tab occurs 0,
    kunnr like kna1-kunnr,
    belnr like bkpf-belnr,
    gjahr like bkpf-gjahr,
    monat like bkpf-monat,
    end of customerdoc_tab.
    data : begin of doc_tab occurs 0,
    belnr like bkpf-belnr,
    gjahr like bkpf-gjahr,
    monat like bkpf-monat,
    end of doc_tab.
    DATA: BEGIN OF BSID_TAB OCCURS 0,
    BUKRS LIKE BSID-BUKRS,
    PRCTR LIKE BSID-PRCTR,
    KUNNR LIKE BSID-KUNNR,
    FLAG(1),
    UMSKZ LIKE BSID-UMSKZ,
    BLART LIKE BSID-BLART,
    BELNR LIKE BSID-BELNR,
    BUZEI LIKE BSID-BUZEI,
    NETDT LIKE BSID-ZFBDT,
    ZFBDT LIKE BSID-ZFBDT,
    BUDAT LIKE BSID-BUDAT,
    BLDAT LIKE BSID-BLDAT,
    BSCHL LIKE BSID-BSCHL,
    DMBTR LIKE BSID-DMBTR,
    SHKZG LIKE BSID-SHKZG,
    ZBD1T LIKE BSID-ZBD1T,
    ZBD2T LIKE BSID-ZBD2T,
    ZBD3T LIKE BSID-ZBD3T,
    REBZG LIKE BSID-REBZG,
    REBZT LIKE BSID-REBZT,
    KOART LIKE BSEG-KOART,
    SK1DT LIKE FAEDE-SK1DT,
    SK2DT LIKE FAEDE-SK2DT,
    DAYSD LIKE SY-TABIX,
    END OF BSID_TAB.
    ranges : r_bukrs for bsid-bukrs,
    r_kunnr for kna1-kunnr.
    ===================================================================
    VARIABLES *******************************
    ===================================================================
    data : v_belnr like bseg-belnr,
    v_gjahr like bkpf-gjahr,
    v_monat like bkpf-monat,
    v_ttlc type p,
    v_flag(1) type c,
    V_COUNT1(4) TYPE N,
    V_COUNT2(4) TYPE N,
    V_COUNT3(4) TYPE N,
    V_COUNT4(4) TYPE N,
    V_COUNT5(4) TYPE N,
    V_COUNT6(4) TYPE N,
    V_COUNT7(4) TYPE N,
    V_COUNT8(4) TYPE N,
    V_COUNT9(4) TYPE N,
    V_COUNT10(4) TYPE N,
    V_NET1 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 1
    V_NET2 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 2
    V_NET3 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 3
    V_NET4 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 4
    V_NET5 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 5
    V_NET6 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 6
    V_NET7 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 7
    V_NET8 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 8
    V_NET9 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 9
    V_NET10 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 10
    V_NET11 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 11
    V_NET LIKE BSID-DMBTR, "Total Balance of Customer
    V_ttlNET1 LIKE BSID-DMBTR,
    V_ttlNET2 LIKE BSID-DMBTR,
    V_ttlNET3 LIKE BSID-DMBTR,
    V_ttlNET4 LIKE BSID-DMBTR,
    V_ttlNET5 LIKE BSID-DMBTR,
    V_ttlNET6 LIKE BSID-DMBTR,
    V_ttlNET7 LIKE BSID-DMBTR,
    V_ttlNET8 LIKE BSID-DMBTR,
    V_ttlNET9 LIKE BSID-DMBTR,
    V_ttlNET10 LIKE BSID-DMBTR,
    V_ttlNET11 LIKE BSID-DMBTR,
    V_ttlNET LIKE BSID-DMBTR,
    v_kunnr like bseg-kunnr,
    V_BUTXT like t001-butxt.
    ********Declare Data Areas for List Viewer ***********
    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          FIELDCAT_LN LIKE LINE OF FIELDCAT,
          FIELD TYPE SLIS_FIELDNAME,
          COL_POS TYPE I ,
          PGM LIKE SY-REPID,
          FIELD_VALUE(20),
          TABLE_NAME(10).
    ===================================================================
    SELECTION SCREEN ****************************
    ===================================================================
    selection-screen begin of block b1 with frame title text-001.
    parameters : p_bukrs like bseg-bukrs obligatory.
    select-options : s_kunnr for kna1-kunnr,
    s_BRSCH for kna1-BRSCH,
    s_REGIO for kna1-REGIO,
    s_KTOKD for kna1-KTOKD,
    s_BUSAB for knb1-BUSAB.
    selection-screen: end of block b1.
    selection-screen begin of block b2 with frame title text-003.
    PARAMETERS: DAT LIKE SY-DATUM DEFAULT SY-DATUM.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 01(30) TEXT-002.
    SELECTION-SCREEN POSITION POS_LOW.
    *PARAMETERS: RASTBIS1 LIKE RFPDO1-ALLGROGR DEFAULT '000'.
    *PARAMETERS: RASTBIS2 LIKE RFPDO1-ALLGROGR DEFAULT '030'.
    *PARAMETERS: RASTBIS3 LIKE RFPDO1-ALLGROGR DEFAULT '060'.
    *PARAMETERS: RASTBIS4 LIKE RFPDO1-ALLGROGR DEFAULT '090'.
    *PARAMETERS: RASTBIS5 LIKE RFPDO1-ALLGROGR DEFAULT '120'.
    PARAMETERS: RASTBIS1(4) type n DEFAULT '0000'.
    PARAMETERS: RASTBIS2(4) type n DEFAULT '0030'.
    PARAMETERS: RASTBIS3(4) type n DEFAULT '0060'.
    PARAMETERS: RASTBIS4(4) type n DEFAULT '0090'.
    PARAMETERS: RASTBIS5(4) type n DEFAULT '0120'.
    PARAMETERS: RASTBIS6(4) type n DEFAULT '0150'.
    PARAMETERS: RASTBIS7(4) type n DEFAULT '0180'.
    PARAMETERS: RASTBIS8(4) type n DEFAULT '0210'.
    PARAMETERS: RASTBIS9(4) type n DEFAULT '0240'.
    PARAMETERS: RASTBIS0(4) type n DEFAULT '0270'.
    SELECTION-SCREEN END OF LINE.
    Noted item removed as per FI instruction
    PARAMETERS: P_STAND AS CHECKBOX default 'X',
    P_NOTED AS CHECKBOX ,
    P_SPCAL AS CHECKBOX .
    selection-screen: end of block b2.
    selection-screen begin of block b3 with frame.
    PARAMETERS: allgline like RFPDO1-allgline .
    Parameters : p_balyes type c radiobutton group grp9 default 'X',
    p_balno type c radiobutton group grp9.
    selection-screen: end of block b3.
    Check for the Select option
    AT SELECTION-SCREEN.
    IF P_STAND = '' AND P_SPCAL = '' .
    MESSAGE E398(00) WITH 'PLEASE CHOOSE AT LEAST ONE G/L INDICATOR!'.
    ENDIF.
    Check for Company code Authorization
    authority-check object 'F_BKPF_BUK'
    ID 'BUKRS' FIELD p_bukrs
    ID 'ACTVT' FIELD '03'.
    if sy-subrc ne 0.
    message e398(00) with 'You are not Authorized for CC ' p_bukrs.
    Endif.
    ===================================================================
    START-OF-SELECTION ****************************
    ===================================================================
    START-OF-SELECTION.
    V_COUNT1 = RASTBIS1 + 1.
    V_COUNT2 = RASTBIS2 + 1.
    V_COUNT3 = RASTBIS3 + 1.
    V_COUNT4 = RASTBIS4 + 1.
    V_COUNT5 = RASTBIS5 + 1.
    V_COUNT6 = RASTBIS6 + 1.
    V_COUNT7 = RASTBIS7 + 1.
    V_COUNT8 = RASTBIS8 + 1.
    V_COUNT9 = RASTBIS9 + 1.
    V_COUNT10 = RASTBIS0 + 1.
    perform extract_data.
    Build Field Catalogs **************************
      PERFORM BUILD_FIELDCAT.
    *******Start List Viewer *******************************
      PERFORM START_LIST_VIEWER.
    ===================================================================
    At line Selection *****************************
    ===================================================================
    at line-selection.
    if sy-lilli >= 9 .
    refresh r_bukrs.
    move p_bukrs to r_bukrs-low.
    move 'I' to r_bukrs-sign.
    move 'EQ' to r_bukrs-option.
    append r_bukrs.
    refresh r_kunnr.
    move customer_tab-kunnr to r_kunnr-low.
    move 'I' to r_kunnr-sign.
    move 'EQ' to r_kunnr-option.
    append r_kunnr.
    submit ZFARVR0040 and return
    with p_bukrs = p_bukrs
    with dat = dat
    with p_stand = p_stand
    with p_spcal = P_SPCAL
    with s_kunnr in r_kunnr.
    endif.
    ===================================================================
    Top of Page *******************************
    ===================================================================
    TOP-OF-PAGE.
    SELECT SINGLE BUTXT FROM T001 INTO V_BUTXT
    WHERE BUKRS = p_BUKRS .
    WRITE:/73'Customers Aging Analysis',140'PAGE NO.',
    SY-PAGNO.
    WRITE:/002 'COMPANY',
    011 P_BUKRS,
    017 V_BUTXT,
    055 allgline centered,
    140 'DATE :',
    150 sy-datum .
    write:/002 'User',
    011 sy-UNAME,
    140 'Time :',
    150 sy-UZEIT.
    SKIP.
    format color col_heading intensified off.
    WRITE:/ SY-ULINE,
    SY-VLINE,002 'Customer',
    012 SY-VLINE,013 'Name',
    043 SY-VLINE,048 'CURRENT',
    061 SY-VLINE,065 'FROM ',V_COUNT1,
    079 SY-VLINE,083 'FROM ',V_COUNT2,
    097 SY-VLINE,101 'FROM ',V_COUNT3,
    115 SY-VLINE,119 'FROM ',V_COUNT4,
    133 SY-VLINE,137 'FROM ',V_COUNT5,
    151 SY-VLINE,155 'FROM ',V_COUNT6,
    169 SY-VLINE,173 'FROM ',V_COUNT7,
    187 SY-VLINE,191 'FROM ',V_COUNT8,
    205 SY-VLINE,209 'FROM ',V_COUNT9,
    223 SY-VLINE,228 'FROM ',V_COUNT10,
    243 SY-VLINE,248 'TOTAL',
    268 SY-VLINE.
    WRITE:/ SY-VLINE,002 'Number',
    12 SY-VLINE,
    43 SY-VLINE,
    061 SY-VLINE,065 'TO ',RASTBIS2,
    079 SY-VLINE,083 'TO ',RASTBIS3,
    097 SY-VLINE,101 'TO ',RASTBIS4,
    115 SY-VLINE,119 'TO ',RASTBIS5,
    133 SY-VLINE,137 'FROM ',RASTBIS6,
    151 SY-VLINE,155 'FROM ',RASTBIS7,
    169 SY-VLINE,173 'FROM ',RASTBIS8,
    187 SY-VLINE,191 'FROM ',RASTBIS9,
    205 SY-VLINE,209 'FROM ',RASTBIS0,
    223 SY-VLINE,
    243 SY-VLINE,
    268 SY-VLINE,
    SY-ULINE.
    format color off.
    ===================================================================
    END-OF-SELECTION ***************************
    ===================================================================
    end-of-selection.
    ===================================================================
    Form : Extract_Data *
    ===================================================================
    form extract_data.
    Select the Customers
    Select t1~kunnr t2~name1
    into corresponding fields of table customer_tab
    from knb1 as t1 inner join kna1 as t2
    on t2~kunnr = t1~kunnr
    where t1~bukrs = p_bukrs
    and t1~kunnr in s_kunnr
    and t1~BUSAB in s_busab
    and t2~regio in s_regio
    and t2~BRSCH in s_BRSCH
    and t2~KTOKD in s_KTOKD.
    if sy-subrc <> 0.
    message e398(00) with 'No Customers Selected'.
    endif.
    sort customer_tab.
    describe table customer_tab lines v_ttlc.
    v_ttlc = v_ttlc + 10.
    loop at customer_tab.
    v_net1 = 0.
    v_net2 = 0.
    v_net3 = 0.
    v_net4 = 0.
    v_net5 = 0.
    v_net6 = 0.
    v_net7 = 0.
    v_net8 = 0.
    v_net9 = 0.
    v_net10 = 0.
    v_net11 = 0.
    v_net = 0.
    perform calculate_ageing
    using
    p_bukrs
    customer_tab-kunnr
    dat
    RASTBIS1
    RASTBIS2
    RASTBIS3
    RASTBIS4
    RASTBIS5
    RASTBIS6
    RASTBIS7
    RASTBIS8
    RASTBIS9
    RASTBIS0
    P_STAND
    ' ' "noted item
    P_SPCAL
    changing
    v_net1
    v_net2
    v_net3
    v_net4
    v_net5
    v_net6
    v_net7
    v_net8
    v_net9
    v_net10
    v_net11
    v_net.
    if p_balyes = 'X' or v_net > 0.
    format color col_total.
    write:/ sy-vline,
    002 customer_tab-kunnr,
    012 SY-VLINE,013(30) customer_tab-name1,
    043 SY-VLINE,044(16) v_net1,
    061 SY-VLINE,062(16) v_net2,
    079 SY-VLINE,080(16) v_net3,
    097 SY-VLINE,098(16) v_net4,
    115 SY-VLINE,116(16) v_net5,
    133 SY-VLINE,134(16) v_net6,
    151 SY-VLINE,152(16) v_net7,
    169 SY-VLINE,170(16) v_net8,
    187 SY-VLINE,188(16) v_net9,
    205 SY-VLINE,206(16) v_net10,
    223 SY-VLINE,224(16) v_net11,
    239 SY-VLINE,240(16) v_net,
    258 SY-VLINE.
    format color off.
    hide : customer_tab-kunnr.
    v_ttlnet1 = v_ttlnet1 + v_net1.
    v_ttlnet2 = v_ttlnet2 + v_net2.
    v_ttlnet3 = v_ttlnet3 + v_net3.
    v_ttlnet4 = v_ttlnet4 + v_net4.
    v_ttlnet5 = v_ttlnet5 + v_net5.
    v_ttlnet6 = v_ttlnet6 + v_net6.
    v_ttlnet7 = v_ttlnet7 + v_net7.
    v_ttlnet8 = v_ttlnet8 + v_net8.
    v_ttlnet9 = v_ttlnet9 + v_net9.
    v_ttlnet10 = v_ttlnet10 + v_net10.
    v_ttlnet11 = v_ttlnet11 + v_net11.
    v_ttlnet = v_ttlnet + v_net.
    endif.
    endloop.
    ULINE.
    format color col_total.
    write:/ sy-vline,
    012 SY-VLINE,012(30) ' T O T A L',
    043 SY-VLINE,044(16) v_ttlnet1,
    061 SY-VLINE,062(16) v_ttlnet2,
    079 SY-VLINE,080(16) v_ttlnet3,
    097 SY-VLINE,098(16) v_ttlnet4,
    115 SY-VLINE,116(16) v_ttlnet5,
    133 SY-VLINE,134(16) v_ttlnet6,
    151 SY-VLINE,152(16) v_ttlnet7,
    169 SY-VLINE,170(16) v_ttlnet8,
    187 SY-VLINE,188(16) v_ttlnet9,
    205 SY-VLINE,206(16) v_ttlnet10,
    223 SY-VLINE,224(16) v_ttlnet11,
    239 SY-VLINE,240(16) v_ttlnet,
    258 SY-VLINE.
    format color off.
    ULINE.
    endform.
    Function to Calculate Aging.
    Form calculate_ageing using
    bukrs
    kunnr
    dat
    RASTBIS1
    RASTBIS2
    RASTBIS3
    RASTBIS4
    RASTBIS5
    RASTBIS6
    RASTBIS7
    RASTBIS8
    RASTBIS9
    RASTBIS0
    P_STAND
    P_NOTED
    P_SPCAL
    changing
    v_net1
    v_net2
    v_net3
    v_net4
    v_net5
    v_net6
    v_net7
    v_net8
    v_net9
    v_net10
    v_net11
    v_net.
    DATA: BEGIN OF BSID_TAB1 OCCURS 0,
    BUKRS LIKE BSID-BUKRS,
    PRCTR LIKE BSID-PRCTR,
    KUNNR LIKE BSID-KUNNR,
    FLAG(1),
    UMSKZ LIKE BSID-UMSKZ,
    BLART LIKE BSID-BLART,
    BELNR LIKE BSID-BELNR,
    BUZEI LIKE BSID-BUZEI,
    NETDT LIKE BSID-ZFBDT,
    ZFBDT LIKE BSID-ZFBDT,
    BUDAT LIKE BSID-BUDAT,
    BLDAT LIKE BSID-BLDAT,
    BSCHL LIKE BSID-BSCHL,
    DMBTR LIKE BSID-DMBTR,
    SHKZG LIKE BSID-SHKZG,
    ZBD1T LIKE BSID-ZBD1T,
    ZBD2T LIKE BSID-ZBD2T,
    ZBD3T LIKE BSID-ZBD3T,
    REBZG LIKE BSID-REBZG,
    REBZT LIKE BSID-REBZT,
    KOART LIKE BSEG-KOART,
    SK1DT LIKE FAEDE-SK1DT,
    SK2DT LIKE FAEDE-SK2DT,
    DAYSD LIKE SY-TABIX,
    END OF BSID_TAB1.
    RANGES: R_UMSKZ FOR BSID-UMSKZ.
    Data : V_ZFBDT Like bsid-ZFBDT,
    V_ZBD1T Like bsid-ZBD1T,
    V_ZBD2T Like bsid-ZBD2T,
    V_ZBD3T Like bsid-ZBD3T,
    V_LINES(8) TYPE n.
    IF P_NOTED = 'X'. "CHECK NOTED ITEMS
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'D'.
    APPEND R_UMSKZ.
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'L'.
    APPEND R_UMSKZ.
    ENDIF.
    IF P_STAND = 'X'. "CHECK STANDARD ITEMS
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = ' '.
    APPEND R_UMSKZ.
    ENDIF.
    IF P_SPCAL = 'X'. "CHECK SPECIAL G/L TRANSACTION
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'A'.
    APPEND R_UMSKZ.
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'B'.
    APPEND R_UMSKZ.
    ENDIF.
    SELECT * FROM BSID INTO CORRESPONDING FIELDS OF TABLE BSID_TAB
    WHERE BUKRS = BUKRS AND
    budat <= dat AND
    KUNNR = KUNNR AND
    UMSKZ in R_UMSKZ.
    SELECT * FROM BSAD appending CORRESPONDING FIELDS OF TABLE BSID_TAB
    WHERE BUKRS = BUKRS AND
    budat <= dat AND
    augdt >= dat AND
    KUNNR = KUNNR AND
    UMSKZ in R_UMSKZ.
    DESCRIBE TABLE BSID_TAB LINES V_LINES.
    LOOP AT BSID_TAB.
    if bsid_tab-BLART = 'DZ'.
    Select single ZFBDT ZBD1T ZBD2T ZBD3T
    into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
    from bsid where BUKRS = BUKRS
    and kunnr = bsid_tab-kunnr
    and BELNR = bsid_tab-REBZG.
    if sy-subrc = 0.
    bsid_tab-ZFBDT = V_ZFBDT.
    bsid_tab-ZBD1T = V_ZBD1T.
    bsid_tab-ZBD2T = V_ZBD2T.
    bsid_tab-ZBD3T = V_ZBD3T.
    else.
    Select single ZFBDT ZBD1T ZBD2T ZBD3T
    into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
    from bsad where BUKRS = BUKRS
    and kunnr = bsid_tab-kunnr
    and BELNR = bsid_tab-REBZG.
    if sy-subrc <> 0.
    bsid_tab-ZFBDT = V_ZFBDT.
    bsid_tab-ZBD1T = V_ZBD1T.
    bsid_tab-ZBD2T = V_ZBD2T.
    bsid_tab-ZBD3T = V_ZBD3T.
    endif.
    endif.
    endif.
    IF BSID_TAB-SHKZG = 'H'.
    BSID_TAB-DMBTR = BSID_TAB-DMBTR * ( - 1 ).
    ENDIF.
    bsid_tab-netdt = bsid_tab-ZFBDT.
    bsid_tab-netdt = bsid_tab-budat.
    bsid_tab-koart = 'D'.
    MODIFY BSID_TAB.
    PERFORM CALC_DUE_DATE USING BSID_TAB.
    BSID_TAB-DAYSD = DAT - BSID_TAB-NETDT.
    IF BSID_TAB-DAYSD <= RASTBIS1.
    V_NET1 = V_NET1 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS2.
    V_NET2 = V_NET2 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS3.
    V_NET3 = V_NET3 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS4.
    V_NET4 = V_NET4 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
    V_NET5 = V_NET5 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS6.
    V_NET6 = V_NET6 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS7.
    V_NET7 = V_NET7 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
    V_NET8 = V_NET8 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS9.
    V_NET9 = V_NET9 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS0.
    V_NET10 = V_NET10 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD > RASTBIS0.
    V_NET11 = V_NET11 + BSID_TAB-DMBTR.
    ENDIF.
    V_NET = V_NET + BSID_TAB-DMBTR.
    MODIFY BSID_TAB.
    ENDLOOP.
    endform.
    Calculate Due Date
    FORM CALC_DUE_DATE USING P_BSID_TAB STRUCTURE BSID_TAB.
    DATA : REFE TYPE P.
    IF P_BSID_TAB-KOART = 'K' OR P_BSID_TAB-KOART = 'D'.
    IF P_BSID_TAB-ZFBDT IS INITIAL.
    P_BSID_TAB-ZFBDT = P_BSID_TAB-BLDAT.
    ENDIF.
    *Nettofälligkeit bestimmen--
    IF NOT P_BSID_TAB-ZBD3T IS INITIAL.
    REFE = P_BSID_TAB-ZBD3T.
    ELSE.
    IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
    REFE = P_BSID_TAB-ZBD2T.
    ELSE.
    REFE = P_BSID_TAB-ZBD1T.
    ENDIF.
    ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
    IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
    OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
    IF P_BSID_TAB-REBZG IS INITIAL.
    REFE = 0.
    ENDIF.
    ENDIF.
    P_BSID_TAB-NETDT = P_BSID_TAB-ZFBDT + REFE.
    *Skontofälligkeiten bestimmen--
    IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
    P_BSID_TAB-SK2DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD2T.
    ELSE.
    P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
    ENDIF.
    IF NOT P_BSID_TAB-ZBD1T IS INITIAL
    OR NOT P_BSID_TAB-ZBD2T IS INITIAL.
    P_BSID_TAB-SK1DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD1T.
    ELSE.
    P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
    ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
    IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
    OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
    IF P_BSID_TAB-REBZG IS INITIAL.
    P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
    P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
    ENDIF.
    ENDIF.
    ELSE.
    MESSAGE E122 RAISING ACCOUNT_TYPE_NOT_SUPPORTED.
    ENDIF.
    E_FAEDE = FAEDE.
    ENDFORM.
    *&      Form  BUILD_FIELDCAT
    FORM BUILD_FIELDCAT .
      PGM = SY-REPID.
      FIELD      = 'give field name'.
      TABLE_NAME = 'give table name'.
      PERFORM FIELDCAT_FILL USING FIELD.
    and so on for the no. of fields you want to display
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  START_LIST_VIEWER
    FORM START_LIST_VIEWER.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
       I_INTERFACE_CHECK              = ' '
         I_CALLBACK_PROGRAM             = PGM
       I_CALLBACK_PF_STATUS_SET       = ' '
         I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
       I_STRUCTURE_NAME               =
       IS_LAYOUT                      =
         IT_FIELDCAT                    = FIELDCAT
       IT_EXCLUDING                   =
       IT_SPECIAL_GROUPS              =
       IT_SORT                        =
       IT_FILTER                      =
       IS_SEL_HIDE                    =
         I_DEFAULT                      = 'X'
         I_SAVE                         = 'A'
       IS_VARIANT                     =
       IT_EVENTS                      =
       IT_EVENT_EXIT                  =
       IS_PRINT                       =
       IS_REPREP_ID                   =
       I_SCREEN_START_COLUMN          = 0
       I_SCREEN_START_LINE            = 0
       I_SCREEN_END_COLUMN            = 0
       I_SCREEN_END_LINE              = 0
       IR_SALV_LIST_ADAPTER           =
       IT_EXCEPT_QINFO                =
       I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER        =
       ES_EXIT_CAUSED_BY_USER         =
       TABLES
         T_OUTTAB                       = FINAL TAB(OUTPUT STATEMENTS TABLE)
      EXCEPTIONS
        PROGRAM_ERROR                   = 1
        OTHERS                          = 2.
    ENDFORM.                    " START_LIST_VIEWER
    *&      Form  FIELDCAT_FILL
          text
    FORM FIELDCAT_FILL USING FIELD_VALUE.
      ADD 1 TO COL_POS.
      FIELDCAT_LN-REF_TABNAME = TABLE_NAME.
      FIELDCAT_LN-FIELDNAME = FIELD_VALUE.
      FIELDCAT_LN-KEY = SPACE.
      FIELDCAT_LN-DO_SUM = SPACE.
      FIELDCAT_LN-COL_POS = COL_POS.
      FIELDCAT_LN-NO_OUT = SPACE.
      FIELDCAT_LN-QFIELDNAME = SPACE.
      FIELDCAT_LN-HOTSPOT = SPACE.
      APPEND FIELDCAT_LN TO FIELDCAT.
    ENDFORM.                    " FIELDCAT_FILL
    Reward points if you find this helpful
    Regards,
    Harini

  • Normal report with ALV's

    Hello Experts,
    i had one new development from Scratch
    one thing is that object already developed, but the customer not intrested that output,
    he want the output to be changed.it is normal report with ALV's.
    main task of this object is to change the visibility.
    Present output is in Tree structure mode..

    Hi
    Well u can use the Fm REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Or go to tx se38 and search programs with BCALVTREE
    you can find some examples.
    Look the tx DWDM.
    Regards
    Gregory

  • Normal report and ALV report, where exactly both are differs?

    For Normal report and ALV report, where exactly both are differs, I mean from which part the process / coding will differ, pls le me know..?
    Akshitha.

    Hi Akshitha,
    In Normal reports we use formatting techniques to display the report list. We define heading and size everything to display report list. But where as in alv we need not to use any formating there are some function modules which will automatically display output list in LIST  and GRID format.
    In Normal report we cannot make changes to the output list where in ALV report we can change the ALV output display dynamically. You can find lots of options for  the ALV list such as you can download output list into Excel sheet and Sorting options Acending and decending order in ALV but in normal report We need to write syntax in the report to display output list in sorting order.  The ALV report is very easy way to display the output compared to Ordinary report.
    Check below some links which will help you to understand about ALV. If you know about Normal report you can campare by userself the difference.
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    <b>Please Reward if useful<b>
    Regards,
    sunil kairam.

  • Navigate from ALV list to normal Report

    Hi ,
    I am working on a ALV report where it will display the list of materials and by selecting these materials from the list and process them using a custom button , it should take me to the normal report which give the log from that material processing.
    Any ideas navigating from AVL to normal report in the same program would be appriciated.
    Thank you.

    Hi,
    if you use drill down you have to define header print twice:
    TOP-OF-PAGE.
      perform 050print_header .
    END-OF-PAGE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      perform 050print_header .
    END-OF-PAGE.

  • How to display ICONS in normal report without using icons table

    Hi Friends,
    I have to display icons(traffic lights) in a normal report.
    Can we do that without using icons table?
    If yes, please let me know how?
    Thanks,

    Hi Pagidala,
    Go to txcode - ABAPDOCU and in that expand BC-ABAP Programming->ABAP User Dialog->Screens->complex screen elements->status icons on Screens.
    In this you can see sample code which may help you.
    Cheers!!

  • Can't add database field or text object to a report (new and existing)

    We have Crystal Report 8.5 and when trying to modify an existing report or create a new report, I can't seem to add any database fields or text objects in my report.  I get a prohibition symbol (circle with a backslash inside it) when I hover over the report.  Has anyone encoutered something like this? Any suggestions?  Thank you.

    Do you have two monitors?
    I had this problem if I tried to open crystal in the second monitor, move it back to primary monitor and it should be OK.
    Ian

  • How to design Customized ALV report like normal report !

    Hello Friends,
                  I like to design a ALV report, with sub headers, sub totals, summary total and other summary details like percentage sale, which is not relavent to the fields displayed in the ALV.
    I know it is possible to get total of the displayed field, but is it possible to design flexible ALV report like normal report.
    Could U please provide example code, if available.
    Thank you,
    Senthil

    HI,
    Just check this example.
    REPORT  ZLAXMI_ALVEXER2  MESSAGE-ID ZZ                       .
    *& TABLES DECLARATION                                                  *
    TABLES: VBAK.
    *& TYPE POOLS DECLARATION                                              *
    TYPE-POOLS: SLIS.
    *& INTERNAL TABLE DECLARATION                                          *
    DATA: BEGIN OF ITAB OCCURS 0,
           ICON TYPE ICON-ID,
           VBELN LIKE VBAK-VBELN,
           AUDAT LIKE VBAK-AUDAT,
           VBTYP LIKE VBAK-VBTYP,
           AUART LIKE VBAK-AUART,
           AUGRU LIKE VBAK-AUGRU,
           NETWR LIKE VBAK-NETWR,
           WAERK LIKE VBAK-WAERK,
        END OF ITAB.
    *INTERNAL TABLE FOR FIELD CATALOG
    DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
        IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
               WITH HEADER LINE,
    *INTERNAL TABLE FOR EVENTS
    DATA:    IT_EVENT TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT,
    *INTERNAL TABLE FOR SORTING
          IT_SORT TYPE SLIS_T_SORTINFO_ALV,
          WA_SORT TYPE SLIS_SORTINFO_ALV,
    *INTERNAL TABLE FOR LAYOUT
          WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    *& VARIABLE DECLARATION                                                *
    DATA : V_REPID TYPE SY-REPID,
           V_PAGNO(4) TYPE N,
           V_DATE(8)  TYPE C.
    *& CONSTANTS                                                           *
    CONSTANTS: C_X TYPE C VALUE 'X'.
    *& SELECTION SCREEN                                                    *
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN,
                    S_VBTYP FOR VBAK-VBTYP DEFAULT 'C'.
    SELECTION-SCREEN: END OF BLOCK B1.
    SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN  COMMENT 1(20) TEXT-003.
    PARAMETERS: P_LIST RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TEXT-004.
    PARAMETERS: P_GRID RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B2.
    AT SELECTION-SCREEN.
      PERFORM VALIDATE_SCREEN.
    *& START OF SELECTION                                               *
    START-OF-SELECTION.
      CLEAR: ITAB, ITAB[].
    V_REPID = SY-REPID.
      PERFORM GET_DATA.
      PERFORM DISPLAY_DATA.
    *& END OF SELECTION                                                    *
    END-OF-SELECTION.
    *--DO ALV Process
      V_REPID = SY-REPID.
    *--Sort the Output Fields
      PERFORM SORT_FIELDS.
    *--Build Field catalog for the Output fields
    PERFORM BUILD_FIELDCAT.
    *--Set the Layout for ALV
      PERFORM SET_LAYOUT.
    *&      Form  GET_DATA
          text
    TO GET THE DATA FROM TABLES INTO ITAB
    FORM GET_DATA .
      SELECT VBELN
             AUDAT
             VBTYP
             AUART
             AUGRU
             NETWR
             WAERK
             INTO CORRESPONDING FIELDS OF TABLE ITAB
             FROM VBAK
             WHERE VBELN IN S_VBELN AND
             AUDAT > '04.04.2005'
             AND NETWR > 0.
      LOOP AT ITAB.
        IF ITAB-NETWR < 10000.
          ITAB-ICON = '@08@'.
        ELSEIF ITAB-NETWR > 10000 AND ITAB-NETWR < 100000.
          ITAB-ICON = '@09@'.
        ELSEIF ITAB-NETWR > 100000.
          ITAB-ICON = '@0A@'.
        ENDIF.
        MODIFY ITAB INDEX SY-TABIX.
      ENDLOOP.
    ENDFORM.                    " GET_DATA
    *&      Form  sort_fields
    FORM SORT_FIELDS .
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'VBTYP'.
      WA_SORT-SPOS = '1'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'NETWR'.
      WA_SORT-SPOS = '2'.
      WA_SORT-UP = 'X'.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
    ENDFORM.                    " sort_fields
    *&      Form  build_fieldcat
    *FORM BUILD_FIELDCAT .
    IT_FIELDCAT-COL_POS    = '1'.
    IT_FIELDCAT-FIELDNAME  = 'ICON'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '10'.
    IT_FIELDCAT-SELTEXT_L  = 'LIGHT'.
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '2'.
    IT_FIELDCAT-FIELDNAME  = 'VBELN'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '10'.
    IT_FIELDCAT-SELTEXT_L  = 'SALES DOC NUMBER'(009).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '3'.
    IT_FIELDCAT-FIELDNAME  = 'AUDAT'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '4'.
    IT_FIELDCAT-SELTEXT_L  = 'DOCUMENT DATE'(010).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '4'.
    IT_FIELDCAT-FIELDNAME  = 'VBTYP'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '4'.
    IT_FIELDCAT-SELTEXT_L  = 'CATEGORY'(011).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '5'.
    IT_FIELDCAT-FIELDNAME  = 'AUART'.
    IT_FIELDCAT-OUTPUTLEN  = '4'.
    IT_FIELDCAT-SELTEXT_L  = 'DOCUMENT TYPE'(012).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '6'.
    IT_FIELDCAT-FIELDNAME  = 'AUGRU'.
    IT_FIELDCAT-OUTPUTLEN  = '12'.
    IT_FIELDCAT-SELTEXT_L  = 'Order reason'(013).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '7'.
    IT_FIELDCAT-FIELDNAME  = 'NETWR'.
    IT_FIELDCAT-OUTPUTLEN  = '12'.
    IT_FIELDCAT-SELTEXT_L  = 'NET VALUE'(014).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '8'.
    IT_FIELDCAT-FIELDNAME  = 'WAERK'.
    IT_FIELDCAT-OUTPUTLEN  = '12'.
    IT_FIELDCAT-SELTEXT_L  = 'SD DOC CURR'(015).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    *ENDFORM.                    " build_fieldcat
    *&      Form  set_layout
    FORM SET_LAYOUT .
      IF P_LIST = C_X .
        WA_LAYOUT-WINDOW_TITLEBAR = 'LIST DISPLAY'(016).
        WA_LAYOUT-ZEBRA = 'X'.
    *-- ALV LIST DISPLAY
        PERFORM LIST_DISPLAY TABLES ITAB.
    *-- ALV GRID DISPLAY
      ELSEIF P_GRID = C_X.
        WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'(017).
        WA_LAYOUT-ZEBRA = 'X'.
        PERFORM GRID_DISPLAY TABLES ITAB.
      ENDIF.
    ENDFORM.                    " set_layout
    *&      Form  list_display
    FORM LIST_DISPLAY  TABLES   P_ITAB .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = V_REPID
          IS_LAYOUT          = WA_LAYOUT
          IT_FIELDCAT        = IT_FIELDCAT[]
          IT_SORT            = IT_SORT[]
          I_SAVE             = 'U'
        TABLES
          T_OUTTAB           = ITAB
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " list_display
    *&      Form  GRID_DISPLAY
    FORM GRID_DISPLAY  TABLES   P_ITAB .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = V_REPID
          IS_LAYOUT          = WA_LAYOUT
          IT_FIELDCAT        = IT_FIELDCAT[]
          IT_SORT            = IT_SORT[]
          IT_EVENTS          = IT_EVENT
        TABLES
          T_OUTTAB           = ITAB
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " GRID_DISPLAY
    *&      Form  VALIDATE_SCREEN
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE_SCREEN .
      DATA: LV_VBELN LIKE VBAK-VBELN.
      IF NOT S_VBELN IS INITIAL.
        SELECT VBELN
        INTO LV_VBELN
        UP TO 1 ROWS
        FROM VBAK
        WHERE VBELN IN S_VBELN.
        ENDSELECT.
        IF SY-SUBRC <> 0.
          MESSAGE E000 WITH 'INVALID SALES DOC'.
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_SCREEN
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_DATA .
      DEFINE M_FIELDCAT.
        ADD 1 TO WA_FIELDCAT-COL_POS.
        WA_FIELDCAT-FIELDNAME   = &1.
        WA_FIELDCAT-REF_TABNAME = 'VBAK'.
        WA_FIELDCAT-DO_SUM      = &2.
        WA_FIELDCAT-CFIELDNAME  = &3.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
      END-OF-DEFINITION.
    DATA:
        LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
        LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
      M_FIELDCAT 'ICON' ''  ''.
      M_FIELDCAT 'VBELN' ''  ''.
      M_FIELDCAT 'AUDAT' ''  ''.
      M_FIELDCAT 'VBTYP' ''  ''.
      M_FIELDCAT 'AUART' ''  ''.
      M_FIELDCAT 'AUGRU' ''  ''.
      M_FIELDCAT 'NETWR' 'C' 'WAERK'.
      M_FIELDCAT 'WAERK' ''  ''.
    ENDFORM.                    " display_data
    Regards
    Laxmi

  • Highlighted text in Normal report.

    Hi,
    My client requirements is that one report has to display in higlighted text for every alternative line items. This is a normal classical report, In alv we can achive this. But in normal report how it can be possilbe. Please suggest me on this..
    Thanks in Advance.
    Regards,
    Ramana

    Hi
    Use the following code
      FORMAT  COLOR  COL_KEY   INTENSIFIED OFF.
      WRITE:    'Hello World'.
      FORMAT  COLOR  OFF.
    Hopefully, it will help you.
    Thanks & Regards,
    Ibrar

  • Bug in Normal report

    Hi all,
         BUG  in normal report program, program of to take print of  rejection invoice ,while taking  the printout after creating the rejection invoice value getting differ(ex: correct value = 100 but ts take like 200/3022 like this). after sometime if i take same program  same variant value comeing  correct( ex correct value = 100) taking correct .its little bit diffcult to check in program . Please guide me  the excatly what could be the promblem reason.
    Regards,
    Santosh

    Hi,
    what do you mean by "normal Report".
    Is it a customer or SAP Report?
    Regards, Dieter

  • How to align object in the report layout

    Hello,
    I find it very difficult to aligin objects in the report editor or in the template editor. I know there are some alignment options, like aligning to the grid or aligning a group of objects, but they seem to work on the bounding rectangle for the object. For my text objects, those rectangles are arbitrarily sized. So aligning those rectangles does not correctly align the text baseline, for example.
    Does anyone have a tip on how you can align objects? I there maybe a way to alter the size of objects by changing a number in a property sheet somewhere?
    Regards,
    Frans

    The problems I am having now occur when I am editing the margin in the template editor. For some reason, the flex and confine options can not be turned off in the template editor. I believe they are turned on in this mode, at least in tools:options: paper layout they are turned on. But anyway, this really does not matter because I don't have nested objects in the margin. The objects that will go flying off are completely unrelated to the object I want to move or resize.
    Update: I have just tried editing the layout of a report that was based on the template I am working on. Turning flex off there had a positive effect. It seems indeed the 'flex' setting is to blame for the problems I am experiencing. Thanks for the tip!
    So now I would really like to know how to turn of flex in the template editor..

  • Business Objects 3.1 reports are not working with IE 10.

    Hi,
    Recently I upgraded my internet explorer to IE10.. Since then business objects 3.1 reports are not opening in IE10.0
    Getting error message "webpage can't be found".
    I am not sure whether BO 3.1 reports work with IE 10.0 or not.
    Please advise
    Thanks
    Sat

    Did you try with other browsers ?
    IE 10 (Compatibility View display mode) with Oracle Java 6 / Oracle Java 7 is supported for BOXI3.1 SP6.
    Please check the PAM for details of your SP level.

  • Total number of pages in Normal Report

    How to display the total number of pages in normal report.
    To display current page number I am using sy-pagno.
    Is there any system variable to display Total numbetr of pages in normal report.
    Thanks in advance.

    Hi,
    There is no system variable to find total no of pages but you can use the following to get that one.
    Declare a variable
    DATA L_PAGE_COUNT(5) TYPE C.
    Copy this code to the end of program
    Page count will be printed on each page here
        WRITE SY-PAGNO TO L_PAGE_COUNT LEFT-JUSTIFIED.
        DO SY-PAGNO TIMES.
            READ LINE 1 OF PAGE SY-INDEX.
            REPLACE '-----' WITH L_PAGE_COUNT INTO SY-LISEL.
            MODIFY CURRENT LINE.
        ENDDO.
    TOP-OF-PAGE.
        WRITE: /(70) 'Heading' CENTERED, 70 SY-PAGNO,'of ', '-----'.
    *--- End of Program
    Thayalan

  • Multiple tables in ALV / Normal report

    Hi,
    I have an internal table ,INT with 4 fields a,b,c and d.
    i want to group the table by field A and display report. I want to display report in groups ..
    for ex:
    PERSAREA         NAME         AGE
    0001                    sfsdf              45
    0001                    ffffffffff             54
    0001                    ggggg            67
    PERSAREA         NAME         AGE
    0004                    sfsdf              45
    0004                    ffffffffff             54
    PERSAREA         NAME         AGE
    0009                    rrrrrrrrr            45
    0009                    jjjjjjjjjjjjj           54
    I need to display table header for each group. The groups should be separated by lines.
    Whts the best way to do? ALV/Normal ?
    <<removed by moderator>>
    Regards,
    JV.

    Hi,
        Do with Normal report with Control break statements( AT and ENDAT events in LOOP and ENDLOOP.
    Regards
    Bala Krishna

Maybe you are looking for