Fieldcat in ALV OOPS

Hi All,
Can any one let me know how to build fieldcat for ALV using OOPS.
thanks.
Khan

Hi
see the sample program for the Reuse_ALV_FIELD_CATALOG_MERGE and do accordingly
report ZRGRIRNA no standard page heading
       line-count 65
       line-size 255
       message-id mm.
                   GR IR Detail Report                               *
Description          : The output has to be displayed
                       in the ALV Grid format with the Selection     *
                       screen appearing on the output. In The Output *
                       Subtotals for Vendor, Plant, Period, Material,*
                       Valuation Class, Purchase Order,Cost Center,  *
                       Cost Element and Receipt Date are displayed   *
                       after sorting the data by same fields.        *
Declaration for Tables
tables: t001,      " Company Codes
        t001w,     " Plants/Branches
        lfa1,      " Vendor Master
        ska1,      " GL Account Master
        mara,      " Material Master
        mbew,      " Material Valuation
        ekko,      " PO Header Data
        cska,      " Cost Elements
        csks,      " Cost Centers
        bsis,      " GL Accounts: Open Items Data
        bkpf.      " Accounting Doc: Header Data
Type-pools
Type pools for ALV display
type-pools : slis.
Global variables
data: g_repid       like sy-repid,
      g_exit        type c,
      g_events      type slis_t_event,
      g_list_top_of_page type slis_t_listheader,
      g_exit_caused_by_caller,
      g_exit_caused_by_user type slis_exit_by_user,
      g_top_of_page  type slis_formname value 'TOP_OF_PAGE',
      g_variant like disvariant,
      g_save.
Declaration for Constants
constants : c_x  type c  value 'X',         " Flag
            c_c  type c  value 'C',         " Flag
            c_l  type c  value 'L',         " Flag
            c_a  type c  value 'A',         " Line Type
            c_h  type c  value 'H',         " Dr/Cr
            c_s  type c  value 'S',         " Line Type
            c_mkpf(4) type c value 'MKPF'.  " Table
Declaration of Internal Tables
Internal Table for BSIS Table data
data: begin of i_bsis occurs 0,
        bukrs like bsis-bukrs,          " Company Code
        hkont like bsis-hkont,          " GR IR Account
        gjahr like bsis-gjahr,          " Fiscal Year
        belnr like bsis-belnr,          " Acc Document
        buzei like bsis-buzei,          " Item No
        budat like bsis-budat,          " Receipt Date(Posting)
        monat like bsis-monat,          " Period
      end of i_bsis.
Internal Table for BSEG Table data
data: begin of i_bseg occurs 0,
        bukrs like bsis-bukrs,          " Company Code
        belnr like bsis-belnr,          " Acc Document
        buzei like bsis-buzei,          " Item No
        gjahr like bsis-gjahr,          " Fiscal Year
        shkzg like bseg-shkzg,          " Dr/Cr Indicator
        lifnr like bseg-lifnr,          " Vendor Code
        matnr like bseg-matnr,          " Material No
        ebeln like bseg-ebeln,          " Purchase Order
        ebelp like bseg-ebelp,          " PO Item
        werks like bseg-werks,          " Plant
        menge like bseg-menge,          " PO Quantity
        meins like bseg-meins,          " UOM
        dmbtr like bseg-dmbtr,          " Amount in Local Currency
        wrbtr like bseg-wrbtr,          " Amount in Trans.Currency
      end of i_bseg.
Internal Table for BKPF Table data
data: begin of i_bkpf occurs 0,
        bukrs like bkpf-bukrs,          " Company Code
        belnr like bkpf-belnr,          " Acc Document
        gjahr like bkpf-gjahr,          " Fiscal Year
        waers like bkpf-waers,          " Trans. Currency
        awkey like bkpf-awkey,          " Object Key
        awtyp like bkpf-awtyp,          " Reference Procedure
      end of i_bkpf.
Internal Table for MSEG Table data
data: begin of i_mseg occurs 0,
        mblnr like mseg-mblnr,          " Material Document
        mjahr like mseg-mjahr,          " Fiscal Year
        bwart like mseg-bwart,          " Movement Type
        matnr like mseg-matnr,          " Material No
        menge like mseg-menge,          " PO Quantity
        meins like mseg-meins,          " UOM
      end of i_mseg.
Internal Table for MBEW Table data
data: begin of i_mbew occurs 0,
        matnr like mbew-matnr,          " Material No
        werks like mbew-bwkey,          " Plant
        bklas like mbew-bklas,          " Valuation Class
      end of i_mbew.
Internal Table for EKPO Table data
data: begin of i_ekpo occurs 0,
        ebeln like ekpo-ebeln,          " Purchase Order
        ebelp like ekpo-ebelp,          " PO Item
        matnr like ekpo-matnr,          " Material No
        txz01 like ekpo-txz01,          " Material Text
      end of i_ekpo.
Internal Table for EKKN Table data
data: begin of i_ekkn occurs 0,
        ebeln like ekkn-ebeln,          " Purchase Order
        ebelp like ekkn-ebelp,          " PO Item
        kostl like ekkn-kostl,          " Cost Center
        sakto like ekkn-sakto,          " Cost Element
      end of i_ekkn.
Internal Table for LFA1 Table data
data: begin of i_lfa1 occurs 0,
        lifnr like lfa1-lifnr,          " Vendor
        name1 like lfa1-name1,          " Name
      end of i_lfa1.
Declaration of Output Internal Table
data: begin of i_final occurs 0,
        lifnr like lfa1-lifnr,     " Vendor
        werks like bseg-werks,     " Plant
        monat like bsis-monat,     " Period
        matnr like mara-matnr,     " Material Number
        bklas like mbew-bklas,     " Val Class
        ebeln like bseg-ebeln,     " PO
        kostl like ekkn-kostl,     " Cost Center
        sakto like ekkn-sakto,     " Cost Element
        budat like bsis-budat,     " Rec. Date
        name1 like lfa1-name1,     " Vendor Name
        belnr like bsis-belnr,     " FI Document
        bwart like mseg-bwart,     " Movement Type
        txz01 like ekpo-txz01,     " Material Text
        menge like bseg-menge,     " Quantity
        meins like bseg-meins,     " UOM
        dmbtr like bseg-dmbtr,     " Local Amount
        wrbtr like bseg-wrbtr,     " Tran.Amount
        waers like bkpf-waers,     " Tran.Currency
        status type c,             " Material Status
      end of i_final.
Internal table to hold field catgory data
data:  i_fldcat  type slis_t_fieldcat_alv.   " Table - field catgory
Internal table to hold Sort/Subtotals criteria data
data:  i_sort  type slis_t_sortinfo_alv.     " Table - sort/Subtotals
Structure
data:  x_layout   type slis_layout_alv,      " Structure-layout
       x_fldcat   like line of i_fldcat,     " Structure-field catagory
       x_sort     like line of i_sort.       " Structure-Sort/Subtotals
       Selection screen
selection-screen : begin of block b1 with frame title text-000.
parameters:
   p_bukrs like t001-bukrs obligatory,          " Company Code
   p_grira like ska1-saknr default '0241101000' obligatory. " Account
select-options:
   s_budat for bkpf-budat,        " Posting Date
   s_werks for t001w-werks,       " Plant
   s_lifnr for lfa1-lifnr,        " Vendor
   s_matnr for mara-matnr,        " Material Number
   s_kostl for csks-kostl,        " Cost Center
   s_kstar for cska-kstar,        " Cost Element
   s_ebeln for ekko-ebeln,        " Purchase Order
   s_monat for bsis-monat.        " Period
selection-screen skip.
parameters:
   p_incmt as checkbox default 'X',
   p_incnm as checkbox default 'X'.
selection-screen end of block b1.
Initialization
initialization.
  g_repid = sy-repid.
  perform layout_init using x_layout.
  perform eventtab_build using g_events[].
  g_variant-report = g_repid.
  g_save           = 'A'.
At selection screen
at selection-screen.
Validation of Selection Screen Fields
  perform validate_screen.
