IN ALV TOTAL OPTIONS

problem aobut to display total button in alv.
in my production server this button is display but when particular user login their own id and run this alv report at that time this total options button not display.
so pl give soluation.

Hi,
If u r using this FM ,
did u check the follwoing.
Totals
•     *no_sumchoice*
value set: SPACE, 'X'          'X' = fields which are to be summed, passed by the calling program (FIELDCAT-DO_SUM = 'X'). The user should not be able to change this value interactively.
•     no_totalline
value set: SPACE, 'X'          'X' = no total record is to be output. Subtotals can still be calculated and output. The fields in the subtotals are flagged DO_SUM = 'X' in the field list.
•     no_subchoice
value set: SPACE, 'X'          'X' = value whose change triggers subtotals, provided by the calling program. The user should not be able to change this value interactively.
See also the documentation of the IMPORTING parameter IT_SORT.
•     no_subtotals
value set: SPACE, 'X'          'X' = no subtotals.
•     totals_only     
value set: SPACE, 'X'          'X' = only total records are output.
an interactive breakdown of simple and hierarchical-sequential lists is possible. prerequisite: the IMPORTING parameter IT_SORT contains the sort criteria and subtotal flags.
See also the documentation of the IMPORTING parameter IT_SORT.
•     totals_text
value set: SPACE, string(max.60)     ' ' = the first column in the total record contains an appropriate number of ''s to indicate the total by default. If the first column is wide enough, the string 'Total' is output after the asterisks. 'string' = the string passed is output after the total indicated by '', if the column is wide enough.
•     subtotals_text
value set: SPACE, string(max.60)     ' ' = in the first column of subtotal records, the subtotal is indicated by an appropriate number of '*' by default. If the first column is not a subtotal criterion, the string 'Total' is output after the asterisks, if the column is wide enough.
'string' = the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion.
If it is a subtotal criterion, its value is repeated after the total, if the column is wide enough.
•     numc_sum
value set: SPACE, 'X'          ' ' = by default NUMC fields cannot be totalled
'X' = NUMC fields can be totalled. If this flag is set, the total can be controlled via the FIELDCAT-NO_SUM parameter per NUMC column.

