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

Similar Messages

  • How to provide hyperlink for a particular field in ALV

    Hi,
      How to provide hyperlink for a particular field in alv report.
    Regards,
    Ramu.

    Yes you can do that. using the fieldcatalog there is an option for that. give HOT_SPOT = 'X'. for the column you want.
    wa_field-hotspot = 'X'.
    REPORT  ztest_alv.
    TYPE-POOLS:slis.
    DATA:it_fieldcat  TYPE  slis_t_fieldcat_alv,
         wa_field LIKE LINE OF it_fieldcat.
    DATA: BEGIN OF it_likp OCCURS 0,
           vbeln TYPE likp-vbeln,
          END OF it_likp.
    DATA: layout TYPE slis_layout_alv.
    wa_field-fieldname = 'VBELN'.
    wa_field-tabname = 'IT_LIKP'.
    wa_field-hotspot = 'X'.
    wa_field-outputlen = 10.
    wa_field-no_zero = 'X'.
    wa_field-seltext_l = 'Sales'.
    APPEND wa_field TO it_fieldcat.
    SELECT vbeln FROM likp
    UP TO 10 ROWS
    INTO TABLE it_likp.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program      = sy-repid
        is_layout               = layout
        i_callback_user_command = 'USER_COMMAND'
        it_fieldcat             = it_fieldcat
      TABLES
        t_outtab                = it_likp
      EXCEPTIONS
        program_error           = 1.
    *&      Form  user_Command
    *       text
    *      -->UCOMM      text
    *      -->SELFIELD   text
    FORM user_command USING ucomm TYPE sy-ucomm
                        selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN '&IC1'.
          SET PARAMETER ID 'VL'  FIELD selfield-value.
          CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                    "user_Command

  • Total for a Numeric field in ALV Grid display

    Hi all,
    I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
    Regards,
    Balavardhan.K

    Check this code for subtotals and totals..
    REPORT ZYFI_REPT007
           NO STANDARD PAGE HEADING
           LINE-SIZE 300
           LINE-COUNT 50
           MESSAGE-ID ZYFI.
    TABLES : COOI, " Commitments Management: Line Items
             LFA1,                         " Vendor master (general section)
             VBEP,
             RKPLN.
          TABLE TYPES AND INTERNAL TABLES                                *
    DATA : BEGIN OF TYP_COOI ,
           OBJNR LIKE COOI-OBJNR,
           SAKTO LIKE COOI-SAKTO,
           MEGBTR LIKE COOI-MEGBTR,
           MEINH LIKE COOI-MEINH,
           WKGBTR LIKE COOI-WKGBTR,
           REFBN LIKE COOI-REFBN,
           RFPOS LIKE COOI-RFPOS,
           SGTXT LIKE COOI-SGTXT,
           BUDAT LIKE COOI-BUDAT,
           LIFNR LIKE COOI-LIFNR,
           END OF TYP_COOI.
    DATA : BEGIN OF TYP_LFA1 ,
            LIFNR LIKE LFA1-LIFNR,
            NAME1 LIKE LFA1-NAME1,
           END OF TYP_LFA1.
    DATA : BEGIN OF IT_OUTTAB OCCURS 0,
             OBJNR LIKE COOI-OBJNR,
             SAKTO LIKE COOI-SAKTO,
             MEGBTR LIKE COOI-MEGBTR,
             MEINH LIKE COOI-MEINH,
             WKGBTR LIKE COOI-WKGBTR,
             REFBN LIKE COOI-REFBN,
             RFPOS LIKE COOI-RFPOS,
             SGTXT LIKE COOI-SGTXT,
             BUDAT LIKE COOI-BUDAT,
             LIFNR LIKE COOI-LIFNR,
             NAME1 LIKE LFA1-NAME1,
           END OF IT_OUTTAB.
    DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
           IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
    *-- ALV Declarations
    TYPE-POOLS SLIS.
    DATA: IT_EVENTS            TYPE SLIS_T_EVENT,
          GS_EVENT             TYPE SLIS_ALV_EVENT,
          wa_fldcat            type slis_fieldcat_alv.
    DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GT_PRINT TYPE SLIS_PRINT_ALV.
    DATA: IT_FLDCAT       TYPE SLIS_T_FIELDCAT_ALV.
    DATA: IT_SORT             TYPE SLIS_T_SORTINFO_ALV.
    DATA: V_REPID LIKE SY-REPID.
                        SELECTION SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
                                           " Controlling Area
                     S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
                                           " Company code
                     S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
                                           " Fiscal Year
                     S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
                                                            " Internal order
                     S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
                                                              " Cost Element
                     S_BUDAT FOR COOI-BUDAT, " Debit Date
                     S_LIFNR FOR COOI-LIFNR. " Vendor
    SELECTION-SCREEN END OF BLOCK B1.
           S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
    *-- Read data
      PERFORM GET_DATA.
           E N D   O F   S E L E C T I O N                               *
    END-OF-SELECTION.
    *-- Process the data and prepare the output data
      PERFORM CALCULATE_FINAL_INFO.
    *--Display Report output
      PERFORM DISPLAY_REPORT.
          FORM CALCULATE_FINAL_INFO                                     *
        Process the data and prepare final internal table               *
    FORM CALCULATE_FINAL_INFO.
      DATA : L_OBJNR LIKE COOI-OBJNR.
      SORT IT_LFA1 BY LIFNR.
      DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
      LOOP AT IT_COOI.
        L_OBJNR = IT_COOI-OBJNR+2(20).
        SHIFT L_OBJNR LEFT DELETING LEADING '0'.
        IF L_OBJNR IN S_OBJNR.
          READ TABLE IT_LFA1 WITH KEY LIFNR  = IT_COOI-LIFNR.
          IF SY-SUBRC EQ 0.
            IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
          ENDIF.
          MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
          CLEAR IT_OUTTAB-OBJNR.
          IT_OUTTAB-OBJNR = L_OBJNR.
          APPEND IT_OUTTAB.
          CLEAR IT_OUTTAB.
          CLEAR IT_LFA1.
          CLEAR L_OBJNR.
        ENDIF.
      ENDLOOP.
    ENDFORM.
    *&      Form  GET_DATA
         Fetch the Data from the table COOI and LFA1
    FORM GET_DATA.
      SELECT OBJNR
            SAKTO
            MEGBTR
            MEINH
            WKGBTR
            REFBN
            RFPOS
            SGTXT
            BUDAT
            LIFNR
            FROM COOI
            INTO TABLE IT_COOI
            WHERE   BUDAT IN S_BUDAT
            AND LIFNR IN S_LIFNR
            AND KOKRS IN S_KOKRS
            AND BUKRS IN S_BUKRS
            AND GJAHR IN S_GJAHR
            AND SAKTO IN S_SAKTO.
      IF SY-SUBRC EQ 0 .
    Get the Vendor name from LFA1
        SELECT LIFNR
               NAME1
               FROM LFA1
               INTO TABLE IT_LFA1
               FOR ALL ENTRIES IN IT_COOI
               WHERE LIFNR EQ IT_COOI-LIFNR.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " GET_DATA
    *&      Form  DISPLAY_REPORT
           Display the output
    FORM DISPLAY_REPORT.
      PERFORM BUILD_CATALOG.
      PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
      IF NOT IT_OUTTAB[] IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM      = V_REPID
                  I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                  IT_FIELDCAT             = IT_FLDCAT
                  IT_SORT                 = IT_SORT
                  IT_EVENTS               = IT_EVENTS
             TABLES
                  T_OUTTAB                = IT_OUTTAB
             EXCEPTIONS
                  PROGRAM_ERROR           = 1
                  OTHERS                  = 2.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " DISPLAY_REPORT
    *&      Form  BUILD_CATALOG
          Build the Field catalog for the ALV Report
    FORM BUILD_CATALOG.
      DATA: V_INDEX LIKE SY-TABIX.
      V_REPID = SY-REPID.
      DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = V_REPID
                I_INTERNAL_TABNAME     = 'IT_OUTTAB'
                I_INCLNAME             = V_REPID
           CHANGING
                CT_FIELDCAT            = IT_FLDCAT
           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.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
                             TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC  EQ 0.
        WA_FLDCAT-DO_SUM  = 'X'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
                                TABNAME =  'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC EQ 0.
         WA_FLDCAT-SELTEXT_L = 'Order'.
         WA_FLDCAT-COL_POS = 1.
         WA_FLDCAT-DDICTXT = 'L'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      LS_SORT-FIELDNAME = 'OBJNR'.
      LS_SORT-SPOS      = 1.
      LS_SORT-UP        = 'X'.
      LS_SORT-SUBTOT    = 'X'.
      APPEND LS_SORT TO IT_SORT.
    ENDFORM.                               " BUILD_CATALOG
    *&      Form  FRM_PREPARE_EVENT_LIST
          Build the Events
    FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
      CLEAR GS_EVENT.
      GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
      APPEND GS_EVENT TO IT_EVENTS.
    ENDFORM.                               " FRM_PREPARE_EVENT_LIST
         TOP OF PAGE
    FORM TOP_OF_PAGE_REPORT.
      CALL FUNCTION 'Z_YREPORT_HEADER'
           EXPORTING
                DL_TITLE = SY-TITLE
                DL_REPID = SY-CPROG
                DL_LINSZ = SY-LINSZ
           EXCEPTIONS
                OTHERS   = 1.
    ENDFORM.                               " FRM_TOP_OF_PAGE_REPORT
    *&      Form  USER_COMMAND
      Drill Down Functionality to Call the Transaction ME23
    FORM USER_COMMAND USING    P_UCOMM    LIKE SY-UCOMM
                               P_SELFIELD TYPE SLIS_SELFIELD.
      DATA : L_INDEX LIKE SY-INDEX,
             L_REFBN LIKE COOI-REFBN.
      L_INDEX = P_SELFIELD-TABINDEX.       " holds the selected table index
      CLEAR L_REFBN.
      CASE P_UCOMM.
    *-- On Double Click
        WHEN '&IC1'.
          CLEAR L_REFBN.
    *-- Read the Current Line
          READ TABLE IT_OUTTAB INDEX L_INDEX.
          IF SY-SUBRC EQ 0.
            L_REFBN = IT_OUTTAB-REFBN.
            IF NOT L_REFBN IS INITIAL.
    *-- Set the BES Paramater Id to the Current line Purchase Order Number
              SET PARAMETER ID 'BES' FIELD L_REFBN.
    *-- Call the Transaction Purchase Order Display with the above PO Number
              CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
            ENDIF.
          ELSE.
            MESSAGE E999 WITH TEXT-014.
          ENDIF.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND

  • To calculate average for a currency field in alv

    Hi,
    I have a requirement in which i need to find the average of a currency field in alv. For the particular field, i'm passing the value of DO_SUM = 'C' in thr field catalog(as suggested in many threads); but I'm not able to calculate the average. it still shows me summation when i click on summation button.
    What could be the possible error??? Is there any other method we can do the same??
    Thanks in Advance.
    Jaspreet

    Hi
    U can try this way.
    *& Report  Z_DEMO_JG
    *& Display average in ALV report
    REPORT  z_demo_jg LINE-SIZE 80 LINE-COUNT 50
                                         NO STANDARD PAGE HEADING.
    TABLES: sflight.
    TYPE-POOLS: slis.
    * Data declaration
    DATA: i_flight TYPE STANDARD TABLE OF sflight,
          i_catalog TYPE slis_t_fieldcat_alv,
          w_flight TYPE sflight,
          w_catalog TYPE slis_fieldcat_alv.
    DATA: v_repid TYPE syrepid.
    * Selection screen
    SELECT-OPTIONS: s_carrid FOR sflight-carrid.
    START-OF-SELECTION.
    * Fetch data from sflight table
      SELECT *
       FROM sflight
      INTO TABLE i_flight
      WHERE carrid IN s_carrid.
      CHECK sy-subrc = 0.
      v_repid = sy-repid.
    * Build field catalog for ALV report
      PERFORM build_catalog.
    * Display ALV report
      PERFORM display_report.
    *&      Form  build_catalog
    *       Build field catalog for ALV report
    *       None
    FORM build_catalog .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = v_repid
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = i_catalog
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc = 0.
    *   For average populate 'C' as value in
    *   field DO_SUM
        w_catalog-do_sum = 'C'. " C = Average
    *   Modify record with new value
        MODIFY i_catalog FROM w_catalog TRANSPORTING
        do_sum WHERE fieldname = 'PRICE'.
      ENDIF.
    ENDFORM.                    " build_catalog
    *&      Form  display_report
    *       Display ALV report
    *       None
    FORM display_report .
      IF i_catalog[] IS NOT INITIAL.
    *   Call ALV grid
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = v_repid
            it_fieldcat        = i_catalog
          TABLES
            t_outtab           = i_flight
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc = 0.
        ENDIF.
      ENDIF.
    ENDFORM.                    " display_report
    Edited by: meetjoe on Sep 15, 2009 7:17 PM

  • Deactivate the double click/ hot spot for a particular row in alv grid.

    Hello,
       As per a certain condition how to deactivate the double click/ hot spot for a particular row in alv grid.
    Regards,
    Saroj

    where u define layout there is a field hotspot.like
    data: var.
    if con is true
    var = 'X'. (show hotspot)
    else.
    var = ' '. (deactive hotspot)
    elseif ws_fieldcat-fieldname = 'DMBTR'
                    AND ws_fieldcat-tabname = 'T_MTAB'.
          ws_fieldcat-do_sum = C_X.
          <b>ws_fieldcat-hotsopts = var.</b>
          MODIFY Wt_fieldcat FROM ws_fieldcat
                  TRANSPORTING   DO_SUM.
    It is helpful for u. if any problen send me ur coding i will change it.
    Regards
    Manish Kumar

  • Maintaing a default value for a particular field in the selection screen

    Hi all,
    How to maintain a default value for a particular field in the Selection Screen of a Standard report
    Regards
    Ajay

    >
    ajay babu wrote:
    > Hi all,
    >
    > How to maintain a default value for a particular field in the Selection Screen of a Standard report
    >
    > Regards
    > Ajay
    Create a variant for your standard program and assign this variant to the field 'Start with variant' while creating transaction code for the standard program in the transaction 'SE93'.
    Regards
    Rajesh.

  • Code for reading particular  fields from the file placed in application

    hi,
    code for reading particular  fields from the file placed in application server in to the internal table.

    Hi,
    Use the GUI_UPLOAD FM to upload the File into ur Internal Table.
    DATA : FILE_TABLE TYPE FILE_TABLE OCCURS 0,
             fwa TYPE FILE_TABLE,
             FILENAME TYPE STRING,
             RC TYPE I.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'Open File'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
       WITH_ENCODING           =
      CHANGING
        FILE_TABLE              = FILE_TABLE
        RC                      = RC
       USER_ACTION             =
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE FILE_TABLE INDEX 1 into fwa.
    FILENAME = fwa-FILENAME.
        CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
                  filename                = filename
                  FILETYPE                = 'DAT'
           IMPORTING
                FILELENGTH              =
             TABLES
                  data_tab                = itab
             EXCEPTIONS
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  invalid_type            = 5
                  OTHERS                  = 6 .
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Regards,
    Balakumar.G
    Reward Points if helpful.

  • How can we disable a particular field in BI,BCS Report in Portal

    Hi Friends,
    I have one doubt in Portal.
    How can we disable a particular field in BI,BCS Report in Portal depending up on user.
    For Exam: In Our Application can we divided in to 3 Categories. Managerial, Regional and Supervisor.
    Manager having all authorizations. So here I donu2019t have any problem.
    When Regional Manager logs in portal Depending up on that Regional Plant number will be in Disable mode.
    EX: India Regional Manager logs in portal Plant number Files == IND123 Like in BI Report
           UK Regional Manager logs in portal Plant number Files == UK154   Like in BI Report
    When Supervisor logs in portal Depending up on that Regional Plant number will be in Disable mode and also Company Code also in disable mode
    EX: India Supervisor logs in portal Plant number Files == IND123 Like in BI Report and also Company code input file is ABC is in Disable mode
        In India Another Supervisor logs in portal
    India Supervisor logs in portal Plant number Files == IND123 Like in BI Report and also Company code input file is ASD is in Disable mode
           UK Supervisor logs in portal Plant number Files == UK154   Like in BI Report and also Company code input file is XYZ is in Disable mode
    This is my Req; How can we do there. Could you help me.
    Give me these Ans:
    1. Is it Feasible in portal.
    2. Depending upon user we can disable particular filed in Portal.
    3. Can we find out who is login in Portal. by Using BI System. in WDJ We can Find out Like IUSER Code Same as BI Developer also Find it. Is it Possible or not.
    Regards
    Vijay Kalluri

    no

  • How to edit particular field in alv list display-urgent

    HI ALL,
    my requirement is i am displaying output using alv list display. now my rewuirement :
    i am displaying out in edit mode only. when user clicks one particular field
    for example record is like
    runrate a01 maheed  -> if user clicks on a01 this field should be editable. i have a following code
      w_field-edit = w_edit.
      w_field-input = 'X'.    -> using this code i can able to display entire colomn in edit mode. this not suits my requirement.anybody can send me the sample code please.
    thanks,
    maheedhar.t

    Can you please send me the sample code plz.
    i am sending my code below.
    type-pools : slis.
    tables : zuser_secobjects.
    data : t_header1 like zuser_secobjects.
    data : begin of it_secobjects occurs 0.
            include structure t_header1.
    data :   checkbox type c value 'X',
            action type c,
          end of it_secobjects.
    data : begin of it_secobjects1 occurs 0.
            include structure ZUSER_SECOBJECTS.
    data :   checkbox type c VALUE 'X',
          end of it_secobjects1.
    data : wa_ita like line of it_secobjects.
    data : i_field type slis_t_fieldcat_alv with header line.
    data : w_field like line of i_field.
    data : i_sort type slis_t_sortinfo_alv.
    data : w_sort like line of i_sort.
    data : it_filt1 type slis_t_filter_alv with header line.
    data:
    i_tabname type tabname,
    i_repid like sy-repid,
    is_lout type slis_layout_alv.
    data :   it_filt type slis_t_filter_alv   with header line,
             it_evts type slis_t_event        with header line.
    DATA : is_vari type disvariant.
    constants :   c_default_vari value 'X',
                  c_save_vari    value 'U',
                   c_checkfield type slis_fieldname     value 'ACTION',
                   c_f2code     type sy-ucomm           value '&ETA'.
    data : chk_box type slis_fieldname.
    selection-screen: begin of block b1 with frame title text-t01.
    parameters : p_appln type zuser_secobjects-appln.
    parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
    p_partnr type zuser_secobjects-appln_partner,
    p_ptype type zuser_secobjects-partner_type default '02',
    p_upostn type zuser_secobjects-user_position,
    p_sdate like likp-erdat default sy-datum,
    p_edate(10) default '12/31/9999',
    p_revnum type zuser_secobjects-revnum,
    p_cted type zuser_secobjects-created_by,
    p_cdate type zuser_secobjects-creation_date,
    p_ctime type zuser_secobjects-creation_time,
    p_chnby type zuser_secobjects-changed_by,
    p_cdate1 type zuser_secobjects-changed_date,
    p_ctime1 type zuser_secobjects-changed_time.
    selection-screen: end of block b1.
    form user_command using p_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
      case p_ucomm.
        when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
          loop at it_secobjects into wa_ita.
            wa_ita-checkbox = 'X'.
            modify it_secobjects from wa_ita.
          endloop.
      rs_selfield-refresh = 'X'.   "<-  ADD THIS
      when 'DESLCT_ALL'.
        loop at it_secobjects into wa_ita.
            wa_ita-checkbox = ' '.
            modify it_secobjects from wa_ita.
          endloop.
    rs_selfield-refresh = 'X'.   "<-  ADD THIS
       is_lout-f2code               = c_f2code.
       is_lout-box_fieldname        = c_checkfield.
       is_lout-get_selinfos         = 'X'.
       is_lout-detail_popup         = 'X'.
       is_lout-detail_initial_lines = 'X'.
    maheed-start.
    *when 'SAVE'.
    *LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    CLEAR IT_SECOBJECTS1.
    DELETE IT_SECOBJECTS.
    *ENDLOOP.
    *DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    WHEN 'DELETE'.
        loop at it_SECOBJECTS where checkbox eq 'X'.
            delete it_SECOBJECTS.
        endloop.
    *RS_SELFIELD-REFRESH = 'X'.
    maheed-end.
    maheed-start.  apr 13
    WHEN 'DELETE'.
    loop at it_SECOBJECTS where checkbox eq 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    delete it_SECOBJECTS.
    endloop.
    RS_SELFIELD-REFRESH = 'X'.
    when 'SAVE'.
    DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    commit work.
    refresh :IT_SECOBJECTS1.
    maheed-end.    apr 13
    *when 'SAVE'.
    *LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    CLEAR IT_SECOBJECTS1.
    DELETE IT_SECOBJECTS.
    *ENDLOOP.
    *DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    ENDCASE.
    endform.
    *&      Form  delete
    form delete.
      data : begin of is_secobjects occurs 0.
              include structure zuser_secobjects.
      data : checkbox type c.
      data : end of is_secobjects.
      is_secobjects-checkbox = 'X'.
      modify is_secobjects
        from it_secobjects
        transporting checkbox
      where checkbox = 'X'.
    endform.
    *&      Form  get_data
    form get_data.
      select * from zuser_secobjects
      into table it_secobjects.
    endform.                    " get_data
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form prepare_fieldcatalog." USING w_edit TYPE any.
    data : w_edit type c.
    clear w_edit.
      clear: w_field,i_field.
      refresh:i_field.
      i_field-key = 'X'.
      i_field-col_pos = 1.
      i_field-ddictxt = 'S'.
      i_field-seltext_s = '@11@'.
    i_field-checkbox = 'X'.
      i_field-input = 'X'.
      i_field-fieldname = 'HEADER'.
      i_field-outputlen = 0.
      append i_field.
      clear i_field.
      w_field-fieldname = 'APPLN'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-seltext_l = text-m01.
      w_field-outputlen = '10'.
      w_field-EDIT = 'X'.      "maheed
      w_field-col_pos = 1.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_USER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_PARTNER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m03.
      w_field-edit = w_edit.
      w_field-input = 'X'.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'INACTIVE'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 3.
      append w_field to i_field.
      clear w_field.
    endform.                    " prepare_fieldcatalog
    *&      Form  ALV_LIST_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alv_list_display.
    DATA : LC_GLAY TYPE LVC_S_GLAY.
    LC_GLAY-EDT_CLL_CB = 'X'.
      i_repid = sy-repid.
      is_lout-box_fieldname = 'CHECKBOX'.
      it_filt-fieldname = 'ACTION'.
      call function 'REUSE_ALV_LIST_DISPLAY'
           exporting
                i_callback_program       = i_repid
                i_callback_pf_status_set = 'PF_STATUS_SET'
                i_callback_user_command  = 'USER_COMMAND'
                is_layout                = is_lout
                it_fieldcat              = i_field[]
                it_filter                = it_filt[]
                 it_events                = it_evts[]
                i_default                = c_default_vari
                i_save                   = c_save_vari
                is_variant               = is_vari
           tables
                t_outtab                 = it_secobjects.
    endform.                    " ALV_LIST_DISPLAY
    *&      Form  display
          text
         -->P_I_OBJECT  text
    form display using    object.
      case object.
    ENDCASE.
    endform.                    " display
    thanks,
    maheedhar.t

  • Display one or more rows for a particular column in alv grid display

    Hi,
    My requirement in the report is to display users for a particular workitem id.If a workitem is in the inbox of one or more users(approvers) i have to display all the user names in one field in alv grid output (output-approver id).There are other fields which display details of the workitem also.
    Is there a way to populate multiple rows for a single column or creating one more internal table for users in the alv output table.
    Please suggest.
    regards,
    Sravanthi Chilal

    ALV only can show flat internal table data.
    you should set a sort on the field which you want to show only once.
    Then on the output of the ALV, the field with the same value will show only once.

  • How to provide validation for a particular field of screen

    Hi Experts,
    For my project, I have created a screen. In the screen, we have one field. For this field we have provided F4 help. When the user clicks on the F4 list of values is displayed.
    I have to provide following condition for this field.
    User should only select values from this F4 list only. If the user tries to enter any data which is not contained in the list, system should throw message that 'Invalid data. Select valid values".
    Can you please let me know how I can do so?
    The relevant portion of code is
    CASE save_ok_code.
        WHEN 'EXIT'.
         LEAVE PROGRAM.
        WHEN 'BACK'.
          PERFORM exit.
        WHEN 'CANCEL'.
         LEAVE PROGRAM.
        WHEN 'SAVE'.
          CALL FUNCTION 'MESSAGES_INITIALIZE'.
          PERFORM check_batch CHANGING fl_error.
          IF fl_error IS INITIAL.
            PERFORM save.
            IF sy-subrc EQ 0.
              CLEAR gv_deleted.
              PERFORM update_alv_grid_display.
    ***for message display
              CALL FUNCTION 'MESSAGES_SHOW'.
            ENDIF.
          ELSE.
            CALL FUNCTION 'MESSAGE_STORE'
              EXPORTING
                arbgb  = 'ZEX_MYPROJECT'
                msgty  = 'S'
                txtnr  = '053'
                msgv1  = text-008
              EXCEPTIONS
                OTHERS = 3.
            CHECK sy-subrc = 0.
            CALL FUNCTION 'MESSAGES_SHOW'.
          ENDIF.
        WHEN OTHERS.
          CALL METHOD cl_gui_cfw=>dispatch.
    I am totally new for ABAP. So, please help me out.
    Thanks
    Smith

    Hi,
    Try this.
    Create an internal table and populated it with the values present in the F4 help of the field. Then in AT SELECTION-SCREEN event check the value of the field with the values in the internal table and display the appropriate message.
    Sharin.

  • F4 help for a dropdown field in ALV

    I am trying to enable F4 help for a field in ALV (OO style) that also has a dropdown assigned to it.
    If I enable the dropdown in the field catalog, the field does not respond to F4 event at all.
    When I remove the dropdown attribute from the field catalog, the F4 help works, but obviously now there is no dropdown.
    The reason I am trying to implement it this way is that my dropdown list (which is the same for all rows) is quite large while F4 help depends on the current line in the ALV (so the available values are limited).
    I would like to try to avoid creating a dropdown handle for every row in ALV.
    Does anybody know if it's even possible to have a dropdown and F4 help at the same time in ALV?

    Hi
    Linking F4 Help to Fields
    For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
    1) Pass the fieldname to ‘FIELDNAME’
    2)Set ‘REGISTER’ to make the field registered,
    3)Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode
    4)Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.
    Preparing table for the fields to be registered to trigger F4 event
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
    lt_f4-fieldname = 'PRICE'.
    lt_f4-register = 'X' .
    lt_f4-getbefore = 'X' .
    APPEND lt_f4 .
    CALL METHOD gr_alvgrid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[] .
    A sample “onf4” method implementation
    METHOD handle_on_f1 .
    PERFORM f4_help USING e_fieldname es_row_no .
    er_event_data->m_event_handled = 'X' .
    ENDMETHOD .
    Again, we set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
    Check this link
    http://help.sap.com/saphelp_nw04/helpdata/en/ed/ec623c4f69b712e10000000a114084/content.htm
    Check these standard programs
    BCALV_GRID_F4_HELP_APPLICATION
    BCALV_GRID_F4_HELPM01
    BCALV_TEST_GRID_F4_HELP
    Regards
    Pavan

  • Obtaining subtotals based on 2 fields.(ALV using oops concept)

    Need help on how to apply sort on 2 fields and obtain subtotals.For example if I have some records for similar tax code and some more records  for a similar tax jurisdiction (under which all tax codes come).I need to calculate subtotals for same tax code as well as same tax jurisdiction code.Currently I am able to generate subtotals by sorting on 1 field only ,using OOPs concept.How do I apply for both the fields? This is what is being done currently with regard to sorting and subtotaling : 
    METHOD set_sorts.
    lr_sorts = gr_alv_data->get_sorts( ).
    TRY.
            lr_sorts->add_sort( 'TXJCD' ). ---sorting based on tax jurisdiction
          CATCH: cx_salv_not_found,
                cx_salv_existing,
                cx_salv_data_error.
        ENDTRY.
        TRY.
            lr_sorts->add_sort( columnname = 'MSKWZ'
                                        subtotal = if_salv_c_bool_sap=>true ).
          CATCH cx_salv_data_error cx_salv_not_found
                cx_salv_existing.                          
        ENDTRY.
      ENDMETHOD.                    "set_sorts
    Thanks & Regards,
    Savitha

    Hi Savitha,
    Use the other paramenters like POSITION, SEQUENCE, SUBTOTAL for both fields like as follows. Then it will work fine.
    TRY.
    lr_sorts->add_sort( columnname = 'TXJCD'
    sequence = 1
    Position = 1
    subtotal = if_salv_c_bool_sap=>true ).
    CATCH cx_salv_data_error cx_salv_not_found
    cx_salv_existing.
    ENDTRY.
    TRY.
    lr_sorts->add_sort( columnname = 'MSKWZ'
    sequence = 2
    Position = 1
    subtotal = if_salv_c_bool_sap=>true ).
    CATCH cx_salv_data_error cx_salv_not_found
    cx_salv_existing.
    ENDTRY.

  • Condense the leading spaces for a particular field

    hi
    total_weight            TYPE char10,
    I need to condense the leading spaces.for a particular
    how shd i do it.

    shift total_weight  left deleting leading space.
    Regards,
    RIch Heilman

  • How to keep hotspot on particular field in alv interactive report

    hi all,
    i have a small requirement.i developed one interactive alv.in vasic alv wheni click on sales order number it shows secondary alv.but here i would like to keep hotspot symbol so user can understand that he has to click on this sales order number only.
    any body can send me the sam ecode please.
    thanks,
    maheedhar.t

    hi...
    here is an ALV report i did with hot spot!!
    (only a part of my entire report)
    tables: marc.
    types : begin of DISP,
            SLNO TYPE I,
            werks type MARC-WERKS,
            matnr type MARA-MATNR,
            maktx type MAKT-MAKTx,
            mtart type MARA-MTART,
            volum type MARA-VOLUM,
            ntgew type MARA-NTGEW,
            ersda type MARA-ERSDA,
            laeda type MARA-LAEDA,
            end of DISP.
    data : it_disp type table of disp,
           wa_disp type disp.
    Data: it_fcat type slis_t_fieldcat_alv,
          wa_fcat type slis_fieldcat_alv.
    parameters : p_werks type marc-werks.
    IF p_werks IS INITIAL.
    MESSAGE I000(Z_errors).
    ELSE.
    select MARC~WERKS
           MARA~MATNR
           MAKT~MAKTX
           MARA~MTART
           MARA~VOLUM
           MARA~NTGEW
           MARA~ERSDA
           MARA~LAEDA
    from
    MARC inner join MARA
    on marcmatnr = maramatnr
    inner join makt
    on marcmatnr = maktmatnr
    into corresponding fields of table IT_DISP
    where marc~werks = p_werks and spras = 'EN'.
    IF SY-SUBRC = 0.
    PERFORM display.
    ELSE.
    MESSAGE I001(Z_errors).
    ENDIF.
    ENDIF.
    form display.
    LOOP AT IT_DISP INTO WA_DISP.
    MOVE SY-TABIX TO WA_DISP-SLNO.
    MODIFY IT_DISP FROM WA_DISP TRANSPORTING SLNO.
    ENDLOOP.
    wa_fcat-col_pos = 1.
    wa_fcat-fieldname = 'SLNO'.
    WA_fcat-SELTEXT_L = 'SLNO'.
    wa_fcat-tabname = 'IT_DISP'.
    wa_fcat-ref_fieldname ='SLNO'.
    *wa_fcat-ref_tabname = ''.
    <b>wa_fcat-hotspot = 'X'.</b>
    append wa_fcat to it_fcat.
    clear wa_fcat.
    the line in bold is wat which wil enable hpt spot for ur ALV display!
    try out.
    reward if my ans is useful.

Maybe you are looking for

  • KM Scheduler isn't running with Implementation - but without

    Hi experts, I have a very confusing problem with my portal scheduler. This is my implementation. public class AbstractImportScheduler implements ISchedulerTask      private static final Location logger = Location.getLocation(AbstractImportScheduler.c

  • How do I open RAW images in Photoshop?

    I just purchased a Canon G9 camera with RAW image capability.  When I try to open a RAW file in Photoshop (version 8.0) I get an error message: "Could not complete your request because it is not the right kind of document" Any help will be greatly ap

  • 11 x 17 or Ledger Printing

    Hi all-- I was wondering if anyone knows if one can print an iCal calendar to 11 x 17? The larger size would be convenient for me and was thinking about buying a new printer for that primary purpose, but I'm not sure if I do so if the software will a

  • Upgrading from osx 10.5.8 to snow leopard 10.6.3....

    is that possible? I mean will my macbook(white, about 1 1/2 - 2years old) be able to run it or will I have any problems?

  • Love Photoshop CS6 - Another Quirk

    Hmm, while I really am enjoying CS6 some of the subtle changes are becoming annoying. I use layers for portrait retouching and in all prior versions of CS I can hit CTL J to create a duplicate layer, then I could right click and it wiould bring up th