Start of selection
start-of-selection.
Read Data from Database Tables
  perform read_data.
End of selection
end-of-selection.
Build layout report layout.
  perform populate_layout_stucture.
Perform build_field_catalog and Sort Table
  perform build_field_catalog.
  perform build_sort_totals.
List Header for Top-Of-Page
  perform comment_build using g_list_top_of_page[].
Call list viewer function module
  perform call_list_viewer .
****************Form - Routines**************************************
      Form        : layout_init
      Description : Form to Build layout for list display
form layout_init using rs_layout type slis_layout_alv.
  rs_layout-detail_popup      = c_x.
endform.
Form         : Eventtab_build
Description  : Registration of events to happen during list display
form eventtab_build using rt_events type slis_t_event.
Registration of events to happen during list display
  data: ls_event type slis_alv_event.
  call function 'REUSE_ALV_EVENTS_GET'
       exporting
            i_list_type = 0
       importing
            et_events   = rt_events.
  read table rt_events with key name = slis_ev_top_of_page
                           into ls_event.
  if sy-subrc = 0.
    move g_top_of_page to ls_event-form.
    append ls_event to rt_events.
  endif.
endform.                                   "eventtab_build
      Form : top_of_page
form top_of_page.
  call function 'REUSE_ALV_COMMENTARY_WRITE'
       exporting
         I_LOGO             = 'ENJOYSAP_LOGO'
            it_list_commentary = g_list_top_of_page.
endform.
      Form validate_screen
Validation of Selection Screen fields
form validate_screen.
Validation of Company Code
  clear t001.
  if not p_bukrs is initial.
    select single bukrs
      into t001-bukrs
      from t001
      where bukrs eq p_bukrs.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid Company Code'(012).
    endif.
  endif.
Validation of GL Account (GR/IR)
  clear ska1.
  if not p_grira is initial.
    select saknr
      into ska1-saknr
      from ska1
      up to 1 rows
      where saknr eq p_grira.
    endselect.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid GR/IR Account'(013).
    endif.
  endif.
Validation of Vendor Code
  clear lfa1.
  if not s_lifnr[] is initial.
    select single lifnr
      into lfa1-lifnr
      from lfa1
      where lifnr in s_lifnr.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid Vendor'(001).
    endif.
  endif.
Validation of Plant Code
  clear t001w.
  if not s_werks[] is initial.
    select single werks
      into t001w-werks
      from t001w
      where werks in s_werks.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid Plant'(014).
    endif.
  endif.
Validation of Material Code
  clear mara.
  if not s_matnr[] is initial.
    select single matnr
      into mara-matnr
      from mara
      where matnr in s_matnr.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid Material'(015).
    endif.
  endif.
Validation of Purchase Order
  clear ekko.
  if not s_ebeln[] is initial.
    select single ebeln
      into ekko-ebeln
      from ekko
      where ebeln in s_ebeln.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid Purchase Order'(016).
    endif.
  endif.
Validation of Cost Center
  clear csks.
  if not s_kostl[] is initial.
    select kostl
      into csks-kostl
      from csks
      up to 1 rows
      where kostl in s_kostl.
    endselect.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid Cost Center'(017).
    endif.
  endif.
Validation of Cost Element
  clear cska.
  if not s_kstar[] is initial.
    select kstar
      into cska-kstar
      from cska
      up to 1 rows
      where kstar in s_kstar.
    endselect.
    if sy-subrc <> 0.
      message e899 with 'Enter Valid Cost Element'(018).
    endif.
  endif.
endform.                          "validate_screen
*&      Form  read_data
Read the Data from the database Tables
form read_data.
Get the Accounting Documents for the GR/IR Account Entered on
Selection Screen
  clear i_bsis.
  refresh i_bsis.
  select bukrs           " Company Code
         hkont           " GR IR Account
         gjahr           " Fiscal Year
         belnr           " Acc Document
         buzei           " Item No
         budat           " Receipt Date(Posting)
         monat           " Period
   into table i_bsis
   from  bsis
   where  bukrs = p_bukrs
     and  hkont = p_grira
     and  budat in s_budat
     and  monat in s_monat .
  if sy-subrc <> 0.
    message i899 with 'No data found'(043).
    g_exit = c_x.
    stop.
  endif.
  sort i_bsis by bukrs hkont gjahr belnr buzei.
Get the Vendor,PO,Material,Qty details from BSEG Table
  if not i_bsis[] is initial.
    clear i_bseg.
    refresh i_bseg.
    select bukrs           " Company Code
           belnr           " Acc Document
           buzei           " Item No
           gjahr           " Fiscal Year
           shkzg           " Dr/Cr Indicator
           lifnr           " Vendor Code
           matnr           " Material No
           ebeln           " Purchase Order
           ebelp           " PO Item
           werks           " Plant
           menge           " PO Quantity
           meins           " UOM
           dmbtr           " Amount in Local Currency
           wrbtr           " Amount in Trans.Currency
    into table i_bseg
    from   bseg
    for all entries in i_bsis
    where  bukrs = p_bukrs
    and    belnr = i_bsis-belnr
    and    gjahr = i_bsis-gjahr
    and    buzei = i_bsis-buzei
    and    lifnr in s_lifnr
    and    werks in s_werks
    and    matnr in s_matnr
    and    ebeln in s_ebeln.
    sort i_bseg by bukrs belnr buzei gjahr.
Select the Trans.Currency from BKPF Table
    clear i_bkpf.
    refresh i_bkpf.
    select bukrs           " Company Code
           belnr           " Acc Document
           gjahr           " Fiscal Year
           waers           " Trans. Currency
           awkey           " Object Key
           awtyp           " Reference Procedure
    into table i_bkpf
    from   bkpf
    for all entries in i_bsis
    where  bukrs = p_bukrs
    and    belnr = i_bsis-belnr
    and    gjahr = i_bsis-gjahr.
  endif.
  sort i_bkpf by bukrs belnr gjahr.
Get the Quantity and UOM of Material from MSEG Table
  if not i_bkpf[] is initial.
    clear i_mseg.
    refresh i_mseg.
    select mblnr           " Material Document
           mjahr           " Fiscal Year
           bwart           " Movement Type
           matnr           " Material No
           menge           " PO Quantity
           meins           " UOM
      into table i_mseg
      from   mseg
      for all entries in i_bkpf
      where  mblnr = i_bkpf-awkey(10).
  endif.
  sort i_mseg by mblnr mjahr.
Get the Material And Description from EKPO Table
  if not i_bseg[] is initial.
    clear i_ekpo.
    refresh i_ekpo.
    select ebeln           " Purchase Order
           ebelp           " PO Item
           matnr           " Material No
           txz01           " Material Text
    into table i_ekpo
    from   ekpo
    for all entries in i_bseg
    where  ebeln = i_bseg-ebeln
    and    ebelp = i_bseg-ebelp.
    sort i_ekpo by ebeln ebelp.
Get the Valuation Class from MBEW Table
    clear i_mbew.
    refresh i_mbew.
    select matnr           " Material No
           bwkey           " Plant
           bklas           " Valuation Class
    into table i_mbew
    from   mbew
    for all entries in i_bseg
    where  matnr = i_bseg-matnr
    and    bwkey = i_bseg-werks.
    sort i_mbew by matnr werks.
Get the Cost Center and Cost Element of the PO from EKKN Table
    clear i_ekkn.
    refresh i_ekkn.
    select ebeln           " Purchase Order
           ebelp           " PO Item
           kostl           " Cost Center
           sakto           " Cost Element
    into table i_ekkn
    from   ekkn
    for all entries in i_bseg
    where  ebeln = i_bseg-ebeln
    and    ebelp = i_bseg-ebelp
    and    kostl in s_kostl
    and    sakto in s_kstar.
    sort i_ekkn by ebeln ebelp.
Get the Vendor Name
    clear i_lfa1.
    refresh i_lfa1.
    select lifnr            " Vendor
           name1            " Name
    into table i_lfa1
    from   lfa1
    for all entries in i_bseg
    where  lifnr = i_bseg-lifnr.
  endif.
  sort i_lfa1 by lifnr.