Similar Messages

  • ALV Totals , Subtotals for a particular field in ALV Grid report

    Hi,
    I have an issue in ALV totals and subtotals.
    Scenario is like this.
    i have a vendor data to be pulled out of SAP and to be shown in the form of report.
    i am populating all the data and doing do_sum based on Vendor ( has expansin & collapse option ) and display the number of reports .
    Vendor -
    100
    Vendor1 -
    1
    Vendor2----
    2.
    Vendor100----
    100.
    but my problem is in the same report i have a date field .
    if i have a five vendors created on 03/03/2008. in the same report for the date field having ( expansion & collapse ) , when i expand based on that date can i be able to sum up all the vendors created on 03/03/2008 and display in the same report along with the vendor count.
    Let me know . Thank you in advance
    Regards,
    Ry

    Hi Roby,
    Have a look at this sample code
    It will help u,
    REPORT ZIN_FI_AGEING
           message-id zbdc
           no standard page heading.
    Title                   : For Ageing Details
    Author                  :
    Date                    : 22/11/2004
    Transport/Correction Id :
    Clarify case ID         :
    Application             : FI
    Program Type            :
    Frequency               :
    Purpose                 :
    Comments                :
    Request No              :
      TABLES DELCARATIONS
    Tables: zzgeinz9a,    "Actual line item table
            t001.         "Plants/Branches
      ALV TTPE DELCARATIONS
    type-pools: slis.
    *Type Declarations for Field Catalog
    data : i_fldcat_head type slis_t_fieldcat_alv,
           wa_fldcat_head type slis_fieldcat_alv.
    *Type Declarations for ALV Events
    data : i_events type slis_t_event,
           wa_event like line of i_events.
    *Type Declarations for Layout Design
    data : wa_layout type slis_layout_alv.
    *Type Declarations for Sorting Fields
    data:  it_sort type slis_sortinfo_alv occurs 0 with header line.
    *Type Declarations for Displaying Images on Grid
    data : i_comment type slis_t_listheader,
           wa_comment type slis_listheader.
    *Type Declarations for Grouping fields
    data : wa_group type slis_sp_group_alv,
           i_group type slis_t_sp_group_alv.
      DATA DELCARATIONS
    data: v_flag,                 "Status Flag
          v_repid like sy-repid,  "Program Name
          p_year(4) type c,       "Year
          v_due_days type i.      "To hold the due days
      CONSTANTS DELCARATIONS
    constants: c_x type c value 'X',
               c_bukrs(4) type c value '0373'.
      INTERNAL TABLES DELCARATIONS
    *--Internal table to hold the required data
    data: begin of it_final_vendor occurs 0,
            rzzlifnr    like zzgeinz9a-rzzlifnr,  "Vendor
            name1       like lfa1-name1,          "Vendor Name
            docnr       like zzgeinz9a-DOCNR,     "Accounting Doc No
            refdocnr    like zzgeinz9a-REFDOCNR,  "Reference document no
            belnr       like bkpf-belnr,          "FI Doc No
            doc_date    like bkpf-awkey,          "Document Date
            zbd1t       like bsik-zbd1t,          "Cash discount days 1
            bldat       like bkpf-bldat,          "Document Date
            due_date    like bkpf-bldat,          "Due Date
            due_days    type i,                   "Due Days
            rzz_ebeln   like zzgeinz9a-rzz_ebeln, "P.O. Ref No
            not_due     like zzgeinz9a-hsl,       "Not Yet Due
            hsl         like zzgeinz9a-hsl,       "local currency
            found       type c,                   "Existance Flag
          end of it_final_vendor.
    data: begin of it_final_vendor_temp occurs 0,
            rzzlifnr    like zzgeinz9a-rzzlifnr,  "Vendor
            name1       like lfa1-name1,          "Vendor Name
            belnr       like bkpf-belnr,          "FI Doc No
            bldat       like bkpf-bldat,          "Document Date
            rzz_ebeln   like zzgeinz9a-rzz_ebeln, "P.O. Ref No
            hsl        like zzgeinz9a-hsl,        "local currency
            due_date    like bkpf-bldat,          "Due Date
            due_days    type i,                   "Due Days
            not_due     like zzgeinz9a-hsl,       "Not Yet Due
            buck_0_30   like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_31_60  like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_61_90  like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_91_180 like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_180    like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            docnr       like zzgeinz9a-DOCNR,     "Accounting Doc No
            refdocnr    like zzgeinz9a-REFDOCNR,  "Reference document no
            doc_date    like bkpf-awkey,          "Document Date
            found       type c,                   "Existance Flag
          end of it_final_vendor_temp.
    data: begin of it_final_customer occurs 0,
            rzzkunnr    like zzgeinz9a-rzzkunnr,  "Customer
            name1       like kna1-name1,          "Customer Name
            docnr       like zzgeinz9a-DOCNR,     "Accounting Doc No
            refdocnr    like zzgeinz9a-REFDOCNR,  "Reference document no
            belnr       like bkpf-belnr,          "FI Doc No
            doc_date    like bkpf-awkey,          "Document Date
            zbd1t       like bsik-zbd1t,          "Cash discount days 1
            bldat       like bkpf-bldat,          "Document Date
            due_date    like bkpf-bldat,          "Due Date
            due_days    type i,                   "Due Days
            rzz_ebeln   like zzgeinz9a-rzz_ebeln, "P.O. Ref No
            not_due     like zzgeinz9a-hsl,       "Not Yet Due
            hsl         like zzgeinz9a-hsl,       "local currency
            found       type c,                   "Existance Flag
          end of it_final_customer.
    data: begin of it_final_customer_temp occurs 0,
            rzzkunnr    like zzgeinz9a-rzzkunnr,  "Customer
            name1       like kna1-name1,          "Customer Name
            belnr       like bkpf-belnr,          "FI Doc No
            bldat       like bkpf-bldat,          "Document Date
            rzz_ebeln   like zzgeinz9a-rzz_ebeln, "P.O. Ref No
            hsl        like zzgeinz9a-hsl,        "local currency
            due_date    like bkpf-bldat,          "Due Date
            due_days    type i,                   "Due Days
            not_due     like zzgeinz9a-hsl,       "Not Yet Due
            buck_0_30   like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_31_60  like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_61_90  like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_91_180 like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            buck_180    like zzgeinz9a-hsl,       "Invoiceamt in localcurr
            docnr       like zzgeinz9a-DOCNR,     "Accounting Doc No
            refdocnr    like zzgeinz9a-REFDOCNR,  "Reference document no
            doc_date    like bkpf-awkey,          "Document Date
            found       type c,                   "Existance Flag
          end of it_final_customer_temp.
    *--Internal Table to hold the Cash discount days 1 for Vendors
    data: begin of it_final_bsik occurs 0,
            belnr like bsik-belnr,
            zbd1t like bsik-zbd1t,
          end of it_final_bsik.
    *--Internal Table to hold the Cash discount days 1 for Customers
    data: begin of it_final_bsid occurs 0,
            belnr like bsid-belnr,
            zbd1t like bsid-zbd1t,
          end of it_final_bsid.
      INITIALIZATION
    v_repid = sy-repid.
      SELECTION SCREEN
    selection-screen: begin of block b1 with frame title text-h01.
    selection-screen skip.
    select-options: s_vendor for zzgeinz9a-rzzlifnr modif id ven.
    parameters: p_comp1 like t001-bukrs modif id ven.
    parameters: p_rundt1 like bkpf-bldat modif id ven.
    select-options: s_cust for zzgeinz9a-rzzkunnr modif id cst.
    parameters: p_comp2 like t001-bukrs modif id cst.
    parameters: p_rundt2 like bkpf-bldat modif id cst.
    selection-screen skip.
    selection-screen: begin of block b2 with frame title text-h02.
    parameters : p_vendor radiobutton group gr1 default 'X'
                                      user-command test,
                 p_cust  radiobutton group gr1.
    selection-screen: end of block b2.
    selection-screen: end of block b1.
    **************************AT Selection Screen OutPut ******************
    at selection-screen output.
      loop at screen.
        if p_cust = 'X'.
          if screen-group1 = 'VEN'.
            screen-active = '0'.
            screen-input = '0'.
            screen-output = '0'.
            screen-invisible = '0'.
          endif.
        elseif p_vendor = 'X'.
          if screen-group1 = 'CST'.
            screen-active = '0'.
            screen-input = '0'.
            screen-output = '0'.
            screen-invisible = '0'.
          endif.
        endif.
        modify screen.
      endloop.
      SELECTION SCREEN ON
    at selection-screen on s_vendor.
    *--Validating Vendor
      if not s_vendor[] is initial.
        perform validate_s_vendor.
      endif.
    at selection-screen on s_cust.
    *--Validating Customer
      if not s_cust[] is initial.
        perform validate_s_cust.
      endif.
    at selection-screen on p_comp1.
    *--Validating Company Code.
      if not p_comp1 is initial.
        perform validate_p_comp1.
      endif.
    at selection-screen on p_comp2.
    *--Validating Company Code.
      if not p_comp2 is initial.
        perform validate_p_comp2.
      endif.
      START OF SELECTION
    start-of-selection.
    if p_vendor = 'X'.
       perform get_vendor_data.
    elseif p_cust = 'X'.
       perform get_customer_data.
    endif.
      END OF SELECTION
    end-of-selection.
    if p_vendor = 'X'.
    *--Generating the output for vendor
      perform generate_field_catalog_vendor.
      perform get_events_vendor.
      perform generate_layout_vendor.
      perform generate_sort_vendor.
      perform generate_group_vendor.
      perform disp_alv_grid_vendor.
    elseif p_cust = 'X'.
    *--Generating the output for customer
      perform generate_field_catalog_cust.
      perform get_events_customer.
      perform generate_layout_customer.
      perform generate_sort_customer.
      perform generate_group_customer.
      perform disp_alv_grid_customer.
    endif.
    *&      Form  validate_s_vendor
          Validating the Vendor
    form validate_s_vendor.
      select rzzlifnr up to 1 rows
      into (zzgeinz9a-rzzlifnr)
      from zzgeinz9a
      where rzzlifnr in s_vendor.
      endselect.
      if sy-subrc ne 0.
        message e004 with 'Invalid Range of Vendor'(002)
    s_vendor-low 'To'(006) s_vendor-high.
      endif.
    endform.                    " validate_s_vendor
    *&      Form  validate_s_cust
          Validating the Customer
    form validate_s_cust.
       select rzzkunnr up to 1 rows
       into (zzgeinz9a-rzzkunnr)
       from zzgeinz9a
       where rzzkunnr in s_cust.
       endselect.
       if sy-subrc ne 0.
         message e004 with 'Invalid Range of Customer'(005)
    s_cust-low 'To'(006) s_cust-high.
      endif.
    endform.                    " validate_s_cust
    *&      Form  validate_p_comp1
          Validating the Company Code
    form validate_p_comp1.
      select single bukrs
             into   (t001-bukrs)
             from   t001
             where  bukrs eq p_comp1.
      if sy-subrc ne 0.
        message e004 with 'Company Code'(004) p_comp1 'Does not Exists'(003)
      endif.
    endform.                    " validate_p_comp1
    *&      Form  validate_p_comp2
          Validating the Company Code
    form validate_p_comp2.
      select single bukrs
             into   (t001-bukrs)
             from   t001
             where  bukrs eq p_comp2.
      if sy-subrc ne 0.
        message e004 with 'Company Code'(004) p_comp2 'Does not Exists'(003)
      endif.
    endform.                    " validate_p_comp2
    *&      Form  get_vendor_data
          Getting the Vendor Related Docs
    form get_vendor_data.
    select a~rzzlifnr
            b~name1
            a~docnr
            a~refdocnr
            a~rzz_ebeln
            a~hsl
        into corresponding fields of table it_final_vendor
        from zzgeinz9a as a
        inner join lfa1 as b
        on arzzlifnr = blifnr
        where rzzlifnr in s_vendor
        and   rbukrs   eq p_comp1.
        if sy-subrc eq 0.
          v_flag = 'X'.
          p_year = sy-datum+0(4).
          perform get_doc_date using p_comp1
                                     p_year.
          perform move_records.
          sort it_final_vendor by rzzlifnr.
          perform generate_data.
        else.
          v_flag = space.
        endif.
    endform.                    " get_vendor_data
    *&      Form  get_customer_data
          Getting the Customer Related Docs
    form get_customer_data.
    select a~rzzkunnr
            b~name1
            a~docnr
            a~refdocnr
            a~rzz_ebeln
            a~hsl
        into corresponding fields of table it_final_customer
        from zzgeinz9a as a
        inner join kna1 as b
        on arzzkunnr = bkunnr
        where rzzkunnr in s_cust
        and   rbukrs   eq p_comp2.
        if sy-subrc eq 0.
          v_flag = 'X'.
          p_year = sy-datum+0(4).
          perform get_doc_date_cust using p_comp2
                                          p_year.
          perform move_records_cust.
          sort it_final_customer by rzzkunnr.
          perform generate_data_cust.
        else.
          v_flag = space.
        endif.
    endform.                    " get_customer_data
    *&      Form  get_doc_date
          Getting the Document Date and FI Doc No
         -->P_P_COMP1 Company Code
         -->P_P_YEAR  Fiscal Year
    form get_doc_date using    p_p_comp1
                               p_p_year.
      loop at it_final_vendor.
        concatenate it_final_vendor-refdocnr '*' into
    it_final_vendor-doc_date.
        modify it_final_vendor index sy-tabix.
    endloop.
    clear it_final_vendor.
    data: v_doc_date(11) type c,
          v_belnr like bkpf-belnr,
          v_bldat like bkpf-bldat.
          loop at it_final_vendor.
           concatenate it_final_vendor-refdocnr '%' into v_doc_date.
            select single belnr
                          bldat
                   into corresponding fields of it_final_vendor
                   from bkpf
                   where bukrs eq p_p_comp1
                   and   gjahr eq p_p_year
                   and   awkey like v_doc_date.
                   modify it_final_vendor.
           endloop.
        clear:it_final_vendor.
    endform.                    " get_doc_date
    *&      Form  move_records
          Moving records to final internal table
    form move_records.
    *--Checking the existance of belnr in bsik
    clear it_final_vendor.
      select belnr
             zbd1t
             into table it_final_bsik
             from bsik
             for all entries in it_final_vendor
             where belnr eq it_final_vendor-belnr
             and   bukrs eq c_bukrs.
    clear it_final_bsik.
      loop at it_final_vendor.
        read table it_final_bsik with key belnr = it_final_vendor-belnr.
        if sy-subrc eq 0.
          it_final_vendor-zbd1t = it_final_bsik-zbd1t.
          it_final_vendor-due_date = it_final_vendor-bldat +
    it_final_bsik-zbd1t.
          it_final_vendor-found    = 'X'.
          modify it_final_vendor.
        endif.
      endloop.
    endform.                    " move_records
    *&      Form  generate_data
          Segregating the records based on due_date
    form generate_data.
      delete it_final_vendor[] where found ne 'X'.
      sort it_final_vendor by belnr.
      loop at it_final_vendor.
        if it_final_vendor-due_date > p_rundt1.
          move-corresponding it_final_vendor to it_final_vendor_temp.
          move it_final_vendor-hsl to it_final_vendor_temp-not_due.
        elseif it_final_vendor-due_date < p_rundt1.
          it_final_vendor-due_days = p_rundt1 - it_final_vendor-DUE_DATE.
        endif.
    *--filling 0-30 bucket.
        if it_final_vendor-due_days ge 0 AND it_final_vendor-due_days le 30.
          move-corresponding it_final_vendor to it_final_vendor_temp.
          move it_final_vendor-hsl to it_final_vendor_temp-buck_0_30.
    *--filling 31-60 bucket.
    elseif it_final_vendor-due_days ge 31 AND it_final_vendor-due_days le 60
          move-corresponding it_final_vendor to it_final_vendor_temp.
          move it_final_vendor-hsl to it_final_vendor_temp-buck_31_60.
    *--filling 61-90 bucket.
    elseif it_final_vendor-due_days ge 61 AND it_final_vendor-due_days le 90
          move-corresponding it_final_vendor to it_final_vendor_temp.
          move it_final_vendor-hsl to it_final_vendor_temp-buck_61_90.
    *--filling 91-180 bucket.
        elseif it_final_vendor-due_days ge 91 AND it_final_vendor-due_days
    le 180.
          move-corresponding it_final_vendor to it_final_vendor_temp.
          move it_final_vendor-hsl to it_final_vendor_temp-buck_91_180.
    *--filling 180 bucket.
        elseif it_final_vendor-due_days gt 180.
          move-corresponding it_final_vendor to it_final_vendor_temp.
          move it_final_vendor-hsl to it_final_vendor_temp-buck_180.
        endif.
         append it_final_vendor_temp.
         clear it_final_vendor_temp.
      endloop.
    endform.                    " generate_data
    *&      Form  DISP_ALV_GRID_VENDOR
          Displaying the output in grid For Vendor
    form DISP_ALV_GRID_VENDOR.
    *--Generating the OUTPUT GRID FOR VENDOR
      call function 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                =
        I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = v_repid
        I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = ' '
        I_CALLBACK_TOP_OF_PAGE            = ' '
        I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
        I_CALLBACK_HTML_END_OF_LIST       = ' '
        I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = ' '
        I_GRID_TITLE                      =
        I_GRID_SETTINGS                   =
          IS_LAYOUT                         = wa_layout
          IT_FIELDCAT                       = i_fldcat_head
        IT_EXCLUDING                      =
          IT_SPECIAL_GROUPS                 = i_group
          IT_SORT                           = it_sort[]
        IT_FILTER                         =
        IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
        I_SAVE                            = ' '
        IS_VARIANT                        =
          IT_EVENTS                         = i_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
        IT_ALV_GRAPHICS                   =
        IT_ADD_FIELDCAT                   =
        IT_HYPERLINK                      =
        I_HTML_HEIGHT_TOP                 =
        I_HTML_HEIGHT_END                 =
        IT_EXCEPT_QINFO                   =
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER           =
        ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = it_final_vendor_temp
       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.                    " DISP_ALV_GRID
    *&      Form  get_doc_date_cust
          text
         -->P_P_COMP2 Company Code
         -->P_P_YEAR  Fiscal Year
    form get_doc_date_cust using    p_p_comp2
                                    p_p_year.
      loop at it_final_customer.
        concatenate it_final_customer-refdocnr '*' into
    it_final_customer-doc_date.
        modify it_final_customer index sy-tabix.
    endloop.
    clear it_final_customer.
    data: v_doc_date(11) type c,
          v_belnr like bkpf-belnr,
          v_bldat like bkpf-bldat.
          loop at it_final_customer.
           concatenate it_final_customer-refdocnr '%' into v_doc_date.
            select single belnr
                          bldat
                   into corresponding fields of it_final_customer
                   from bkpf
                   where bukrs eq p_p_comp2
                   and   gjahr eq p_p_year
                   and   awkey like v_doc_date.
                   modify it_final_customer.
           endloop.
        clear:it_final_customer.
    endform.                    " get_doc_date_cust
    *&      Form  move_records_cust
          Moving Customer Data to Final Internal Table
    form move_records_cust.
    *--Checking the existance of belnr in bsid
      select belnr
             zbd1t
             into table it_final_bsid
             from bsid
             for all entries in it_final_customer
             where belnr eq it_final_customer-belnr
             and   bukrs eq c_bukrs.
    clear it_final_bsid.
      loop at it_final_customer.
        read table it_final_bsid with key belnr = it_final_customer-belnr.
        if sy-subrc eq 0.
          it_final_customer-zbd1t    = it_final_bsid-zbd1t.
          it_final_customer-due_date = it_final_customer-bldat +
    it_final_bsid-zbd1t.
          it_final_customer-found    = 'X'.
          modify it_final_customer.
        endif.
      endloop.
    endform.                    " move_records_cust
    *&      Form  generate_data_cust
          Generating the Customer Output
    form generate_data_cust.
      delete it_final_customer[] where found ne 'X'.
      sort it_final_customer by belnr.
      loop at it_final_customer.
        if it_final_customer-due_date > p_rundt2.
         move-corresponding it_final_customer to it_final_customer_temp.
         move it_final_customer-hsl to it_final_customer_temp-not_due.
        elseif it_final_customer-due_date < p_rundt2.
         it_final_customer-due_days = p_rundt2 - it_final_customer-DUE_DATE.
        endif.
    *--filling 0-30 bucket.
    if it_final_customer-due_days ge 0 AND it_final_customer-due_days le 30
          move-corresponding it_final_customer to it_final_customer_temp.
          move it_final_customer-hsl to it_final_customer_temp-buck_0_30.
    *--filling 31-60 bucket.
    elseif it_final_customer-due_days ge 31 AND it_final_customer-due_days
    le 60
          move-corresponding it_final_customer to it_final_customer_temp.
          move it_final_customer-hsl to it_final_customer_temp-buck_31_60.
    *--filling 61-90 bucket.
    elseif it_final_customer-due_days ge 61 AND it_final_customer-due_days
    le 90
          move-corresponding it_final_customer to it_final_customer_temp.
          move it_final_customer-hsl to it_final_customer_temp-buck_61_90.
    *--filling 91-180 bucket.
        elseif it_final_customer-due_days ge 91 AND
    it_final_customer-due_days
    le 180.
          move-corresponding it_final_customer to it_final_customer_temp.
          move it_final_customer-hsl to it_final_customer_temp-buck_91_180.
    *--filling 180 bucket.
        elseif it_final_customer-due_days gt 180.
          move-corresponding it_final_customer to it_final_customer_temp.
          move it_final_customer-hsl to it_final_customer_temp-buck_180.
        endif.
         append it_final_customer_temp.
         clear it_final_customer_temp.
      endloop.
    endform.                    " generate_data_cust
    *&      Form  generate_field_catalog_vendor
          Generating the Field Catalog for Vendor
    form generate_field_catalog_vendor.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
          I_PROGRAM_NAME               = v_repid
          I_INTERNAL_TABNAME           = 'IT_FINAL_VENDOR_TEMP'
        I_STRUCTURE_NAME             =
        I_CLIENT_NEVER_DISPLAY       = 'X'
          I_INCLNAME                   = v_repid
        I_BYPASSING_BUFFER           =
        I_BUFFER_ACTIVE              =
        changing
          ct_fieldcat                  = i_fldcat_head
       EXCEPTIONS
         INCONSISTENT_INTERFACE       = 1
         PROGRAM_ERROR                = 2
         OTHERS                       = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      if not i_fldcat_head[] is initial.
        loop at i_fldcat_head into wa_fldcat_head.
        case wa_fldcat_head-fieldname.
         when 'RZZLIFNR'.
            wa_fldcat_head-col_pos = '1'.
            wa_fldcat_head-ref_tabname = ' '.
            wa_fldcat_head-seltext_m  = 'Vendor No'(001).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '12'.
         when 'NAME1'.
            wa_fldcat_head-col_pos = '2'.
            wa_fldcat_head-seltext_m  = 'Vendor Name'(007).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '35'.
         when 'BELNR'.
            wa_fldcat_head-col_pos = '3'.
            wa_fldcat_head-seltext_m  = 'Invoice No'(008).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '12'.
            wa_fldcat_head-KEY       = ' '.
         when 'BLDAT'.
            wa_fldcat_head-col_pos = '4'.
            wa_fldcat_head-seltext_m  = 'Document Date'(009).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '13'.
            wa_fldcat_head-ref_tabname = ' '.
         when 'RZZ_EBELN'.
            wa_fldcat_head-col_pos = '5'.
            wa_fldcat_head-seltext_m  = 'PO.Ref.No'(010).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '13'.
            wa_fldcat_head-ref_tabname = ' '.
         when 'HSL'.
            wa_fldcat_head-col_pos = '6'.
            wa_fldcat_head-seltext_m  = 'Invoice Amount'(011).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'DUE_DATE'.
            wa_fldcat_head-col_pos = '7'.
            wa_fldcat_head-seltext_m  = 'Due Date'(012).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '12'.
            wa_fldcat_head-ref_tabname = ' '.
         when 'DUE_DAYS'.
            wa_fldcat_head-col_pos = '8'.
            wa_fldcat_head-seltext_m  = 'Due Days'(013).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '9'.
         when 'NOT_DUE'.
            wa_fldcat_head-col_pos = '9'.
            wa_fldcat_head-seltext_m  = 'Not Due'(014).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_0_30'.
            wa_fldcat_head-col_pos = '10'.
            wa_fldcat_head-seltext_m  = '0 To 30'(015).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_31_60'.
            wa_fldcat_head-col_pos = '11'.
            wa_fldcat_head-seltext_m  = '31 To 60'(016).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_61_90'.
            wa_fldcat_head-col_pos = '12'.
            wa_fldcat_head-seltext_m  = '61 To 90'(017).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_91_180'.
            wa_fldcat_head-col_pos = '13'.
            wa_fldcat_head-seltext_m  = '91 To 180'(018).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_180'.
            wa_fldcat_head-col_pos = '14'.
            wa_fldcat_head-seltext_m  = 'Beyond 180'(019).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
        when 'DOCNR'.
            wa_fldcat_head-no_out = 'X'.
        when 'REFDOCNR'.
            wa_fldcat_head-no_out = 'X'.
        when 'DOC_DATE'.
            wa_fldcat_head-no_out = 'X'.
        when 'FOUND'.
            wa_fldcat_head-no_out = 'X'.
         endcase.
         modify i_fldcat_head from wa_fldcat_head index sy-tabix.
        endloop.
      endif.
    endform.                    " generate_field_catalog_vendor
    *&      Form  get_events_vendor
          Getting ALV Events
    form get_events_vendor.
        call function 'REUSE_ALV_EVENTS_GET'
      EXPORTING
        I_LIST_TYPE           = 0
       importing
         et_events             = i_events
      exceptions
        list_type_wrong       = 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.
      if not i_events[] is initial.
       read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
       wa_event-form = 'GENERATE_USERCOMMAND'.
       modify i_events from wa_event index sy-tabix.
       read table i_events into wa_event with key name = 'END_OF_LIST'(025)
       wa_event-form = 'GENERATE_USERCOMMAND_FOOTER'.
       modify i_events from wa_event index sy-tabix.
      endif.
    endform.                    " get_events_vendor
    *&      Form  GENERATE_USERCOMMAND
          Displaying Header-Text and Logo on Grid
    form generate_usercommand .
      clear i_comment[].
      wa_comment-typ = 'H'.
      wa_comment-info = 'Vendor Ageing Report'(026).
      append wa_comment to i_comment.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = i_comment
          i_logo             = 'ENJOYSAP_LOGO'
        I_END_OF_LIST_GRID       = 'X'
    endform.                    " GENERATE_USERCOMMAND
    *&      Form  GENERATE_USERCOMMAND_FOOTER
          Displaying Footer-Text on Grid
    form generate_usercommand_footer.
      clear i_comment[].
      clear wa_comment.
      wa_comment-typ = 'S'.
      wa_comment-key = 'GE-Betz'(027).
      append wa_comment to i_comment.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary       = i_comment
        I_LOGO                  = ''
          i_end_of_list_grid       = 'X'.
    endform.                    " GENERATE_USERCOMMAND_FOOTER
    *&      Form  generate_layout_vendor
          Generating the ALV Layout
    form generate_layout_vendor.
      WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.     "OPTIMIZING FIELD WIDTH
      wa_layout-zebra = 'X'.                  "PUTTING ZEBRA COLORS
      wa_layout-confirmation_prompt = 'X'.    "DISPLAYS CONFIRMATION DIALOG
      wa_layout-totals_text = 'Totals'(028).       "DISPLAYS TOTALS TEXT
      wa_layout-subtotals_text = 'Sub Totals'(029)."DISPLAYS SUBTOTALS TEXT
    endform.                    " generate_layout_vendor
    *&      Form  generate_sort_vendor
          Sorting the Internal Table by Vendor
    form generate_sort_vendor.
      it_sort-fieldname = 'RZZLIFNR'.
      it_sort-tabname = 'IT_FINAL_VENDOR_TEMP'.
      it_sort-up = 'X'.
      it_sort-subtot = 'X'.
      append it_sort.
    endform.                    " generate_sort_vendor
    *&      Form  generate_group_vendor
          Grouping the Data
    form generate_group_vendor.
      clear i_group.
      wa_group-sp_group = 'A'.
      wa_group-text  = 'RZZLIFNR'.
      append wa_group to i_group.
    endform.                    " generate_group_vendor
    *&      Form  GENERATE_FIELD_CATALOG_CUST
          Generating Field Catalog for Customer
    form GENERATE_FIELD_CATALOG_CUST.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
          I_PROGRAM_NAME               = v_repid
          I_INTERNAL_TABNAME           = 'IT_FINAL_CUSTOMER_TEMP'
        I_STRUCTURE_NAME             =
        I_CLIENT_NEVER_DISPLAY       = 'X'
          I_INCLNAME                   = v_repid
        I_BYPASSING_BUFFER           =
        I_BUFFER_ACTIVE              =
        changing
          ct_fieldcat                  = i_fldcat_head
       EXCEPTIONS
         INCONSISTENT_INTERFACE       = 1
         PROGRAM_ERROR                = 2
         OTHERS                       = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      if not i_fldcat_head[] is initial.
        loop at i_fldcat_head into wa_fldcat_head.
        case wa_fldcat_head-fieldname.
         when 'RZZKUNNR'.
            wa_fldcat_head-col_pos = '1'.
            wa_fldcat_head-ref_tabname = ' '.
            wa_fldcat_head-seltext_m  = 'Customer No'(020).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '12'.
         when 'NAME1'.
            wa_fldcat_head-col_pos = '2'.
            wa_fldcat_head-seltext_m  = 'Customer Name'(021).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '35'.
         when 'BELNR'.
            wa_fldcat_head-col_pos = '3'.
            wa_fldcat_head-seltext_m  = 'Invoice No'(008).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '12'.
            wa_fldcat_head-KEY       = ' '.
         when 'BLDAT'.
            wa_fldcat_head-col_pos = '4'.
            wa_fldcat_head-seltext_m  = 'Document Date'(009).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '13'.
            wa_fldcat_head-ref_tabname = ' '.
         when 'RZZ_EBELN'.
            wa_fldcat_head-col_pos = '5'.
            wa_fldcat_head-seltext_m  = 'PO.Ref.No'(010).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '13'.
            wa_fldcat_head-ref_tabname = ' '.
         when 'HSL'.
            wa_fldcat_head-col_pos = '6'.
            wa_fldcat_head-seltext_m  = 'Invoice Amount'(011).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'DUE_DATE'.
            wa_fldcat_head-col_pos = '7'.
            wa_fldcat_head-seltext_m  = 'Due Date'(012).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '12'.
            wa_fldcat_head-ref_tabname = ' '.
         when 'DUE_DAYS'.
            wa_fldcat_head-col_pos = '8'.
            wa_fldcat_head-seltext_m  = 'Due Days'(013).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '9'.
         when 'NOT_DUE'.
            wa_fldcat_head-col_pos = '9'.
            wa_fldcat_head-seltext_m  = 'Not Due'(014).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_0_30'.
            wa_fldcat_head-col_pos = '10'.
            wa_fldcat_head-seltext_m  = '0 To 30'(015).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_31_60'.
            wa_fldcat_head-col_pos = '11'.
            wa_fldcat_head-seltext_m  = '31 To 60'(016).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_61_90'.
            wa_fldcat_head-col_pos = '12'.
            wa_fldcat_head-seltext_m  = '61 To 90'(017).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_91_180'.
            wa_fldcat_head-col_pos = '13'.
            wa_fldcat_head-seltext_m  = '91 To 180'(018).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
         when 'BUCK_180'.
            wa_fldcat_head-col_pos = '14'.
            wa_fldcat_head-seltext_m  = 'Beyond 180'(019).
            wa_fldcat_head-ddictxt = 'M'.
            wa_fldcat_head-outputlen = '16'.
            wa_fldcat_head-do_sum = 'X'.
        when 'DOCNR'.
            wa_fldcat_head-no_out = 'X'.
        when 'REFDOCNR'.
            wa_fldcat_head-no_out = 'X'.
        when 'DOC_DATE'.
            wa_fldcat_head-no_out = 'X'.
        when 'FOUND'.
            wa_fldcat_head-no_out = 'X'.
         endcase.
         modify i_fldcat_head from wa_fldcat_head index sy-tabix.
        endloop.
      endif.
    endform.                    " GENERATE_FIELD_CATALOG_CUST
    *&      Form  get_events_customer
          Getting ALV Events
    form get_events_customer.
        call function 'REUSE_ALV_EVENTS_GET'
      EXPORTING
        I_LIST_TYPE           = 0
       importing
         et_events             = i_events
      exceptions
        list_type_wrong       = 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.
      if not i_events[] is initial.
       read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
       wa_event-form = 'GENERATE_USERCOMMAND_CUST'.
       modify i_events from wa_event index sy-tabix.
       read table i_events into wa_event with key na

  • Regarding ALV total

    Hi All,
    I have 2 alvs. Where in each one of them, the total is calculated for one of the fields by using the standard ALV total functionality.
    I need to show the grand total of these two.
    I could not find any method to get the total of that given field of a ALV. We are able to set the total. How to read the total being calculated by the standard functionality. I have checked the field settings but no method returns the total to avoid the looping for these 2 tables to calculate the total.
    Is there any way to get the total caclaulted by the standard functionality for that field.
    Regards,
    Lekha.

    No option found. Wish to see this feature in next release.

  • How to remove the ALV Statistics option from Accounts user's userids

    Dear Sir/Madam,
    In our Accounts department each time one extra page is comming out. When the ALV Statistics option is make Unchecked, then it funtioninng normally that is, single page is comming out.
    Is there any way to make this option permanently Unchecked ? If possible please advice and also whether there will be any unwanted implications of it ?
    Please advice.
    Thanks and Regards,
    Pranab

    Option 1 - Use SAP Report RSPRIPARADMIN you can set this for all users
    Option 2  - user parameter SP01_FROM   0000000002 - This means print job will start from page 2
    Option 3 - List -> Print -> click to properties button in print window -> expend cover sheets -> double click on ALV statistics , now uncheck the ALV statistics check box . now click on setting button and click on copy setting button
    Edited by: Savo on Jul 1, 2011 4:06 PM

  • Total option in REUSE_ALV_LIST_DISPLAY

    Hi,
    If we CHECK total option in REUSE_ALV_LIST_DISPLAY we get a total of numeric value with yellow color at the bottom.
    Requirement:
    Let say I have 3 line item records in the display, with 20 fields and one amount field. So I get the total of the amount field. Apart from that I want the Total number of LINE ITEMS to get displayed on that line. Is that possible . How?
    Thanks in Advance.

    Hi Mohan Kumar,
              I think this is not possible using the total option in REUSE_ALV_LIST_DISPLAY. A small shortcut is to provide another field called line item number (Populate with number 1) and use the sort parameter for the FM.Populate the sort table with the key fields of header and pass it to the FM 'REUSE_ALV_LIST_DISPLAY'.
    If U dont want to see the item number also then U need to use the FM 'REUSE_ALV_FIELDCATALOG_MERGE'. Fill the first table with the Header data 2nd table with the item details and the 3rd table with the totals.

  • How to read ALV Total

    Hi Experts,
                     Am using ALV to calculate total for my field, now my req is i have to read that grand total value into a variable and store it in my ztable..please let me know how to read grand total which am displaying to user .
    Regards
    Syed

    Hi,
    The ALV Total will internally be calculated and stored in internal table 't_measure' attribute of method DO_AGGREGATION in class CL_SALV_WD_SERVICE_MANAGER.
    There is no provision to retrieve this value( unless you enhance the mentioned class and store the value in some shared object). Even the Total value will be calculating by looping the internal table in the mentioned method.
    So , remove the aggregation and calculate the total manually by looping the Internal table in your View controller and store it.
    Hope this helps u,
    Regards,
    Kiran

  • ALV totals row ,should not download in EXCEL

    Hello ,
                  I have developed a ALV report with subtotals.
    In the output, it will display an extra row with the Grand total, but when we try to downalod into Local PC excel file,
    it is downlaoding the totals row also. But the requirement is not to download that.
    Any option is there to not to downlad that row ?
    Let me know if anything needed.
    Thanks,
    AV

    Hi,
    I will suggest one thing.
    <li>Define layout structure
    DATA: wa_layout type SLIS_LAYOUT_ALV.
    <li>One checkbox on selection-screen for with or without total line.
    PARAMETERS: p_check AS CHECKBOX.
    <li>Now set the below on based on checkbox value
    IF p_check = 'X'. "Lets say without total line.
    wa_layout-no_totalline = 'X'.
    ENDIF.
    <li>Now pass wa_layout through REUSE* function module.
    Thanks
    Venkat.O

  • ALV Total and Percentage

    Hi,
    In my ALV report,I have 4 fields
    matnr
    maktx
    menge1
    menge2
    In the end of report (column of menge1), i want only total
             end of menge2 i want the value in percentage as  = (Total of menge2 / total of menge1) * 100
    I am using Fm : Reuse_alv_grid_display.
    Can anybody suggest me how to do.
    Thanks
    Kumar

    Use the following code in a PBO module (after set for first display) or in an adequate event handler.
    data: total type ref to data,
          subtotal1 type ref to data.
    field-symbols: <total> like gt_sflight,
                   <subtotal1> like gt_sflight.
    call method grid1->get_subtotals
      importing
        ep_collect00 = total
        ep_collect01 = subtotal1.
    assign total->* to <total>.
    assign subtotal1->* to <subtotal1>.
    Then update the <total> internal tables.
    Look at [ALV Grid Control (BC-SRV-ALE)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf]
    NB: If you add a last row to the report, don't forget to disable sort options in the ALV menu.
    Regards

  • ALV totals separated by currency type

    Hi, I´m using ALV non OO, I need to totalize the amount NETWR but I have many currencies, so I need to separete it by USD, VEB, EUR...
    So at the end of the alv I will have something like this:
    USD          1220,00
    EUR            200,30
    GBP            120,35
    VEB       100000,00
    I use the fieldcat-DO_SUM to totalize but it gets all cell and dont separate by currency.
    I use too ls_sort-subtot, this show the subtotals down each money type but the total it's still global, not separated.
    Help...
    Daniel

    If the subtotal option works for you and you just don't want to see the grand totals line, set the WS_LAYOUT-NO_TOTALLINE = 'X'. This should give you the subtotal by currency types but no grand totals of all the records.
    BTW, the subtotal option can be done by setting WS_SORT-SUBTOT = 'X' for the field you want to subtotal by.
    Please reward points if helpful.
    Regards,
    Minami
    Message was edited by:
            Minami Akana

  • ALV Filter Option

    Dear All
            I written a program using ALV in which i can get only 10 characters but i want all characters in the field what settings i should do in ALV or in anything else.
    Thanks and Regards
    Suresh

    hi Vasu
    thanks for ur ealist reply
    my coding  following
    wht i can change
    REPORT  z_gldetail_withoutpo LINE-SIZE 175 LINE-COUNT 30.
    TABLES:  ekko,
             ekpo,
             rbkp,
             lfa1,
             rseg,
             skat,
             bkpf,
             bseg.
    TYPE-POOLS slis.
    DATA:  BEGIN OF it_lfa OCCURS 0,
           lifnr LIKE lfa1-lifnr,
           name1 LIKE lfa1-name1,
           ORT01 like lfa1-ORT01,
           STRAS like lfa1-STRAS,
           END OF it_lfa.
    data:  begin of it_cin occurs 0,
           lifnr LIKE J_1IMOVEND-lifnr,
           J_1ICSTNO like J_1IMOVEND-J_1ICSTNO,
           J_1ILSTNO LIKE J_1IMOVEND-J_1ILSTNO,
           end of it_cin.
    for update all data - ALV use
    data: begin of FinnalTbl,
          belnr like bkpf-belnr,
         bldat like bkpf-bldat,
          bldat(10) type c ,
          xblnr like bkpf-xblnr,
          wrbtr like bseg-wrbtr,
          dmbtr like bseg-dmbtr,
          lifnr like bseg-lifnr,
         MENGE like bseg-MENGE, qty
          l_MEINS like bseg-MEINS, uom
         land1 like LFA1-LAND1,
          regio like LFA1-REGIO,
          stceg like LFA1-stceg,
          NAME1 like lfa1-NAME1,
           count(5),
           perval type p decimals 2,
           vatamt type p decimals 2,
           ttlval type p decimals 2,
           linevalue type p decimals 2,
           tgjAHR like bseg-gjAHR,
           STRAS  like LFA1-STRAS,
           ORT01 like LFA1-ORT01,
           BKTXT LIKE BKPF-BKTXT,
           BilValue type p decimals 2,
           VatPer type p decimals 2,
           ZUONR like bseg-ZUONR,   "Qty
           holdtax type p decimals 2,
          docdate like bkpf-bldat,
          end of FinnalTbl.
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          ct_catalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    for new ALV
    *TYPE-POOLS slis.
    *DATA: afield TYPE slis_fieldcat_alv.
    *DATA: fieldcat TYPE slis_t_fieldcat_alv.
    *DATA: gd_layout    TYPE slis_layout_alv.
    DATA : BEGIN OF wa_ven_inv,
           l_belnr like bkpf-belnr,
           lifnr LIKE rbkp-lifnr,
           name1 LIKE lfa1-name1,
           ORT01 like lfa1-ORT01,
           STRAS like lfa1-STRAS,
           J_1ICSTNO like J_1IMOVEND-J_1ICSTNO,
           J_1ILSTNO LIKE J_1IMOVEND-J_1ILSTNO,
           kalsb like tmkkt-kalsb,
           l_budat like bkpf-budat,
           l_bldat like bkpf-bldat,
           l_xblnr like bkpf-xblnr,
           l_menge LIKE bseg-menge,
           l_lifnr like bseg-lifnr,
           l_hkont like bseg-hkont,
           l_sgtxt like bseg-sgtxt,
           l_wrbtr like bseg-wrbtr,
           l_dmbtr like bseg-dmbtr,
           l_matnr like bseg-matnr,
           l_pswsl like bseg-pswsl,
           l_vbel2 like bseg-vbel2,
           l_MEINS like bseg-MEINS,
           gldsc like skat-txt50,
           ll_dmbtr like bseg-dmbtr,
           ll_per  type p decimals 2,
           TotalV like bseg-dmbtr,
          l_tmpcountryc like LFA1-LAND1,
          l_tmpregc     like LFA1-REGIO,
          l_STCEG    like LFA1-STCEG,
          l_tmpcountry like T005T-LANDX50,
          l_tmpreg     like T005U-BEZEI,
          l_tmpunitmea like rseg-BSTME,
          l_BKTXT like bkpf-BKTXT,
          l_GSBER like bseg-GSBER,
            qsskz like bseg-qsskz,  "With Holding Tax
          END OF wa_ven_inv.
    data: begin of wa_bkpf,
          l_belnr like bkpf-belnr,
          l_budat like bkpf-budat,
          l_bldat like bkpf-bldat,
          l_xblnr like bkpf-xblnr,
          l_hkont like bseg-hkont,
          l_sgtxt like bseg-sgtxt,
          l_wrbtr like bseg-wrbtr,
          l_dmbtr like bseg-dmbtr,
          l_lifnr like bseg-lifnr,
          l_matnr like bseg-matnr,
          l_MENGE like bseg-MENGE,
          l_pswsl like bseg-pswsl,
          l_shkzg like bseg-shkzg,
          l_bschl like bseg-bschl,
          l_buzid like bseg-buzid,
          l_vbel2 like bseg-vbel2,
          l_MEINS like bseg-MEINS,
          l_tmpcountryc like LFA1-LAND1,
          l_tmpregc     like LFA1-REGIO,
          l_tmpcountry like T005T-LANDX50,
          l_tmpreg     like T005U-BEZEI,
          l_tmpunitmea like rseg-BSTME,
          l_BKTXT      like bkpf-BKTXT,
          l_GSBER   like bseg-GSBER,
          qsskz like bseg-qsskz,  "With Holding Tax
          tmpsisn like bseg-SHKZG,
          tmpsisn1 like bseg-SHKZG,
          postkey like bseg-bschl,
          docdate(10) type c,
          end of wa_bkpf.
    data : gd_awkey type awkey,
           gltxt type skat-txt50,
           vetxt type lfa1-name1,
           t_kalsk like lfm1-kalsk,
           t_KALSB like tmkkt-kalsb,
           podat(10),
           glpdt(10),
           glddt(10),
           accno(15),
           accyr(4),
           tmpGlNum(15),
           docvl type p decimals 2,
           venam like bseg-lifnr,
           gltot(15) type p decimals 2,
           tebeln like bseg-ebeln,
           tebelp like bseg-ebelp,
           tgjahr like bseg-gjahr,
           tbelnr like bkpf-belnr,
           invnum like rbkp-belnr,
           CSTNO like J_1IMOVEND-J_1ICSTNO,
           LSTNO LIKE J_1IMOVEND-J_1ILSTNO,
           HDMBTR like bseg-DMBTR,
           balDMBTR like bseg-dmbtr,
           peramt type p decimals 2,
           Pamt type p decimals 2,
           MENGE  type bseg-MENGE,
           MEINS type bseg-MEINS,
           TMENGE  type bseg-MENGE,
           count(5),
           VatPer type p decimals 2,
           tempPer type p decimals 2,
           perval type p decimals 2,
           vatamt type p decimals 2,
           ttlval type p decimals 2,
           tmpsisn like bseg-SHKZG,
           tmpsisn1 like bseg-SHKZG,
           linevalue type p decimals 2.
    DATA: it_sortcat   TYPE slis_sortinfo_alv OCCURS 1,
          wa_sort LIKE LINE OF it_sortcat.
    data: it_bkpf like bkpf occurs 0 with header line,
          it_bseg like bseg occurs 0 with header line,
          it_rbkp like rbkp occurs 0 with header line.
    DATA: in_bkpf like wa_bkpf occurs 0 with header line,
          it_ven_inv LIKE wa_ven_inv OCCURS 0 WITH HEADER LINE,
           finaltbl LIKE FinnalTbl OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN : BEGIN OF BLOCK B WITH FRAME TITLE text-002.
    parameters       : ekorg like LFM1-ekorg obligatory,
                       GJAHR like BKPF-GJAHR obligatory.
    select-options   : Dtype for RBKP-BLART.
    SELECTION-SCREEN : END OF BLOCK B.
    selection-screen : begin of block D with frame title text-004.
    parameters       : glnum like skat-saknr obligatory.
    select-options   : gldat for BKPF-budat,
                       dodat for BKPF-BLDAT.
    selection-screen : end of block D.
    tmpGlNum = glnum.
    START-OF-SELECTION.
    tmpglnum = tmpglnum+4(6).
    count = 0.
      Main Loop (Header Table) -  ForGet Account Doc No
    select belnr budat bldat xblnr BKTXT from bkpf
         into (in_bkpf-l_belnr, in_bkpf-l_budat, in_bkpf-l_bldat,
         in_bkpf-l_xblnr,in_bkpf-l_BKTXT)
            where blart in dtype and bukrs eq 'NCCP'
              and budat in gldat and BLDAT in dodat and
                   gjahr eq GJAHR  order by belnr.
    clear: vatamt, linevalue, in_bkpf-l_dmbtr, Finaltbl-BilValue,
    finaltbl-holdtax, in_bkpf-l_lifnr.
    Sub Loop - for get Values in Item Table
    bschl is posting key
    31 - for get bill value - RE & KR Regular entry
    21 - for get bill value - RE Reverse entry
    22 - for get bill value - KA (this KA is reversed entry key for KR.)
      select GJAHR hkont menge dmbtr BUZID shkzg qsskz from bseg
        into (tgjAHR, in_bkpf-l_hkont, in_bkpf-l_menge,
            in_bkpf-l_dmbtr, in_bkpf-l_BUZID,
              in_bkpf-l_shkzg, in_bkpf-qsskz)
        where belnr = in_bkpf-l_belnr and
            bukrs eq 'NCCP' and gjahr eq gjahr and
            qsskz eq space and
          ( bschl ne '31' and bschl ne '21' and bschl ne '22' ).
    for give negative symbol
         if in_bkpf-l_shkzg = 'S'.
            it_ven_inv-l_dmbtr = in_bkpf-l_dmbtr.
         endif.
         if in_bkpf-l_shkzg = 'H'.
           it_ven_inv-l_dmbtr = - in_bkpf-l_dmbtr.
         endif.
    *for convert GL Account number in 6 charcter
         in_bkpf-l_hkont = in_bkpf-l_hkont+4(6).
    for get VAT & Line Value
          if in_bkpf-l_hkont = tmpglnum.
             vatamt = vatamt + it_ven_inv-l_dmbtr.
          elseif in_bkpf-l_hkont ne  tmpglnum.
              linevalue = linevalue + it_ven_inv-l_dmbtr.
           endif.
    *for get withholding tax amount
    *Sub Loop1A - For get Bill total value + withholding tax value
    select  dmbtr SHKZG from bseg into
    (finaltbl-holdtax, in_bkpf-tmpsisn)
      where belnr = in_bkpf-l_belnr and
         bukrs eq 'NCCP' and   gjahr eq gjahr and
        qsskz ne space and
        ( bschl ne '31' or bschl ne '21' or bschl ne '22' ).
    for give negative symbol to withholding tax Value
    for display bill value in positive value here sigh changed
         if in_bkpf-tmpsisn = 'S'.
             Finaltbl-holdtax  = - Finaltbl-holdtax .
         endif.
         if in_bkpf-tmpsisn = 'H'.
           Finaltbl-holdtax  =  Finaltbl-holdtax .
         endif.
    endselect.
    *sub Loop1A Ended
       endselect.
    *Sub Loop Ended
    Sub Loop1 - For get Vendor  Code
    clear in_bkpf-postkey .
    clear in_bkpf-l_lifnr.
    select bschl from bseg into in_bkpf-postkey
      where belnr = in_bkpf-l_belnr and bukrs eq 'NCCP'
          and   gjahr eq gjahr .
    if in_bkpf-postkey = '31'.
      select lifnr  into in_bkpf-l_lifnr from bseg   where
          bschl = '31' and belnr = in_bkpf-l_belnr  .
      endselect.
    endif.
    if in_bkpf-postkey = '21'.
      select lifnr  into in_bkpf-l_lifnr from bseg   where
          bschl = '21' and belnr = in_bkpf-l_belnr  .
      endselect.
    endif.
    if in_bkpf-postkey = '22'.
      select lifnr  into in_bkpf-l_lifnr from bseg   where
          bschl = '22' and belnr = in_bkpf-l_belnr  .
      endselect.
    endif.
    endselect.
    select lifnr  into in_bkpf-l_lifnr from bseg   where
        ( bschl = '31' or bschl = '21' or bschl = '22' )
            and belnr = in_bkpf-l_belnr  .
    *Sub Loop2 - for select vendor details
      if in_bkpf-l_lifnr ne space.
       select regio stceg land1 NAME1 ORT01 STRAS into
          (FinalTbl-regio, FinalTbl-stceg, FinalTbl-land1,
              FinalTbl-name1, FinalTbl-ORT01, FinalTbl-STRAS)
                 from lfa1 where lifnr =  in_bkpf-l_lifnr.
    for get VAT percentage, VAT and Line Value Total
       if vatamt ne 0 and linevalue ne 0 .
          perval = vatamt / linevalue * 100.
          ttlval = vatamt + linevalue.
       endif .
    *assign VAT Percentage 4 & 12.5 to check 100% value for VAT.
      if perval >= 2 and perval <= 6.
        tempPer = 4.
      endif .
      if perval >= 10 and perval <= 14 .
        tempPer = 125 / 10.
      endif  .
      if vatamt ne 0 and tempPer ne 0.
        vatper = vatamt * ( 100 / tempPer ).
      endif.
    endselect.
    endif.
    Sub Loop2 Ended
    endselect.
    *Sub Loop1 Ended
    *Sub Loop3 - For get Bill Value -
    select dmbtr ZUONR SHKZG from bseg into
    (Finaltbl-BilValue, Finaltbl-ZUONR, in_bkpf-tmpsisn1)
      where belnr = in_bkpf-l_belnr and bukrs eq 'NCCP'
          and   gjahr eq gjahr and
            ( bschl = '31' or bschl = '21' or bschl = '22' ).
    for assign negative symbol to Bill Value
    for display bill value in positive value here sigh changed
         if in_bkpf-tmpsisn1 = 'S'.
            Finaltbl-BilValue  = - Finaltbl-BilValue .
         endif.
         if in_bkpf-tmpsisn1 = 'H'.
           Finaltbl-BilValue  =  Finaltbl-BilValue .
         endif.
    endselect.
    *sub Loop3 Ended
    Finaltbl-BilValue = Finaltbl-BilValue + Finaltbl-holdtax.
    concatenate in_bkpf-l_bldat+6(2) '/'
                    in_bkpf-l_bldat+4(2) '/'
                    in_bkpf-l_bldat(4) into  wa_bkpf-docdate.
    *Move To Temp Table
    if vatamt ne 0.   " for avoid 0 values
       count = count + 1.
       FinalTbl-count = count.
       FinalTbl-belnr = in_bkpf-l_belnr.
      FinalTbl-bldat = in_bkpf-l_bldat.
       FinalTbl-bldat = wa_bkpf-docdate.
       FinalTbl-vatamt = vatamt.
       FinalTbl-linevalue = linevalue.
       FinalTbl-perval = perval.
       FinalTbl-ttlval = ttlval.
       FinalTbl-lifnr = in_bkpf-l_lifnr.
       FinalTbl-regio = FinalTbl-regio.
       FinalTbl-stceg = FinalTbl-stceg.
       FinalTbl-land1 = FinalTbl-land1.
       FinalTbl-name1 = FinalTbl-name1.
       finaltbl-tgjAHR  = tgjAHR.
       FinalTbl-ORT01 = FinalTbl-ORT01.
       FinalTbl-STRAS = FinalTbl-STRAS.
       FinalTbl-xblnr = in_bkpf-l_xblnr.
       FinalTbl-BKTXT = in_bkpf-l_BKTXT.
       Finaltbl-BilValue =  Finaltbl-BilValue.
       Finaltbl-vatper = vatper.
       Finaltbl-ZUONR = Finaltbl-ZUONR.
       append finalTbl.
       endif.
       clear in_bkpf-l_lifnr.
       clear FinalTbl-name1.
       clear FinalTbl-STRAS.
    clear:  Finaltbl-BilValue.
    endselect.
    *Main Loop Ended
    *coding for ALV
        PERFORM build_sortcat.
        PERFORM build_catalog.
        PERFORM build_layout.
        PERFORM disply.
    *&      Form  TOP_OF_PAGE
          LOGO
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
               I_LOGO             = 'ENJOYSAP_LOGO'
                IT_LIST_COMMENTARY = SLIS_EV_TOP_OF_PAGE.
    ENDFORM.
    *&      Form  Display_Header
          text
    FORM disply.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         i_program_name              = gd_repid
       CHANGING
         ct_fieldcat                 = ct_catalog[]
       EXCEPTIONS
         OTHERS                       = 3
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                =  gd_repid
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         is_layout                         =  gd_layout
         it_fieldcat                       = fieldcatalog[]
         it_sort                           = it_sortcat[]
         i_save                            = 'X'
        TABLES
          t_outtab                          = FinalTbl
      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.                    "disply
    *&      Form  build_layout
          text
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    ENDFORM.                    "build_layout
    *&      Form  Build_catalog
          text
    FORM build_catalog.
      fieldcatalog-col_pos  = 1.
      fieldcatalog-fieldname = 'COUNT'.
      fieldcatalog-seltext_m = 'S.No'.
       APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'LIFNR'.
      fieldcatalog-seltext_m = 'Vendor Code'.
      fieldcatalog-col_pos  = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'NAME1'.
      fieldcatalog-seltext_m = 'Vendor Name'.
      fieldcatalog-seltext_m = 'Vendor'.
    lfa1
      fieldcatalog-ref_fieldname = 'LFA1~NAME1'.
      fieldcatalog-col_pos  = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'STRAS'.
      fieldcatalog-seltext_m = 'Address'.
      fieldcatalog-col_pos  = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'ORT01'.
      fieldcatalog-seltext_m = 'Place'.
      fieldcatalog-col_pos  = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'REGIO'.
      fieldcatalog-seltext_m = 'State'.
      fieldcatalog-col_pos  = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'STCEG'.
      fieldcatalog-seltext_m = 'Tin No'.
      fieldcatalog-col_pos  = 7.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'LAND1'.
      fieldcatalog-seltext_m = 'Country'.
      fieldcatalog-col_pos  = 8.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'BELNR'.
      fieldcatalog-seltext_m = 'Doc Acc No'.
      fieldcatalog-col_pos  = 9.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'BLDAT'.
      fieldcatalog-seltext_m = 'Doc Date'.
      fieldcatalog-col_pos  = 10.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'XBLNR'.
      fieldcatalog-seltext_m = 'Doc Ref No'.
      fieldcatalog-col_pos  = 11.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BKTXT'.
      fieldcatalog-seltext_m = 'Material'.
      fieldcatalog-col_pos  = 12.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'ZUONR'.
      fieldcatalog-seltext_m = 'Quantity/Uom'.
      fieldcatalog-col_pos  = 13.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'VATAMT'.
      fieldcatalog-seltext_m = 'VAT'.
      fieldcatalog-col_pos  = 14.
      fieldcatalog-do_sum = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'LINEVALUE'.
      fieldcatalog-seltext_m = 'Value'.
      fieldcatalog-col_pos  = 15.
      fieldcatalog-do_sum = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'PERVAL'.
      fieldcatalog-seltext_m = '%'.
      fieldcatalog-col_pos  = 16.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'TTLVAL'.
      fieldcatalog-seltext_m = 'Total Value'.
      fieldcatalog-col_pos  = 17.
      fieldcatalog-do_sum = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'BILVALUE'.
      fieldcatalog-seltext_m = 'Bill Value'.
      fieldcatalog-col_pos  = 18.
      fieldcatalog-do_sum = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'VATPER'.
      fieldcatalog-seltext_m = '100% Value'.
      fieldcatalog-col_pos  = 19.
      fieldcatalog-do_sum = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
    ENDFORM.                    "Build_catalog
    *&      Form  build_sortcat
          text
    FORM build_sortcat .
    ENDFORM.                    " build_sortcat
    *&      Form  USER_COMMAND
          text
         -->GUCOMM     text
         -->G_SELFIELD text
    FORM user_command USING
    gucomm TYPE sy-ucomm g_selfield TYPE slis_selfield.
    READ TABLE   FinalTbl  INTO  FinalTbl  INDEX
    g_selfield-tabindex.
    case g_selfield-fieldname.
      when 'BELNR'.
        SET PARAMETER ID 'BLN' FIELD FinalTbl-belnr.
        SET PARAMETER ID 'BUK' FIELD 'NCCP'.
        SET PARAMETER ID 'GJR' FIELD FinalTbl-tGJAHR.
        CALL TRANSACTION 'FB03' AND  SKIP FIRST SCREEN.
    ENDCASE.
    ENDFORM.                    "USER_COMMAND

  • ALV - Total text

    hai
      i done alv report with total and subtotal , but the text for the total and subtotal
    which iam specified in layout are not displayed in a report.
    plz help me..

    hi,
    *& Report  Z_REPT_ALV_EX1                                         *
    report  ZALV_GEN   line-count 36(5)
                                line-size 225
                                no standard page heading.
    Report name:  Puchase Order Report for ALV practice                  *
    Program ID :  Z_REPT_ALV_EX1_TG                                      *
    Author     :  ADCDEV ( T G Santosh )                                 *
    Date       :  Sep 09, 2004                                           *
    *..Type Definitions for ALV Report
    type-pools slis.
                         Tables Declaration
    tables : lfa1,
             lfb1,
             lfm1.
                         Data Declaration
    data : v_lifnr like lfa1-lifnr,
           v_bukrs like lfb1-bukrs,
           v_ekorg like lfm1-ekorg,
           v_ktokk like lfa1-ktokk,
           v_repid like sy-repid.
                         Internal Tables
    data : begin of it_details occurs 0,
             lifnr like lfa1-lifnr,
             bukrs like lfb1-bukrs,
             ekorg like lfm1-ekorg,
             ktokk like lfa1-ktokk,
             name1 like lfa1-name1,
             stras like lfa1-stras,
             ragio like lfa1-regio,
             pfach like lfa1-pfach,
             pstl2 like lfa1-pstl2,
             pstlz like lfa1-pstlz,
             telf1 like lfa1-telf1,
          end of it_details.
    data: it_fieldcatalog  type slis_t_fieldcat_alv,
          it_fieldcatalog1  type slis_t_fieldcat_alv,
          wa_fieldcatalog  type slis_fieldcat_alv,
          wa_layout              type slis_layout_alv,
          it_events              type slis_t_event,
          wa_events              type slis_alv_event,
          it_sort  type  slis_t_sortinfo_alv,
          wa_sort  type  slis_sortinfo_alv occurs 0 with header line.
                         Initialization
    v_repid = sy-repid.
                         Selecton Screen
    selection-screen begin of block blk1 with frame title text-001.
    select-options : s_lifnr for lfa1-lifnr,
                     s_bukrs for lfb1-bukrs,
                     s_ekorg for lfm1-ekorg,
                     s_ktokk for lfa1-ktokk.
    selection-screen end of block blk1.
    selection-screen begin of block blk2 with frame title text-002.
    parameter : block radiobutton group g1,
                grid  radiobutton group g1.
    selection-screen end of block blk2.
                         At Selecton Screen
    select single lifnr
           from lfa1
           into v_lifnr
           where lifnr in s_lifnr.
    if sy-subrc <> 0.
      message i101(zsantosh) with 'v_lifnr' .
    write : 'not a valid number', v_lifnr.
    else.
      select single bukrs
             from lfb1
             into v_bukrs
             where bukrs in s_bukrs.
      if sy-subrc <> 0.
        message i101(zsantosh) with 'Company Code'.
      else.
        select single ekorg
               from lfm1
               into v_ekorg
               where ekorg in s_ekorg.
        if sy-subrc <> 0.
          message i101(zsantosh) with 'Purchasing Organisation'.
        else.
          select single ktokk
                 from lfa1
                 into v_ktokk
                 where ktokk in s_ktokk.
          if sy-subrc <> 0.
            message i101(zsantosh) with 'Vendor Group'.
          endif.
        endif.
      endif.
    endif.
                         Start of Selection
    start-of-selection.
      select a1~lifnr
             b1~bukrs
             m1~ekorg
             a1~ktokk
             a1~name1
             a1~stras
             a1~regio
             a1~pfach
             a1~pstl2
             a1~pstlz
             a1~telf1
           into table it_details
           from lfa1 as a1
           join lfb1 as b1 on a1lifnr = b1lifnr
           join lfm1 as m1 on a1lifnr = m1lifnr
           where a1~lifnr in s_lifnr and
                 b1~bukrs in s_bukrs and
                 m1~ekorg in s_ekorg and
                 a1~ktokk in s_ktokk.
      clear wa_sort.
      wa_sort-spos      = 1.
      wa_sort-fieldname = 'LIFNR'.
      wa_sort-tabname   = 'IT_DETAILS'.
      wa_sort-up        = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-spos      = 2.
      wa_sort-fieldname = 'BUKRS'.
      wa_sort-tabname   = 'IT_DETAILS'.
      wa_sort-up      = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-spos      = 3.
      wa_sort-fieldname = 'EKORG'.
      wa_sort-tabname   = 'IT_DETAILS'.
      wa_sort-up        = 'X'.
      append wa_sort to it_sort.
                         End of selection
    end-of-selection.
      perform fill_fieldcat.
      loop at it_fieldcatalog into wa_fieldcatalog.
        if wa_fieldcatalog-fieldname = 'RAGIO'.
          wa_fieldcatalog-intlen = 2.
          wa_fieldcatalog-ref_fieldname = ''.
          wa_fieldcatalog-ref_tabname = ''.
          wa_fieldcatalog-ddic_outputlen = 2.
        endif.
        wa_fieldcatalog-ref_fieldname = ''.
        wa_fieldcatalog-ref_tabname = ''.
        modify it_fieldcatalog from wa_fieldcatalog.
      endloop.
      perform fill_layout.
      if block = 'X'.
        perform list_block_display.
      elseif grid = 'X'.
        perform list_grid_display.
      endif.
    *&      Form  FILL_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    form fill_fieldcat .
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       exporting
         i_program_name               = v_repid
         i_internal_tabname           = 'IT_DETAILS'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
         i_inclname                   = v_repid
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
        changing
          ct_fieldcat                  = it_fieldcatalog
    exceptions
       inconsistent_interface       = 1
       program_error                = 2
       others                       = 3
      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.                    " FILL_FIELDCAT
    *&      Form  FILL_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    form fill_layout .
      wa_layout-zebra = 'X'.
      wa_layout-totals_text = 'TOTAL'.
      wa_layout-colwidth_optimize = 'X'.
    endform.                    " FILL_LAYOUT
    *&      Form  list_block_display
          text
    -->  p1        text
    <--  p2        text
    form list_block_display .
      call function 'REUSE_ALV_BLOCK_LIST_INIT'
        exporting
          i_callback_program             = v_repid
        I_CALLBACK_PF_STATUS_SET       = ' '
        I_CALLBACK_USER_COMMAND        = ' '
        IT_EXCLUDING                   =
      call function 'REUSE_ALV_BLOCK_LIST_APPEND'
        exporting
        is_layout                        = wa_layout
        it_fieldcat                      = it_fieldcatalog
        i_tabname                        = 'IT_DETAILS'
        it_events                        = it_events
        it_sort                          = it_sort
      I_TEXT                           = ' '
        tables
          t_outtab                         = it_details
       exceptions
         program_error                    = 1
         maximum_of_appends_reached       = 2
         others                           = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK             = ' '
      IS_PRINT                      =
      I_SCREEN_START_COLUMN         = 0
      I_SCREEN_START_LINE           = 0
      I_SCREEN_END_COLUMN           = 0
      I_SCREEN_END_LINE             = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER       =
      ES_EXIT_CAUSED_BY_USER        =
       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_block_display
    *&      Form  LIST_GRID_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form list_grid_display .
      call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
         i_structure_name                  = 'IT_DETAILS'
      I_BACKGROUND_ID                   = ' '
         i_grid_title                      = 'DETAILS IN GRID DISPLAY'
      I_GRID_SETTINGS                   =
       is_layout                         = wa_layout
         it_fieldcat                       = it_fieldcatalog
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
       it_sort                           = it_sort
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      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
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = it_details
       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_GRID_DISPLAY
    regards,
    deepthi reddy

  • Runtime Error in ALV Totaling.

    Dear Friends
    i am getting run time error in ALV while pressing sum button.
    my alv code as follows
      FIELDCATALOG-FIELDNAME   = 'DMBTR'.
      FIELDCATALOG-SELTEXT_M   = 'Amount'.
      FIELDCATALOG-COL_POS     = 1.
    FIELDCATALOG-ref_fieldname = 'WAERS'.
    FIELDCATALOG-DO_SUM      = 'X'.        "Display column total
    FIELDCATALOG-ref_tabname = 'BKPF'.
    FIELDCATALOG-DATATYPE     = 'CURR'.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
    I have tried all possibilities but did not get the solution...
    if anything left let me know
    thank you
    Avirat Patel

    Dear Ravi
    Thank you .. i am able to trace out my problem
    the problem with this code
    FIELDCATALOG-FIELDNAME   = 'AUGBL'.
    FIELDCATALOG-SELTEXT_M   = 'Clearing Doc.No'.
    FIELDCATALOG-COL_POS     = 1.
    FIELDCATALOG-DO_SUM      = 'X'.        "Display column total
    FIELDCATALOG-DATATYPE     = 'CURR'.
    APPEND FIELDCATALOG TO FIELDCATALOG.
    CLEAR  FIELDCATALOG.
    i am getting an error with this code
    how can i able to display this field in alv column.?
    - Avirat Patel
    *SORRY FRIENDS I HAVE NOT DECLARED MENTIONED VARIABLE IN INTERNAL TABLE ITSELF SO THAT
    I AM GETTING ERROR.*
    problem has been resolved..
    thank you.
    Edited by: Corrtech on Dec 19, 2011 1:05 PM

  • ALV Total and Subtotal in ALV

    Hi,
          I want to display the Total and Subtotal in Alv in Webdynpro Abap, and i am getting this  Error( Access via 'NULL' object reference not possible) and also i have checked the Cardinality also. Please get me a Good Solution.

    I think your node( the node which is binded to data node of alv interface controller ) having collection cardinality of 1:1, if yes, then change it to 0:N,
    i hope this will solve the issue.
    If you still get the error, go to st22, open your error, go down that page (keep pressing pagedown button ), then you will find your code and there find this arrow >>>>> then let me know that code line.
    Regards
    Srinivas

  • ALV Totals and Subtotals line in the output

    Hi!
       I want to display an ALV report in which there should be totals and subtotals buttons are to be displayed without displaying the totals and subtotals line when the list is displayed. It should be displayed only when the user clicks the button. If i take do_sum in the fieldcat table it'll display the subtotal button and also the totlas line and that shouldn't happen. If i take no_totalline in the layout it'll not display the totals line even the user selects the totals button. So is there any possibility like this. Please help me.
    Thanks & Regards,
    Swathi

    Hi Swathi,
              Have a look at these good links-
    <b>Add subtotals</b>
    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
    You can also search for the same in the below links-
    www.sap-img.com
    www.sapfans.com
    www.sapgenie.com
    Reward points if you find the links useful.
    Regards,
    Tanuja.

  • Problem in ALV Filter option

    Hi Experts,
    In the ALV output we are having fields like year,period and plant.If i click on Year or period or plant and then click on filter option in ALV it is giving a select option and then click on the F4 Help in the selection option,it is giving the list of option once i select any one of the value it is displaying(for eg:Year)  as '2004####'.Then if we click ok it is showing error instead of '2004####' it should be '2004' after selection.
    Is there any way to rectify this?????Please reply ASAP.
    Thanks
    Raj.

    Hi
    If it is YEAR (type is GJAHR) .... and passing the value as '2008'.
    Hi Guys,
    Did anyone come across this situation??
    Thanks
    Raj.