Move the data to Final Output Internal Table
  loop at i_bsis.
    i_final-belnr = i_bsis-belnr.     " FI Document
    i_final-monat = i_bsis-monat.     " Period
    i_final-budat = i_bsis-budat.     " Rec. Date
Read the Transaction Currency from BKPF Internal Table
    read table i_bkpf with key bukrs = i_bsis-bukrs
                               belnr = i_bsis-belnr
                               gjahr = i_bsis-gjahr
                               binary search.
    if sy-subrc = 0.
      i_final-waers = i_bkpf-waers.     " Tran.Currency
Read the Movement Type for all Material Related
Documents from MSEG Internal Table
      if i_bkpf-awtyp = c_mkpf.
        read table i_mseg with key mblnr = i_bkpf-awkey(10)
                                   mjahr = i_bkpf-awkey+10(4).
        if sy-subrc = 0.
          i_final-bwart = i_mseg-bwart.     " Movement Type
        endif.
      endif.
    endif.
Read Vendor, Plant, PO Document, Local And Trans.Amounts
from BSEG Internal Table
    read table i_bseg with key bukrs = i_bsis-bukrs
                               belnr = i_bsis-belnr
                               gjahr = i_bsis-gjahr
                               buzei = i_bsis-buzei
                               binary search.
    if sy-subrc = 0.
      i_final-lifnr = i_bseg-lifnr.     " Vendor
      i_final-werks = i_bseg-werks.     " Plant
      i_final-ebeln = i_bseg-ebeln.     " PO
      i_final-dmbtr = i_bseg-dmbtr.     " Local Amount
      i_final-wrbtr = i_bseg-wrbtr.     " Tran.Amount
      i_final-menge = i_bseg-menge.     " Quantity
      i_final-meins = i_bseg-meins.     " UOM
For Credit Indicator(SHKZG = H) amounts should be (-)ve
      if i_bseg-shkzg = c_h.
        i_final-dmbtr = i_final-dmbtr * -1.
        i_final-wrbtr = i_final-wrbtr * -1.
        i_final-menge = i_final-menge * -1.
      endif.
Read the Material and its Description from EKPO Internal Table
      read table i_ekpo with key ebeln = i_bseg-ebeln
                                 ebelp = i_bseg-ebelp
                                 matnr = i_bseg-matnr
                                 binary search.
      if sy-subrc = 0.
        i_final-matnr = i_ekpo-matnr.     " Material Number
        i_final-txz01 = i_ekpo-txz01.     " Material Text
Populate the Material Status depending on the Input Checkbox
On Selection Screen
        if not i_ekpo-matnr is initial.
          i_final-status = c_x.
        endif.
      endif.
Read the PO related Cost Element and Cost Centers
from EKKN Internal Table
      read table i_ekkn with key ebeln = i_bseg-ebeln
                                 ebelp = i_bseg-ebelp
                                 binary search.
      if sy-subrc = 0.
        i_final-kostl = i_ekkn-kostl.     " Cost Center
        i_final-sakto = i_ekkn-sakto.     " Cost Element
      endif.
Read the Valuation Class from MBEW Internal Table
      read table i_mbew with key matnr = i_bseg-matnr
                                 werks = i_bseg-werks
                                 binary search.
      if sy-subrc = 0.
        i_final-bklas = i_mbew-bklas.     " Val Class
      endif.
Read the Vendor Name from LFA1 Internal Table
      read table i_lfa1 with key lifnr = i_bseg-lifnr
                                 binary search.
      if sy-subrc = 0.
        i_final-name1 = i_lfa1-name1.     " Vendor Name
      endif.
    endif.
    append i_final.
    clear i_final.
  endloop.
  sort i_final by lifnr werks monat matnr.
Depending on the check Box Selected display the data
  if p_incmt = c_x and p_incnm ne c_x.
    delete i_final where matnr eq space.
  elseif p_incnm = c_x and p_incmt ne c_x.
    delete i_final where matnr ne space.
  endif.
endform.           "Read Data
     Form        : populate_layout_stucture
     Description : Populating the layout structure
form populate_layout_stucture.
  clear x_layout .
Layout properties
  x_layout-zebra                = c_x.
  x_layout-detail_popup         = c_x.
  x_layout-detail_initial_lines = c_x.
  x_layout-colwidth_optimize    = c_x.
endform.                    " populate_layout_stucture
     Form        : build_field_catalog
     Description : Building the field catalog data
form build_field_catalog.
  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       exporting
            i_program_name         = g_repid
            i_internal_tabname     = 'I_FINAL'
            i_inclname             = g_repid
       changing
            ct_fieldcat            = i_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.
Getting the Header text for the coloums
  loop at i_fldcat into x_fldcat where fieldname = 'LIFNR' or
                                       fieldname = 'NAME1' or
                                       fieldname = 'WERKS' or
                                       fieldname = 'MONAT' or
                                       fieldname = 'MATNR' or
                                       fieldname = 'BKLAS' or
                                       fieldname = 'EBELN' or
                                       fieldname = 'KOSTL' or
                                       fieldname = 'SAKTO' or
                                       fieldname = 'BUDAT' or
                                       fieldname = 'BELNR' or
                                       fieldname = 'BWART' or
                                       fieldname = 'TXZ01' or
                                       fieldname = 'MENGE' or
                                       fieldname = 'MEINS' or
                                       fieldname = 'DMBTR' or
                                       fieldname = 'WRBTR' or
                                       fieldname = 'WAERS' or
                                       fieldname = 'STATUS'.
    if x_fldcat-fieldname = 'LIFNR'.
      x_fldcat-seltext_l   = 'Vendor'(003).
      x_fldcat-seltext_m   = 'Vendor'(003).
      x_fldcat-seltext_s   = 'Vendor'(003).
      x_fldcat-reptext_ddic = 'Vendor'(003).
      x_fldcat-inttype   = c_c.
    endif.
    if x_fldcat-fieldname = 'NAME1'.
      x_fldcat-seltext_l   = 'Vendor Name'(002).
      x_fldcat-seltext_m   = 'Vendor Name'(002).
      x_fldcat-seltext_s   = 'Vendor Name'(002).
      x_fldcat-reptext_ddic = 'Vendor Name'(002).
      x_fldcat-inttype   = c_c.
    endif.
    if x_fldcat-fieldname = 'WERKS'.
      x_fldcat-seltext_l   = 'Plant'(010).
      x_fldcat-seltext_m   = 'Plant'(010).
      x_fldcat-seltext_s   = 'Plant'(010).
      x_fldcat-reptext_ddic   = 'Plant'(010).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'MONAT'.
      x_fldcat-seltext_l   = 'Period'(011).
      x_fldcat-seltext_m   = 'Period'(011).
      x_fldcat-seltext_s   = 'Period'(011).
      x_fldcat-reptext_ddic   = 'Period'(011).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'MATNR'.
      x_fldcat-seltext_l   = 'Material'(004).
      x_fldcat-seltext_m   = 'Material'(004).
      x_fldcat-seltext_s   = 'Material'(004).
      x_fldcat-reptext_ddic   = 'Material'(004).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'BKLAS'.
      x_fldcat-seltext_l   = 'Valuation Class'(009).
      x_fldcat-seltext_m   = 'Valuation Class'(009).
      x_fldcat-seltext_s   = 'Valuation Class'(009).
      x_fldcat-reptext_ddic   = 'Valuation Class'(009).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'EBELN'.
      x_fldcat-seltext_l   = 'Purchase Order'(005).
      x_fldcat-seltext_m   = 'Purchase Order'(005).
      x_fldcat-seltext_s   = 'Purchase Order'(005).
      x_fldcat-reptext_ddic   = 'Purchase Order'(005).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'KOSTL'.
      x_fldcat-seltext_l   = 'Cost Center'(006).
      x_fldcat-seltext_m   = 'Cost Center'(006).
      x_fldcat-seltext_s   = 'Cost Center'(006).
      x_fldcat-reptext_ddic   = 'Cost Center'(006).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'SAKTO'.
      x_fldcat-seltext_l   = 'Cost Element'(007).
      x_fldcat-seltext_m   = 'Cost Element'(007).
      x_fldcat-seltext_s   = 'Cost Element'(007).
      x_fldcat-reptext_ddic   = 'Cost Element'(007).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'BUDAT'.
      x_fldcat-seltext_l   = 'Receipt Date'(008).
      x_fldcat-seltext_m   = 'Receipt Date'(008).
      x_fldcat-seltext_s   = 'Receipt Date'(008).
      x_fldcat-reptext_ddic   = 'Receipt Date'(008).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'BELNR'.
      x_fldcat-seltext_l   = 'Acc.Document'(100).
      x_fldcat-seltext_m   = 'Acc.Document'(100).
      x_fldcat-seltext_s   = 'Acc.Document'(100).
      x_fldcat-reptext_ddic   = 'Acc.Document'(100).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'BWART'.
      x_fldcat-seltext_l   = 'Movement Type'(101).
      x_fldcat-seltext_m   = 'Movement Type'(101).
      x_fldcat-seltext_s   = 'Movement Type'(101).
      x_fldcat-reptext_ddic   = 'Movement Type'(101).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'TXZ01'.
      x_fldcat-seltext_l   = 'Material Text'(102).
      x_fldcat-seltext_m   = 'Material Text'(102).
      x_fldcat-seltext_s   = 'Material Text'(102).
      x_fldcat-reptext_ddic   = 'Material Text'(102).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'MENGE'.
      x_fldcat-seltext_l   = 'Quantity'(103).
      x_fldcat-seltext_m   = 'Quantity'(103).
      x_fldcat-seltext_s   = 'Quantity'(103).
      x_fldcat-reptext_ddic   = 'Quantity'(103).
      x_fldcat-ddictxt   = c_l.
      x_fldcat-do_sum    = c_x.
    endif.
    if x_fldcat-fieldname = 'MEINS'.
      x_fldcat-seltext_l   = 'UOM'(104).
      x_fldcat-seltext_m   = 'UOM'(104).
      x_fldcat-seltext_s   = 'UOM'(104).
      x_fldcat-reptext_ddic   = 'UOM'(104).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'DMBTR'.
      x_fldcat-seltext_l   = 'Amount in Local Curr'(105).
      x_fldcat-seltext_m   = 'Amount in Local Curr'(105).
      x_fldcat-seltext_s   = 'Amount in Local Curr'(105).
      x_fldcat-reptext_ddic   = 'Amount in Local Curr'(105).
      x_fldcat-ddictxt   = c_l.
      x_fldcat-do_sum    = c_x.
    endif.
    if x_fldcat-fieldname = 'WRBTR'.
      x_fldcat-seltext_l   = 'Amount in Trans.Curr'(106).
      x_fldcat-seltext_m   = 'Amount in Trans.Curr'(106).
      x_fldcat-seltext_s   = 'Amount in Trans.Curr'(106).
      x_fldcat-reptext_ddic   = 'Amount in Trans.Curr'(106).
      x_fldcat-ddictxt   = c_l.
      x_fldcat-do_sum    = c_x.
    endif.
    if x_fldcat-fieldname = 'WAERS'.
      x_fldcat-seltext_l   = 'Trans.Currency'(107).
      x_fldcat-seltext_m   = 'Trans.Currency'(107).
      x_fldcat-seltext_s   = 'Trans.Currency'(107).
      x_fldcat-reptext_ddic   = 'Trans.Currency'(107).
      x_fldcat-ddictxt   = c_l.
    endif.
    if x_fldcat-fieldname = 'STATUS'.
      x_fldcat-seltext_l   = 'Material Status'(019).
      x_fldcat-seltext_m   = 'Material Status'(019).
      x_fldcat-seltext_s   = 'Material Status'(019).
      x_fldcat-reptext_ddic   = 'Material Status'(019).
      x_fldcat-ddictxt   = c_l.
    endif.
    modify i_fldcat from x_fldcat index sy-tabix.
  endloop.
endform.                    " build_field_catalog
     Form        : build_sort_totals
     Description : Building the Criteria for Sort/Subtotals
form build_sort_totals.
  x_sort-fieldname = 'LIFNR'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  1.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'WERKS'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  2.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'MONAT'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  3.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'MATNR'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  4.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'BKLAS'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  5.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'EBELN'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  6.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'KOSTL'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  7.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'SAKTO'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  8.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
  x_sort-fieldname = 'BUDAT'.
  x_sort-tabname   = 'I_FINAL'.
  x_sort-spos      =  9.
  x_sort-up        =  c_x.
  x_sort-subtot    = c_x.
  append x_sort to i_sort.
  clear  x_sort.
endform.                    " build_sort_totals
  Form        : comment_build
  Description : This form is used to display the Report Header(ALV)
form comment_build using lt_top_of_page type
                                        slis_t_listheader.
  data: l_line type slis_listheader,
        l_heading1 like rs38m-repti,
        l_date(10), l_time(8).
  clear l_line.
  l_heading1 = 'GR/IR DETAIL REPORT'(021).
  g_repid = sy-repid.
  write sy-uzeit to l_time.
  write sy-datum to l_date.
  l_line-typ = c_h.
  move l_heading1 to l_line-info.
  append l_line to lt_top_of_page.
  clear l_line.
  l_line-typ  = c_s.
  concatenate 'System:'(023) sy-sysid
              'Date:'(024) l_date
              ' Time:'(025)
              l_time into l_line-info.
  append l_line to lt_top_of_page.
  concatenate 'Report:'(026) g_repid
              ' User:'(027) sy-uname into
              l_line-info.
  append l_line to lt_top_of_page.
  l_line-typ = c_a.
  move 'SELECTION CRITERIA:'(028) to l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Company Code : '(029)
              p_bukrs into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' GR/IR Account: '(030)
              p_grira into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Posting Date : '(032) s_budat-low
              ' To: '(031) s_budat-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Plant : '(033) s_werks-low
              ' To: '(031) s_werks-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Vendor: '(034) s_lifnr-low
              ' To: '(031) s_lifnr-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Material: '(035) s_matnr-low
              ' To: '(031) s_matnr-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Cost Center : '(036) s_kostl-low
              ' To: '(031) s_kostl-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Cost Element: '(037) s_kstar-low
              ' To: '(031) s_kstar-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Purchase Order: '(038) s_ebeln-low
              ' To: '(031) s_ebeln-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Period : '(039) s_monat-low
              ' To: '(031) s_monat-high into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Include Material Items: '(040)
              p_incmt into l_line-info.
  append l_line to lt_top_of_page.
  concatenate ' Include Non-Material Items: '(041)
              p_incnm into l_line-info.
  append l_line to lt_top_of_page.
endform.
     Form        : call_list_viewer
     Description : This form is used to display the grid through ALV
form call_list_viewer.
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = g_repid
            is_layout               = x_layout
            it_fieldcat             = i_fldcat[]
            i_default               = c_x
            it_sort                 = i_sort[]
            i_save                  = g_save
            is_variant              = g_variant
            it_events               = g_events[]
       importing
            e_exit_caused_by_caller = g_exit_caused_by_caller
            es_exit_caused_by_user  = g_exit_caused_by_user
       tables
            t_outtab                = i_final
       exceptions
            program_error           = 1
            others                  = 2.
  if sy-subrc <> 0.
    write: / 'Problem in calling the ALV report'(042).
  endif.
endform.                    " call_list_viewer
Regards
anji