Maybe you are looking for

  • How to connect imac to tv using thunderbolt to hdmi cable

    I'm trying to connect my mid 2011 iMac to my tv. I have a thunderbolt to hdmi cable that I purchased. I connected the thunderbolt port to the iMac and connected the hdmi port to the tv. I turned on both devices and the tv is not getting the signal. W

  • Bizarre problem when skipping songs

    Hi everyone, first of all I apologize for my probably poor Engilsh, I'm Italian. I own an old I-Pod classic 30Gb (firmware 1.2.1). It has always worked fine until some days ago. It started behaving in the way I'm going to describe. I always listen to

  • Alter screen field layout in MIRO - Item level

    Dear All, I would like to know whether I can change the field sequence in MIRO transaction at the item level. I want to move the Reference Doc field (GRN No)  next to the item field in MIRO and this needs to be premanent whenever I create a new invoi

  • URL format for direct call to a subpage

    What is the proper URL format to call a subpage rather than the main page? I know that the format for a page is http://<host:port>/pls/<DAD>/url/page/<pagename>, but how do you call a subpage? Also, if this type of information is documented, where sh

  • ActionScript for buttons

    Hello everybody, I am new to flash, and I really don't have much expirience with ActionScript in Flash. Does anyone know what actionscript should I write for opening a new page in the same window? For example, I have allready created my button, and m