Similar Messages

  • Change the data in fieldcat and update the database table in alv oops

    Hi,
    my requirement is i have displayed a fieldcat in change mode and when i change the data and click on save it has to be updated the database table..
    this has to be done using alv oops...

    Hi,
    This code will reflect all the changes into the internal table that is being displayed.
    * to reflect the data changed into internal table
          DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
          IF ref_grid IS INITIAL.
            CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
              IMPORTING
                e_grid = ref_grid.
          ENDIF.
          IF NOT ref_grid IS INITIAL.
            CALL METHOD ref_grid->check_changed_data.
          ENDIF.
    Now after this code is executed the internal table is modified as per the changes done in alv output.
    Now you can use this internal table to update the database table.
    Hope this helps you.
    Regards,
    Tarun

  • ALV OOPS report - Need help

    Hi Friends,
    I just want to convert a normal alv grid report to ALV OOPS report using classes,methods and objects, can you please help me on it.
    *I have sent a sample ALV grid report program.
    REPORT  YSDB_ALV_ECC NO STANDARD PAGE HEADING LINE-SIZE 260 LINE-COUNT 58.
    TABLES:
                    VBRK,
                    VBRP.
    TYPE-POOLS: SLIS.
    TYPES:
                  BEGIN OF Y_VBRK_STRUCT ,
                        VBELN TYPE VBRK-VBELN,
                        FKART TYPE VBRK-FKART,
                        FKDAT TYPE VBRK-FKDAT,
                        BUKRS TYPE VBRK-BUKRS,
                        NETWR TYPE VBRK-NETWR,
                  END OF Y_VBRK_STRUCT.
    TYPES:
                     BEGIN OF Y_VBRP_STRUCT,
                            VBELN TYPE VBRP-VBELN,
                            POSNR TYPE VBRP-POSNR,
                            MATNR TYPE VBRP-MATNR,
                            FKIMG TYPE VBRP-FKIMG,
                            AUBEL TYPE VBRP-AUBEL,
                            KOSTL TYPE VBRP-KOSTL,
                            PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
                            ARKTX TYPE VBRP-ARKTX,
                     END OF Y_VBRP_STRUCT.
    TYPES:
                  BEGIN OF Y_DISPLAY_STRUCT,
                        VBELN TYPE VBRK-VBELN,
                        FKART TYPE VBRK-FKART,
                        FKDAT TYPE VBRK-FKDAT,
                        BUKRS TYPE VBRK-BUKRS,
                        NETWR TYPE VBRK-NETWR,
                        POSNR TYPE VBRP-POSNR,
                        MATNR TYPE VBRP-MATNR,
                        FKIMG TYPE VBRP-FKIMG,
                        AUBEL TYPE VBRP-AUBEL,
                        KOSTL TYPE VBRP-KOSTL,
                        PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
                        ARKTX TYPE VBRP-ARKTX,
                  END OF Y_DISPLAY_STRUCT .
    DATA: W_INDEX LIKE SY-TABIX.
    DATA:  W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV.
    DATA:  T_FIELDCATALOG1 TYPE SLIS_T_FIELDCAT_ALV.
    DATA:  W_REPID TYPE SY-REPID.
    DATA: T_VBRK_ITAB TYPE STANDARD TABLE OF Y_VBRK_STRUCT .
    DATA: T_VBRP_ITAB TYPE STANDARD TABLE OF Y_VBRP_STRUCT .
    DATA: T_DISPLAY_ITAB TYPE STANDARD TABLE OF Y_DISPLAY_STRUCT.
    DATA: E_DISPLAY TYPE Y_DISPLAY_STRUCT.
    SELECT-OPTIONS S_VBELN FOR VBRK-VBELN.
    SELECT-OPTIONS S_BUKRS FOR VBRK-BUKRS.
    SELECT-OPTIONS S_FKDAT FOR VBRK-FKDAT.
    START-OF-SELECTION.
      PERFORM F_GET_DATA1.
      PERFORM F_PROCESS_DATA.
      PERFORM F_FIELDCATLOG.
      PERFORM F_DISPLAY_DATA.
      PERFORM F_CLEAR_FIELDS.
    *&      Form  get_data1
          text
    FORM F_GET_DATA1 .
      SELECT VBELN  FKART FKDAT BUKRS NETWR
        FROM VBRK
        INTO  TABLE T_VBRK_ITAB
       WHERE BUKRS IN S_BUKRS
         AND FKDAT IN S_FKDAT
         AND VBELN IN S_VBELN.
      IF SY-SUBRC NE 0.
        FREE: T_VBRK_ITAB.
      ENDIF.
      IF NOT T_VBRK_ITAB IS INITIAL.
        SELECT VBELN POSNR MATNR FKIMG AUBEL
               KOSTL PS_PSP_PNR ARKTX
          FROM VBRP
          INTO TABLE T_VBRP_ITAB
          FOR ALL ENTRIES IN T_VBRK_ITAB
         WHERE VBELN EQ T_VBRK_ITAB-VBELN.
        IF SY-SUBRC NE 0.
          FREE: T_VBRK_ITAB.
        ENDIF.
      ENDIF.
    ENDFORM.                                                    " GET_DATA1
          text
    -->  p1        text
    <--  p2        text
    FORM F_PROCESS_DATA .
      SORT T_VBRK_ITAB  BY VBELN.
      SORT T_VBRP_ITAB  BY VBELN.
      CLEAR: W_INDEX.
      UNASSIGN <FS_STRUCT1>.
      UNASSIGN <FS_STRUCT2>.
      LOOP AT T_VBRK_ITAB ASSIGNING <FS_STRUCT1>.
        READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> WITH KEY VBELN = <FS_STRUCT1>-VBELN BINARY SEARCH.
        IF SY-SUBRC EQ 0.
          MOVE  SY-TABIX TO W_INDEX.
          WHILE SY-SUBRC  IS INITIAL AND <FS_STRUCT1>-VBELN = <FS_STRUCT2>-VBELN.
    *Header Items Moving
            MOVE:
                   <FS_STRUCT1>-FKART TO E_DISPLAY-FKART,
                   <FS_STRUCT1>-FKDAT TO E_DISPLAY-FKDAT,
                   <FS_STRUCT1>-BUKRS TO E_DISPLAY-BUKRS,
                   <FS_STRUCT1>-NETWR TO E_DISPLAY-NETWR.
    *Line items Moving
            MOVE: <FS_STRUCT2>-VBELN TO E_DISPLAY-VBELN,
                  <FS_STRUCT2>-POSNR TO E_DISPLAY-POSNR,
                  <FS_STRUCT2>-MATNR TO E_DISPLAY-MATNR,
                  <FS_STRUCT2>-FKIMG TO E_DISPLAY-FKIMG,
                  <FS_STRUCT2>-AUBEL TO E_DISPLAY-AUBEL,
                  <FS_STRUCT2>-KOSTL TO E_DISPLAY-KOSTL,
                  <FS_STRUCT2>-PS_PSP_PNR TO E_DISPLAY-PS_PSP_PNR,
                  <FS_STRUCT2>-ARKTX TO E_DISPLAY-ARKTX.
            APPEND E_DISPLAY TO T_DISPLAY_ITAB.
            CLEAR  E_DISPLAY.
                      ADD 1 TO W_INDEX.
            READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> INDEX  W_INDEX.
            IF SY-SUBRC NE 0.
              EXIT.
            ENDIF.
          ENDWHILE.
        ENDIF.
      ENDLOOP.
    ENDFORM.                                                    " GET_DATA3
    *&      Form  Fieldcatlog
          text
    -->  p1        text
    <--  p2        text
    FORM F_FIELDCATLOG .
      W_FIELDCATALOG-FIELDNAME = TEXT-001.
      W_FIELDCATALOG-SELTEXT_L = TEXT-002.
      MOVE : 1 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-003.
      W_FIELDCATALOG-SELTEXT_L = TEXT-004.
      MOVE : 2 TO W_FIELDCATALOG-COL_POS,
               20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-005.
      W_FIELDCATALOG-SELTEXT_L = TEXT-006.
      MOVE : 3 TO W_FIELDCATALOG-COL_POS,
              20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-007.
      W_FIELDCATALOG-SELTEXT_L = TEXT-008.
      MOVE : 4 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-009.
      W_FIELDCATALOG-SELTEXT_L = TEXT-010.
      MOVE : 5 TO W_FIELDCATALOG-COL_POS,
              20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-011.
      W_FIELDCATALOG-SELTEXT_L = TEXT-012.
      MOVE : 6 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-013.
      W_FIELDCATALOG-SELTEXT_L = TEXT-014.
      MOVE : 7 TO W_FIELDCATALOG-COL_POS,
            20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-015.
      W_FIELDCATALOG-SELTEXT_L = TEXT-016.
      MOVE : 8 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-017.
      W_FIELDCATALOG-SELTEXT_L = TEXT-018.
      MOVE : 9 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
    ENDFORM.                    " Fieldcatlog
    *&      Form  DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM F_DISPLAY_DATA .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM     = W_REPID
          I_CALLBACK_TOP_OF_PAGE = 'AAAAAAAAADDAADA' "TEXT-021
          I_GRID_TITLE           = TEXT-020
          IT_FIELDCAT            = T_FIELDCATALOG1
        TABLES
          T_OUTTAB               = T_DISPLAY_ITAB.
      IF SY-SUBRC NE 0.
        EXIT.
      ENDIF.
      CLEAR: W_REPID.
      CLEAR: T_FIELDCATALOG1.
    ENDFORM.                    " DISPLAY_DATA
    *&      Form  F_Clear_fields
          text
    -->  p1        text
    <--  p2        text
    FORM F_CLEAR_FIELDS .
      FREE: T_VBRK_ITAB.
      FREE: T_VBRP_ITAB.
      FREE: T_DISPLAY_ITAB.
      CLEAR: W_FIELDCATALOG.
    ENDFORM.                    " F_Clear_fields
    Regards
    Dinesh

    In ALV oops,
    1. You need screen on which you must create a custom container. - screen 100
    2. In PBO of 100, create module for displaying ALV
    MODULE DISPLAY_ALV OUTPUT
    PERFORM CREATE_CONTAINER "IN WHICH YOU USE THE CREATE OBJECT METHOD OF CL_GUI_CUSTOM_CONTAINER
    PERFORM CREATE_ALV "IN WHICH YOU USE CREATE_OBJECT METHOD OF CL_GUI_ALV_GRID.
    PERFORM PREPARE_FIELDCAT "creating fcat using LVC_S_FCAT structure
    PERFORM DISPLAY "here you use the SET_TABLE_FOR_FIRST_DISPLAY method of CL_GUI_ALV_GRID class,
    where you provide the internal table name and fieldcat internal table
    ENDMODULE

  • How to do it in ALV OOPS

    Hi
    Im using ALV OOPS.o/p I have 10 records with checkbox(at user command I have to select record selected by check box). Now on the menu bar I hav a button for "SELECT ALL". If "selected all" 10 recored will be selected. If I filter upon some criteria no. of records will be 3..Now in GUI if I select SELECT all it will display 3 records r selected, but I have to process further internally ,,,but internally 10 records are selected. So how to write code for that is after filterring 3 records r selected and I "select all"..only 3 records will be selected instead of 10?
    Part of my code like this..
    SELECT all
      CALL METHOD G_GRID->CHECK_CHANGED_DATA
        IMPORTING
          E_VALID = L_VALID.
      IF L_VALID EQ 'X'.
        LOOP AT PT_OUTTAB INTO LS_OUTTAB.
      DATA LS_CELLTAB TYPE LVC_S_STYL.
      LOOP AT PS_OUTTAB-CELLTAB INTO LS_CELLTAB.
        IF LS_CELLTAB-FIELDNAME = 'CHECKBOX'.
          IF LS_CELLTAB-STYLE EQ CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            P_LOCKED = 'X'.
          ELSE.
            P_LOCKED = SPACE.
          ENDIF.
        ENDIF.
      ENDLOOP.
          IF L_LOCKED IS INITIAL
             AND NOT LS_OUTTAB-CHECKBOX EQ '-'.
            LS_OUTTAB-CHECKBOX = 'X'.
          ENDIF.
          MODIFY PT_OUTTAB FROM LS_OUTTAB.
        ENDLOOP.
        CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY.
    ENDIF.

    Hello Kaushik
    Using method go_grid->GET_FILTERED_ENTRIES you get an index list of the filtered entries.
    DATA: lt_filtered     TYPE lvc_t_fidx,
              ld_indx        LIKE LINE OF lt_filtered.
      CALL METHOD go_grid->GET_FILTERED_ENTRIES
         IMPORTING
           ET_FILTERED_ENTRIES = lt_filtered.
      LOOP AT lt_filtered INTO ld_indx.
        READ TABLE gt_outtab INTO ls_outtab INDEX ld_indx.
      ENDLOOP.
    Regards
      Uwe

  • To set HOTSPOT for a field in ALV-oops and when clecked should call transac

    Hi,
    I need to set HOTSPOT for a field in O/P list using ALV-oops and when clecked should take me to Transaction VA01. Please help....
    Thanks,
    Prabhu

    Hi,
         Please go through this code it may help u.
    REPORT zcls_alv_oops MESSAGE-ID z1.
    TABLES : mara.
    Types Declaration..\
    TYPES :
    BEGIN OF t_mara,
    matnr TYPE matnr,
    mtart TYPE mtart,
    maktx TYPE maktx,
    END OF t_mara,
    BEGIN OF t_marc,
    matnr TYPE matnr,
    werks TYPE werks_d,
    mtart TYPE mtart,
    maktx TYPE maktx,
    END OF t_marc.
    Internal Tables Declaration..\
    DATA :
    i_mara TYPE TABLE OF t_mara,
    i_marc TYPE TABLE OF t_marc,
    i_fcat1 TYPE lvc_t_fcat,
    i_fcat2 TYPE lvc_t_fcat.
    Constants Declaration..\
    CONSTANTS :
    c_cont1 TYPE scrfname VALUE 'CONT1',
    c_cont2 TYPE scrfname VALUE 'CONT2'.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECT-OPTIONS:
    s_matnr FOR mara-matnr NO INTERVALS.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS :
    p_hotspt RADIOBUTTON GROUP r1 DEFAULT 'X',
    p_bttn RADIOBUTTON GROUP r1.
    SELECTION-SCREEN END OF BLOCK b1.
    \* Class forward referncing.
    CLASS lcl_rcvr_class DEFINITION DEFERRED.
    \* Pointers Declaration..
    DATA :
    lp_rcvr TYPE REF TO lcl_rcvr_class,
    lp_cont1 TYPE REF TO cl_gui_custom_container,
    lp_cont2 TYPE REF TO cl_gui_custom_container,
    lp_grid1 TYPE REF TO cl_gui_alv_grid,
    lp_grid2 TYPE REF TO cl_gui_alv_grid.
    \* Local Class Definiton.
    CLASS lcl_rcvr_class DEFINITION.
    PUBLIC SECTION.
    METHODS :
    hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no,
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
    IMPORTING e_row e_column.
    ENDCLASS.
    \* Local Class Implementation.
    CLASS lcl_rcvr_class IMPLEMENTATION.
    METHOD hotspot_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row_id-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD handle_double_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    \* Start of Selection
    START-OF-SELECTION.
    \* Extract the Material Master data for the Input Material.
    SELECT a~matnr
    a~mtart
    b~maktx
    INTO TABLE i_mara
    FROM mara AS a
    INNER JOIN makt AS b
    ON a~matnr EQ b~matnr
    WHERE a~matnr IN s_matnr
    AND b~spras EQ sy-langu.
    END-OF-SELECTION.
    IF NOT i_mara\[\] IS INITIAL.
    \* Call Screen to display the Material Master data.
    CALL SCREEN 100.
    ELSE.
    MESSAGE s121 WITH text-006.
    ENDIF.
    \*& Module DISP_GRID OUTPUT
    \* text
    MODULE disp_grid OUTPUT.
    \* Build the Field catelog for Material Master data.
    PERFORM build_fcat.
    \* Display the Material Master data using ALV.
    PERFORM disp_alv.
    ENDMODULE. " DISP_GRID OUTPUT
    \*& Module USER_COMMAND_0100 INPUT
    \* text
    MODULE user_command_0100 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    \*& Form build_fcat
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARA'.
    IF p_hotspt EQ 'X'.
    ws_fcat-hotspot = 'X'.
    ENDIF.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat
    \*& Form disp_alv
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv.
    IF lp_cont1 IS INITIAL.
    \* Create the Container Object of Material Master.
    CREATE OBJECT lp_cont1
    EXPORTING
    container_name = c_cont1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6 .
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Master.
    CREATE OBJECT lp_grid1
    EXPORTING
    i_parent = lp_cont1
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Master data by calling method.
    CALL METHOD lp_grid1->set_table_for_first_display
    CHANGING
    it_outtab = i_mara
    it_fieldcatalog = i_fcat1
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Set Handler for the Hot Spot Event.
    CREATE OBJECT lp_rcvr.
    IF p_hotspt EQ 'X'.
    SET HANDLER lp_rcvr->hotspot_click FOR lp_grid1.
    ELSE.
    SET HANDLER lp_rcvr->handle_double_click FOR lp_grid1.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDFORM. " disp_alv
    \*& Module STATUS_0100 OUTPUT
    \* text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'MAIN_STAT'.
    SET TITLEBAR 'T_100'.
    ENDMODULE. " STATUS_0100 OUTPUT
    \*& Module STATUS_0200 OUTPUT
    \* text
    MODULE status_0200 OUTPUT.
    SET PF-STATUS 'PLANT_STAT'.
    SET TITLEBAR 'T_200'.
    ENDMODULE. " STATUS_0200 OUTPUT
    \*& Module DISP_GRID_plant OUTPUT
    \* text
    MODULE disp_grid_plant OUTPUT.
    \* Build the Field catelog for Material Plant data.
    PERFORM build_fcat_plant.
    \* Display the Material Master Plant data using ALV.
    PERFORM disp_alv_plant.
    ENDMODULE. " DISP_GRID_plant OUTPUT
    \*& Module USER_COMMAND_0200 INPUT
    \* text
    MODULE user_command_0200 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    \*& Form build_fcat_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat_plant.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'WERKS'.
    ws_fcat-scrtext_m = text-004.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat_plant
    \*& Form disp_alv_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv_plant.
    IF lp_cont2 IS INITIAL.
    \* Create the Container Object of Material Plant data.
    CREATE OBJECT lp_cont2
    EXPORTING
    container_name = c_cont2
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Plant data.
    CREATE OBJECT lp_grid2
    EXPORTING
    i_parent = lp_cont2
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Plant data by calling method.
    CALL METHOD lp_grid2->set_table_for_first_display
    CHANGING
    it_outtab = i_marc
    it_fieldcatalog = i_fcat2
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDIF.
    ELSE.
    \* Call method 'REFRESH_TABLE_DISPLAY' to refresh the grid data.
    CALL METHOD lp_grid2->refresh_table_display.
    ENDIF.
    ENDFORM. " disp_alv_plant

  • Problem while placing a button in the Output using ALV OOPs

    Hi,
    I am using ALV OOPs to display  report output.
    In the toolbar i have to palce an update button  and if i click on that update it should then call the selection screen 500 .
    So,please  help me to achieve this using ALV OOPs.
    THANKS & REGARDS,
    Kiranmai.

    Hi,
    you can use set pf-status statement with the OOPs' concept where in you will have to give this in the events table and pass it to the method to display the alv ...
    Regards,
    Siddarth

  • Event handling in alv oops With buttons

    Hi Experts
             I have some doubt in ALV OOPS using Events. Could any one please tell me the procedure to how to handle events in oops ( Like  interactive reports using events ).
                                     Thank you                                                                               
    Satyendra.

    Hello Satyendra
    The following sample report shows you how to handle the event HOTSPOT_CLICK and BUTTON_CLICK.
    DATA:  gd_okcode TYPE ui_func,
      gt_fcat TYPE lvc_t_fcat,
      go_docking TYPE REF TO cl_gui_docking_container,
      go_grid1 TYPE REF TO cl_gui_alv_grid.
    DATA:   gt_knb1 TYPE STANDARD TABLE OF knb1.
    PARAMETERS: p_bukrs TYPE bukrs  DEFAULT '2000'  OBLIGATORY.
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender,  " grid instance that raised the event
          handle_button_click FOR EVENT button_click OF cl_gui_alv_grid
            IMPORTING
              es_col_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *   define local data
        DATA:
          ls_knb1     TYPE knb1,
          ls_col_id   TYPE lvc_s_col.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CASE e_column_id-fieldname.
          WHEN 'KUNNR'.
            SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
            SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
            CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
          WHEN 'ERNAM'.*       
             SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
            CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
        ENDCASE.
    *   Set active cell to field BUKRS otherwise the focus is still on
    *   field KUNNR which will always raise event HOTSPOT_CLICK
        ls_col_id-fieldname = 'BUKRS'.
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
            is_row_id    = e_row_id
            is_column_id = ls_col_id.
    ENDMETHOD.                    "handle_hotspot_click
    METHOD handle_button_click.
    *   define local data
        DATA:
          ls_knb1     TYPE knb1.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX es_row_no-row_id.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
        SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
        CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
      ENDMETHOD.                    "handle_button_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          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.
    * Create ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          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.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_hotspot_click FOR go_grid1,
        lcl_eventhandler=>handle_button_click  FOR go_grid1.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          OTHERS          = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        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.
    LOOP AT gt_fcat INTO ls_fcat
              WHERE ( fieldname = 'KUNNR'  OR
                      fieldname = 'ERNAM'  OR
                      fieldname = 'BUKRS' ).
        IF ( ls_fcat-fieldname = 'BUKRS' ).
          ls_fcat-style = cl_gui_alv_grid=>mc_style_button.  " column appears as button
        ELSE.
          ls_fcat-hotspot = abap_true.
        ENDIF.
        MODIFY gt_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    Regards
      Uwe

  • Req:Download of purchase order item details using ALV oops

    Hi all,
    How to download the purchase order item details using ALV oops from the output of header details

    Hi all,
    How to download the purchase order item details using ALV oops from the output of header details

  • LED in field of ALV(OOPs oriented)- Traffic lights in ALV filter popup

    Hi experts,
    Am showing LED in field of ALV(OOPs oriented)and when i click on  ALV filter for led field..it shows me Traffic lights in poup for filter.Please help me to get LED in filter popup also.
    Thanks,
    Sajay.

    Hi,
    Use the fuction module 'ICON_CREATE' as follows.
    CALL FUNCTION 'ICON_CREATE'
        "To create Red/Yellow/Green traffic icons
          EXPORTING
            name   = wrk_light
          IMPORTING
            RESULT = ip_status.
    wrk_light can be;
    'ICON_RED_LIGHT'
    'ICON_YELLOW_LIGHT'
    or 'ICON_GREEN_LIGHT' according to your scenario, that you can use the logic for your scondition.
    Use it in PBO.
    Regards,
    Renjith Michael.

  • EVENTS IN ALV OOPS

    HI GUYS,
           CAN ANYONE PLS HELP ME OUT HANDLING EVENTS IN ALV(OOPS)....iS THERE ANY CLASS TO BE DEFINED ?????? PLS HELP IF ANYONE HAS THE CODE FOR THAT...........

    Hi,
    Declare as below.
    CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.
    DATA : O_ALVGRID TYPE REF TO CL_GUI_ALV_GRID ,
           O_DOCKINGCONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER ,
           O_EVENTRECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
    Then class definition should be as follows:
    CLASS LCL_EVENT_RECEIVER DEFINITION.
    Event receiver definitions for ALV actions
      PUBLIC SECTION.
        CLASS-METHODS:
    Row Double click for dirll down.
           HANDLE_DOUBLE_CLICK
             FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW
                          E_COLUMN
                          ES_ROW_NO.
    ENDCLASS.
    Then implementation should be as follows:
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
    *&      Method handle_double_click
    This method is called when the user double clicks on a line to drill
    down.
    The following are exported from the ALV
    LVC_S_ROW
    LVC_S_COL
    LVC_S_ROID
      METHOD HANDLE_DOUBLE_CLICK.
    The double click drill down processing should be
    coded in the form below.
        PERFORM F9007_HANDLE_DOUBLE_CLICK USING E_ROW
                                                E_COLUMN
                                                ES_ROW_NO.
      ENDMETHOD.
    ENDCLASS.
    *&      Form  F9007_HANDLE_DOUBLE_CLICK
    This form is called when the user double clicks on a line to drill
    down.
         -->P_E_ROW_ID    - Row ID  text
         -->P_E_COLUMN_ID - Column ID
         -->P_ES_ROW_NO   - Row number
    FORM f9007_handle_double_click USING p_row
                                         p_column
                                         p_row_no.
      DATA: lw_output LIKE LINE OF i_output.
    Need to check that a subtotal or grand total line has *not been double-clicked, otherwise the report will *produce a short dump!
      check p_row+0(1) is initial.
      READ TABLE i_output INDEX p_row INTO lw_output.
      CASE p_column.
        WHEN 'KNUMA'.
          IF NOT lw_output-knuma IS INITIAL.
            SET PARAMETER ID 'VBO' FIELD lw_output-knuma.
            CALL TRANSACTION 'VBO3' AND SKIP FIRST SCREEN.
          ENDIF.
       ENDCASE.
    ENDFORM.                    " F9007_HANDLE_DOUBLE_CLICK
    In PBO of the screen,
    MODULE status_9001 OUTPUT.
      IF o_dockingcontainer IS INITIAL.
       SET HANDLER o_eventreceiver->handle_double_click  FOR o_alvgrid.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    In this I have mentioned double click event.
    Similarly you have to do for others.
    Regards,
    J.Jayanthi

  • How to display 2 lines of fieldcat in alv

    hi,all.
       I wonder how to display 2 lines of fieldcat in alv,no matter grid,list ,oo.   whatever.
       thanks in anvance.

    Hi,
    it's only possible in alv-list (3 lines).
    A.

  • Issuw with Fieldcatalog in ALV OOPS

    Hi All,
    I am displaying output using ALV OOPs. in output table ihave dropdown field called Manual Processing status.
    to get dropdown i used below logic.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'OPEN'(016).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'CLOSED'(012).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'CANCELLED'(014).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'NO ACTION REQUIRED'(015).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = ' '.
      APPEND ls_dropdown TO lt_dropdown.
      CALL METHOD grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.
    when i a, displaying the output lenth of this field is '9'(i mentioned while building the fieldcatalog) but in output its size is more. I used the below field catalog for this field.
      ls_feildcat-fieldname = pv_field.
      ls_feildcat-outputlen =  pc_length.
      ls_feildcat-coltext = pv_header.
      ls_feildcat-just = pc_true.
      ls_feildcat-no_out = gc_space.
      ls_feildcat-drdn_hndl = '1'.
      ls_feildcat-fix_column = 'X'.
    when i comment   ls_feildcat-drdn_hndl = '1' then its working fine but i am not getting dropdown. ANybody can sugeest me how to approach in this case.
    Regards,
    Maheedhar

    Hi,
    Not sure to get your point...could this be in relation with your layout settings (e.g by passing is_layout-cwidth_opt = 'X' to method set_table_for_first_display) ?
    Kr,
    m.

  • Handle single click event in ALV OOPS

    Hi,
    I have to display 2 ALV grid...one above the other.
    Top ALV will contain Header info and bottom ALV witll display line item.
    I am use ALV OOPS.
    Now when user will click on the top ALV ...bottom ALV should show corresponding data.
    I don't have to use HOTSPOT or Double click event.
    How can I handle single click event.
    Please guide me..thanks in advance
    Regards,
    Prasoon

    hi,
                    for this in ALV OOPS take <b>2 custom containers( cl_gui_custom_container)</b>in the same screen and on the 1st container display the header data<b>(use set_tale_for_first_display method of class cl_gui_alv_grid)</b>.
                   On the 2nd screen item data for  this  use<b> EVENT</b> handling(you want <b>single click</b>). use<b> hotspot_click</b> or <b>button_click </b>events. 
    for this you have to register the events.   the code for that.
    <b>CLASS lcl_event_handler DEFINITION .</b>
    PUBLIC SECTION .
    METHODS:
    *--Hotspot click control
    handle_hotspot_click
    FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no ,
    *--To control button clicks
    handle_button_click
    FOR EVENT button_click OF cl_gui_alv_grid
    IMPORTING e_oject e_ucomm .
    PRIVATE SECTION.
    ENDCLASS.
    <b>CLASS lcl_event_handlerIMPLEMENTATION .</b>
    *--Handle Hotspot Click
    METHOD handle_hotspot_click .
    PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
    ENDMETHOD .
    METHOD handle_button_click .
    PERFORM handle_button_click USING e_object e_ucomm .
    ENDMETHOD .
    ENDCLASS .
    DATA gr_event_handler TYPE REF TO lcl_event_handler .
    <b>*--Creating an instance for the event handler</b>
    CREATE OBJECT gr_event_handler.
    <b>*--Registering handler methods to handle ALV Grid events</b>
    SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
    SET HANDLER gr_event_handler->handle_button_click FOR gr_alvgrid .
    do n't forget to use<b> refresh_table_display
    </b> other wise only the record which you first you clicked will display in the 2nd container.
    <b>Reward points for useful Answers</b>

  • Double click event in alv oops

    Hi,
    can any one please help me out... i dont know how to call events in alv oops...so can any one provide me with some help..
    My requirment is i have to generate a mail grid containing customer details and if i double click on a customer it should go to the transaction XD03 second screen.....

    u have to declae an event like this.
    class event_receiver definition.
      public section.
        methods handle_double_click
          for event double_click of cl_gui_alv_grid
          importing e_row.
    endclass.
    then u have to implement it in the implementation
    class lcl_event_receiver implementation.
      method lmt_handle_double_click.
        perform double_click using e_row
                                   tbl_final_display.
      endmethod.                   
    endclass.
    form double_click
            using fu_e_row             type lvc_s_row
                  fu_tbl_final_display type typ_tbl_display.
      read table fu_tbl_final_display into l_h_tbl_final_display
                              index fu_e_row-index.
      if sy-subrc = 0.
        set parameter id cns_aun field l_h_tbl_final_display-vbeln.
        call transaction cns_trans and skip first screen.
      endif.
    endform.
    hope it will help u

  • F4 link in ALV OOPs

    I am using ALV OOPs. I need to link F4 help to field in Selection Screen, Instead of normal method F4IF_INT_TABLE_VALUE_REQUEST, I need to implement this in ALV OOPs. Can anybody help on this.
    Regards,
    Naseer.

    Hi Naseer!
    At Selection Screen you don't call method to create the ALV OO yet.
    So you can you the FM 'F4IF_INT_TABLE_VALUE_REQUEST'  in the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR your_parameter.
    I hope its helpful.

Maybe you are looking for

  • How do I move 2 ipods to new computer?

    Hello Everyone, I'm sure this has been asked many times before, but I'm not finding the answer when I search for this. I'm an old guy that doesn't use itunes or our ipods much.  So I'm not real familiar with all the use, downloading, etc. that goes w

  • GR/IR GL Account for Non-stock(consumption items)

    Dear All, I understand that for Valuated materials, system will grab the GR/IR GL Accounts from OBYC--> WRX based on the valuation classes. However, how about Short text items or Non-valuated materials (Items with no Valuation Class) where you use Ac

  • WebGL doesn't work after update

    When I updated from kernel 3.6.9 to 3.8.1 (after pacman -Syu), WebGL didn't work anymore. Now I updated to 3.9.6, but the problem persists. WebGL correctly worked both in Chromium and Firefox, but now their createContext returns null with "webgl" and

  • Not capturing...... is it the recent updates

    I haven't captured any video for a few months, though i have had regular updates to my mac, now it wont captue, so has any one else had this problem with theirs or am i just a shmuck. I have not put snow leopard on yet.

  • Sales org missing

    Hi, In our test system suddenly the sales org info is missing for all the materials in COMMPRO01 transaction. We have checked the transports,jobs and there was nothing abnormal any one have any idea how to bring the sales org information back thanks