How to build a fieldcatalog in webdynpro alv

Hi friends,
how to build a fieldcatalog in webdynpro alv ? can any give me with example
Thnx
Kumar Srini

fieldcatalog in the sense, we can modify the alv table column names by using below code.
DATA LO_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
LO_CMP_USAGE = WD_THIS->WD_CPUSE_ALV2( ).
IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
  LO_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
DATA LO_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
LO_INTERFACECONTROLLER =   WD_THIS->WD_CPIFC_ALV2( ).
  DATA LO_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
  LO_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
  LO_VALUE->IF_SALV_WD_TABLE_SETTINGS~SET_VISIBLE_ROW_COUNT( 5 ).
for title
DATA: LR_TABLE_SETTINGS TYPE REF TO IF_SALV_WD_TABLE_SETTINGS.
DATA: LR_HEADER TYPE REF TO CL_SALV_WD_HEADER.
LR_TABLE_SETTINGS ?= LO_VALUE.
LR_HEADER = LR_TABLE_SETTINGS->GET_HEADER( ).
LR_HEADER->SET_TEXT( 'Waiting for Travel Advance Approval ' ).
**lr_table_Settings->set_Read_only( abap_false ).
DATA L_HEADER TYPE REF TO CL_SALV_WD_COLUMN_HEADER.
DATA: LO_COLUMN1 TYPE REF TO CL_SALV_WD_COLUMN.
LO_COLUMN1 = LO_VALUE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'TRAVELID' ).
L_HEADER = LO_COLUMN1->GET_HEADER( ).
L_HEADER->SET_TEXT( 'Travel Adv ID' ).
DATA: LO_COLUMN2 TYPE REF TO CL_SALV_WD_COLUMN.
LO_COLUMN2 = LO_VALUE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'PERNR' ).
L_HEADER = LO_COLUMN2->GET_HEADER( ).
L_HEADER->SET_TEXT( 'Employee Name' ).
In get_column you have to pass the attribute name
is this what you are looking?
Regards
Srinivas

Similar Messages

  • How to put Download  button on Webdynpro ALV

    Hi,
    I used SELECT_OPTIONS     WDR_SELECT_OPTIONS as webdynrpo components  in my ALV report.I also need download option on the output.I am using just one main view to display the results.
    Also ,Output is always defaulting to 5 rows only.. Where can I change this default?
    Rgds
    Vara

    I'm a little confused because you talk about both Select-Options and ALV.  Which are you wanting to download and which is only dispaying 5 rows.  I'm going to assume that you mean the ALV and the mention of Select-Options is actually inmaterial.
    The ALV Component already has an export button built into it standard.  Were you looking for something else - and if so what kind of functionality did you want.
    To adjust the number of visible rows in the ALV use the configuration model interface that is exposed by the component usage: cl_salv_wd_config_table.. Here is an example. You will need to adjust the name of the component usage for the name you actually used.  I used ALV - then wd_this->wd_cpuse_alv. You would need to adjust this to wd_this->wd_cpuse_<your name> and wd_this->wd_cpifc_<your name>.
    DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      l_salv_wd_table = wd_this->wd_cpifc_alv( ).
      DATA l_table TYPE REF TO cl_salv_wd_config_table.
      l_table = l_salv_wd_table->get_model( ).
      l_table->if_salv_wd_table_settings~SET_VISIBLE_ROW_COUNT( 20 ).

  • How to code to get intermediate results in webdynpro ALV? Please help!

    Hi Experts,
    I got following info from help file to generate Intermediate Results(subtotal).
    Can somebody help me with sample code to achieve this?
    Basically I want to subtotal 'Qty' column based on 'Product' field.
    By default, all values in a field are used in the calculation during aggregation. However, you
    are also able to generate intermediate results. You group the data records that contain the
    values for an intermediate result and display each intermediate result in its own result row.
    To generate intermediate results, you have to provide certain information:
    &#9679; To specify in which field the values from which the intermediate results are calculated
    are located, generate an aggregation condition for the desired field. The overall result is
    displayed in the result row.
    &#9679; To specify which data records are contained in an intermediate result, group the data
    records: You sort the ALV output by the field that includes the criterion for the
    intermediate result.
    &#9679; To then generate the intermediate results, calculate the intermediate results using the
    field with the criterion.
    &#9679; To then display the intermediate results, switch on the display of intermediate results.
    You are able to make the following settings for intermediate results:
    &#9679; Generate intermediate results
    &#9679; Display intermediate results
    &#9679; Setting levels for drilling down intermediate results
    &#9679; Set the position of the result rows (see Settings for Aggregation [page 196])
    &#9679; Forbid the generation of intermediate results
    Prerequisites
    &#9679; You have generated an aggregation object for at least one aggregatable field.
    &#9679; The field with the criterion for intermediate results is not an aggregatable field, and
    therefore has an alphanumeric data type.
    Generate Intermediate Results
    To generate intermediate results in a field that already has an aggregation condition, generate
    a sort condition for the field of a column (another column) (see Sorting [page 190]).
    In this sort condition, define whether intermediate results are to be generated. To do this, use
    the methods of the class CL_SALV_WD_SORT_RULE.
    Methods for Generating Intermediate Results
    Function Method
    Generate intermediate results SET_GROUP_AGGREGATION
    Check whether intermediate results are displayed GET_GROUP_AGGREGATION
    Display Intermediate Results
    Once you have made all settings, to generate intermediate results you have to switch on the
    display of these intermediate results. You use the methods of the interface class
    IF_SALV_WD_FIELD_SETTINGS for this (implementing class
    CL_SALV_WD_CONFIG_TABLE).
    Methods for Displaying Intermediate Results
    Function Method
    Display intermediate results SET_GROUP_AGGR_DISPLAYED
    Check whether intermediate results are displayed GET_GROUP_AGGR_DISPLAYED
    I have tried a bit but it is not working. here is my code:
    get field and create aggregation rule of type total
    lr_field = l_value->if_salv_wd_field_settings~get_field( 'Qty' ).
    lr_field->if_salv_wd_aggr~create_aggr_rule( ).
    lr_aggr_rule = lr_field->if_salv_wd_aggr~get_aggr_rule(  ).
    lr_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).
    l_field = l_value->if_salv_wd_field_settings~get_field( 'PRODUCT' ).
    l_sortrule = l_field->IF_SALV_WD_SORT~create_sort_rule( ).
    l_sortrule~SET_GROUP_AGGREGATION( 'Y').
    l_value->if_salv_wd_field_settings~SET_GROUP_AGGR_DISPLAYED( 'Y' ).
    Please help
    Message was edited by:
            gopalkrishna baliga

    Hi Gopalakrishna balgia,
    I think i have answered in the below thread. Check it out.
    How to show Subtotal in webdynpro ALV(ABAP)? Kindly help!
    Regards
    Rakesh

  • How to use traffic lights concept in alv in webdynpro abap

    Hai ,
              How to use traffic lights concept for alv in webdynpro abap. If possible give me some code.

    Hi Ravi,
    You can create ICON  to get traffic light.
    Go through this step by step.. in this example
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9?quicklink=index&overridelayout=true
    Please go through this...
    Re: Display ICON in the ALV table column
    Re: Image in ALV
    cheers,
    Kris.

  • How to provide F4 for inputfield in ABAP Webdynpro ALV

    Hi Friends,
    I am displaying records in Editable ALV Gridd in webdynpro.
    I need to provide search help(F4) for few fields which are editable.
    Please help me, how I can achieve this functionality in ALV .
    Regards,
    Xavier.p

    hi Xavier.
    to display the data in alv you must have binded it to some context node / attribute rite?.......now to get an input help to the fields you can first make the search help using transaction se11...after making the search help return to the web dynpro component go to the conttext tab.... click on the particular attribut where you want to have the search help....check in the property below...you will find that the " INPUT SEARCH help" is set to automatic ....set it to " dictionary search help".....and below it mention the name of search help you created....save it and activate the component again...the search help will be reflected automatically in the output.
    in case of any further query regarding this kindly reply.
    thanks,
    sahai.s

  • How to make all the rows editable in webdynpro alv output

    Hi,
    How to make all the rows editable in webdynpro alv output.
    Thanks
    Rakshar

    Hi Rakshar,
    Check this wiki:
    http://wiki.sdn.sap.com/wiki/display/WDABAP/HowtoeditconditionallyrowofaALVtableinWebDynprofor+ABAP
    Regards

  • How to read complete line displayed thru ALV report on double click? urgent

    Hi guys,
    An ALV report is displayed using 'REUSE_ALV_LIST_DISPLAY' and i have a requirement such that i have to read the line item on which double click is done.
    I have to fetch the line item, field by field and not by characters. I have attached the function code and all using PF status.
    Please tell me an approach as how to fetch the line item on which double click is done.
    Points will be rewarded.
    Regards
    Rahul

    Hi  ..
    i did  report  with  belnr  , bukrs  ,  Gjahr  . which will  call the  transcation code  FB03 displaing thedocument  ...
    please  cut and  paste the report  it will work ..
    REPORT  zdemo_alvgrid                 .
    TABLES:   bkpf . "  ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    BUKRS   like  bkpf-BUKRS,
    BELNR like  bkpf-BELNR,
    GJAHR like  bkpf-GJAHR,
    BLART like  bkpf-BLART,
    BLDAT like  bkpf-BLDAT,
    BUDAT like  bkpf-BUDAT,
    MONAT like  bkpf-MONAT,
    XBLNR like  bkpf-XBLNR ,
    *  ebeln TYPE ekpo-ebeln,
    *  ebelp TYPE ekpo-ebelp,
    *  statu TYPE ekpo-statu,
    *  aedat TYPE ekpo-aedat,
    *  matnr TYPE ekpo-matnr,
    *  menge TYPE ekpo-menge,
    *  meins TYPE ekpo-meins,
    *  netpr TYPE ekpo-netpr,
    *  peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'BUKRS'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BELNR'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      fieldcatalog-outputlen   = 10.
       fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
        append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'GJAHR'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
        append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BLART'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BLDAT'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BUDAT'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MONAT'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'XBLNR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    **  fieldcatalog-fieldname   = 'PEINH'.
    **  fieldcatalog-seltext_m   = 'Price Unit'.
    **  fieldcatalog-col_pos     = 8.
    **  append fieldcatalog to fieldcatalog.
    *  clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select BUKRS
    BELNR
    GJAHR
    BLART
    BLDAT
    BUDAT
    MONAT
    XBLNR  up to 10 rows
      from bkpf
      into table it_ekko.
    *select ebeln ebelp statu aedat matnr menge meins netpr peinh
    * up to 10 rows
    *  from ekpo
    *  into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'BELNR'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD   wa_ekko-bELNR  .
          SET PARAMETER ID 'MES' FIELD   wa_ekko-bUKRS  .
          SET PARAMETER ID 'DES' FIELD    wa_ekko-GJAHR .
    *     Sxecute transaction ME23N, and skip initial data entry screen
    *      CALL TRANSACTION 'FB03' AND SKIP first screen.
    SUBMIT RFBUEB00
    *        WITH ALCUR ...
    *        WITH ARCHOBJ ...
    *        WITH ARCH_SEL ...
    *        WITH ARUSETYP ...
    *        WITH AUTBEXNO ...
    *        WITH AUTH_BUK ...
    *        WITH AUTH_LDR ...
    *        WITH BR_AWKEY ...
    *        WITH BR_AWSYS ...
    *        WITH BR_AWTYP ...
            WITH BR_BELNR =  wa_ekko-bELNR
    *        WITH BR_BLART ...
    *        WITH BR_BLDAT ...
    *        WITH BR_BUDAT ...
            WITH BR_BUKRS =    wa_ekko-bUKRS
    *        WITH BR_CPUDT ...
            WITH BR_GJAHR  =  wa_ekko-GJAHR
    *        WITH BR_RLDNR ...
    *        WITH BR_SEQ ...
    *        WITH BR_USNAM ...
    *        WITH BR_XBLNR ...
    *        WITH EXCDT ...
    *        WITH P_STATS ...
    *        WITH STATISTK ...
    *        WITH STATUSD ...
    *        WITH STATUSL ...
    *        WITH STATUSM ...
    *        WITH STATUSS ...
    *        WITH STATUSV ...
    *        WITH TCODE ...
    *        WITH UNAME ...
    *        WITH XEMUCNV ...
    *        WITH XUSEAR ...
    *        WITH XUSEAS ...
    *        WITH XUSEDB
            AND RETURN  .
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    reward points if it is  usefull ...
    Girish

  • Hi gurur's how we  do the interactive report in ALV

    hi gurur's how we  do the interactive report in ALV.
    PLZ HELP ME

    Hi Srivasu,
                    I will send a sample code along with Comments check it once ok.copy the below code and execute it and debug it ok..
    *& Report  YPURCHASEORDER_ALV_LISTDISP                                 *
    *&  DEVELOPER  : KIRAN KUMAR.G                                         *
    &  PURPOSE    : CREATING A PURCHASE ORDER BASED ON PURCHASE DOC NUMBER
    *&  CREATION DT: 22/11/2007                                            *
    *&  REQUEST   : ERPK900035                                             *
    REPORT  YPURCHASEORDER_ALV_LISTDISP.
    Tables
    TABLES : ekko, "Purchasing Document Header
             ekpo. "Purchasing Document Item
    Type pools
    TYPE-POOLS: slis.
    Internal Tables
    DATA: BEGIN OF gt_headerdat OCCURS 0,
           ebeln LIKE ekko-ebeln,        " Purchasing Document Number
           bukrs LIKE ekko-bukrs,        " Company Code
           bstyp LIKE ekko-bstyp,        " Purchasing Document Category
           bsart LIKE ekko-bsart,        " Purchasing Document LIKE
           aedat LIKE ekko-aedat,        " Date on which the recordwascreate
           ernam LIKE ekko-ernam,        " Name of Person who Created Object
           lifnr LIKE ekko-lifnr,        " Vendor's account number
           spras LIKE ekko-spras,        " Language Key
           ekorg LIKE ekko-ekorg,        " Purchasing Organization
           ekgrp LIKE ekko-ekgrp,        " Purchasing group
          END OF gt_headerdat.
    DATA: BEGIN OF gt_item OCCURS 0,
           matnr LIKE ekpo-matnr,        "Material Number
           werks LIKE ekpo-werks,        "Plant
           lgort LIKE ekpo-lgort,        "Storage location
           matkl LIKE ekpo-matkl,        "Material group
           menge LIKE ekpo-menge,        "Purchase order quantity
           meins LIKE ekpo-meins,        "Order unit
           netpr LIKE ekpo-netpr,        "Net price in purchasing document
           kunnr LIKE ekpo-kunnr,        "Customer Number 1
          END OF gt_item.
    Global Structures
    DATA: gt_header    TYPE slis_t_listheader, "For Headings
          wa_header    TYPE slis_listheader,
          gt_fieldcat  TYPE slis_t_fieldcat_alv, "Structure Defintion
          wa_fieldcat  TYPE slis_fieldcat_alv,
          gt_fieldcat1 TYPE slis_t_fieldcat_alv,
          wa_fieldcat1 TYPE slis_fieldcat_alv,
          wa_layout    TYPE slis_layout_alv,     "Layout
          gt_events    TYPE slis_t_event,        "For Events
          wa_events    TYPE slis_alv_event.
    Selection Screen
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS  : s_ebeln FOR ekko-ebeln.
    SELECTION-SCREEN: END OF BLOCK b1.
    Initialization
    INITIALIZATION.
      PERFORM initial.
    Fetch Data
    START-OF-SELECTION.
      PERFORM fetch_data.
    END-OF-SELECTION.
    Bulid fieldcatalog
      PERFORM fieldcat.
    Change fieldcatalog
      PERFORM fieldcat_change.
    Events Triggering
      PERFORM place_events.
    Layout.
      PERFORM layout.
    Display Data
      SORT gt_headerdat BY ebeln.
      PERFORM display_list.
    *&      Form  initial
          text
    -->  p1        text
    <--  p2        text
    FORM initial .
      s_ebeln-sign    = 'I'.
      s_ebeln-option  = 'BT'.
      s_ebeln-low     = '3000000090'.
      s_ebeln-high    = '3000000166'.
      APPEND s_ebeln.
    ENDFORM.                    " initial
    *&      Form  fetch_data
          text
    -->  p1        text
    <--  p2        text
    FORM fetch_data .
      REFRESH gt_headerdat.  "Clear the Body of Internal Table
      CLEAR   gt_headerdat.  "Clear Header Line
      SELECT ebeln
             bukrs
             bstyp
             bsart
             aedat
             ernam
             lifnr
             spras
             ekorg
             ekgrp
        FROM ekko
        INTO TABLE gt_headerdat
       WHERE ebeln IN s_ebeln.
    ENDFORM.                    " fetch_data
    *&      Form  display_list
          text
    -->  p1        text
    <--  p2        text
    FORM display_list .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
        i_callback_program             = sy-cprog
      I_CALLBACK_PF_STATUS_SET       = ' '
        i_callback_user_command        = 'USERCOMMAND'
      I_STRUCTURE_NAME               =
        is_layout                      = wa_layout
        it_fieldcat                    = gt_fieldcat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
        it_events                      = gt_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
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
        t_outtab                       = gt_headerdat
       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.                    " display_list
    *&      Form  place_events
          text
    -->  p1        text
    <--  p2        text
    FORM place_events .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = gt_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.
      CLEAR wa_events.   "Clear Header Line
      READ TABLE gt_events INTO wa_events WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_events-form = 'HEADING'.
        MODIFY gt_events FROM wa_events INDEX sy-tabix.
      ENDIF.
      CLEAR wa_events.   "Clear Header Line
      READ TABLE gt_events INTO wa_events WITH KEY name = 'END_OF_LIST'.
      IF sy-subrc = 0.
        wa_events-form = 'PAGEDOWN'.
        MODIFY gt_events FROM wa_events INDEX sy-tabix.
      ENDIF.
      CLEAR wa_events.    "Clear Header Line
      READ TABLE gt_events INTO wa_events WITH KEY name = 'USER_COMMAND'.
      IF sy-subrc = 0.
        wa_events-form = 'USERCOMMAND'.
        MODIFY gt_events FROM wa_events INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " place_events
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    FORM layout .
      CLEAR wa_layout.                   "Clear Header Line
      wa_layout-zebra = 'X'.             "Zebra Lines in the Output
      wa_layout-colwidth_optimize = 'X'. "Optimize the Column Width
    ENDFORM.                    " layout
    *&      Form  heading
          text
    FORM heading.
      WRITE:/6 'THIS REPORT DISPLAYS THE PURCHASE ORDER DETAILS'.
      WRITE:/6 'CLICK ON PURCHASE DOC NO FIELD(INTERACTIVE LIST)'.
    ENDFORM.                    "heading
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM fieldcat .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
        i_program_name               = SY-CPROG
        i_internal_tabname           = 'GT_HEADERDAT'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
        i_inclname                   = SY-CPROG
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
        CHANGING
        ct_fieldcat                  = gt_fieldcat
       EXCEPTIONS
        inconsistent_interface       = 1
        program_error                = 2
        OTHERS                       = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " fieldcat
    *&      Form  fieldcat_change
          text
    -->  p1        text
    <--  p2        text
    FORM fieldcat_change .
      LOOP AT gt_fieldcat INTO wa_fieldcat.
        CASE wa_fieldcat-fieldname.
          WHEN 'EBELN'.
            wa_fieldcat-hotspot  = 'X'.
        ENDCASE.
        MODIFY gt_fieldcat FROM wa_fieldcat INDEX sy-tabix.
      ENDLOOP.
    ENDFORM.                    " fieldcat_change
    *&      Form  pagedown
          text
    FORM pagedown.
      WRITE:/35 'HAVE A NICE DAY...' COLOR 4.
    ENDFORM.                    "pagedown
    *&      Form  usercommand
          text
         -->UCOMM      text
         -->SELFIELD   text
    FORM usercommand USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      READ TABLE gt_headerdat INDEX selfield-tabindex.
      CASE selfield-sel_tab_field.
        WHEN 'GT_HEADERDAT-EBELN'.
          REFRESH : gt_item.
          CLEAR   : gt_item.
          SELECT matnr
                 werks
                 lgort
                 matkl
                 menge
                 meins
                 netpr
                 kunnr
            FROM ekpo
            INTO TABLE gt_item
           WHERE ekpo~ebeln EQ gt_headerdat-ebeln.
    *Build a Field Catalog
          PERFORM fieldcat1.
    *For Heading in the Interactive List
          PERFORM heading1.
    *Display Interactive Data
          PERFORM display_data1.
      ENDCASE.
    ENDFORM.                    "usercommand
    *&      Form  fieldcat1
          text
    -->  p1        text
    <--  p2        text
    FORM fieldcat1 .
      REFRESH : gt_fieldcat1.
      CLEAR   : wa_fieldcat1.
      wa_fieldcat1-col_pos    = '1'.           "Column Postion
      wa_fieldcat1-fieldname  = 'MATNR'.       "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.   "Internal Table
      wa_fieldcat1-key        = 'X'.           "Blue Color
      wa_fieldcat1-seltext_l  = 'MATERIAL NO'. "Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
      wa_fieldcat1-col_pos    = '2'.           "Column Postion
      wa_fieldcat1-fieldname  = 'WERKS'.       "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.   "Internal Table
      wa_fieldcat1-seltext_l  = 'PLANT'.       "Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
      wa_fieldcat1-col_pos    = '3'.           "Column Postion
      wa_fieldcat1-fieldname  = 'LGORT'.       "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.   "Internal Table
      wa_fieldcat1-seltext_l  = 'STORAGE LOCATION'."Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
      wa_fieldcat1-col_pos    = '4'.            "Column Postion
      wa_fieldcat1-fieldname  = 'MATKL'.        "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.    "Internal Table
      wa_fieldcat1-seltext_l  = 'MATERIAL GRP'. "Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
      wa_fieldcat1-col_pos    = '5'.            "Column Postion
      wa_fieldcat1-fieldname  = 'MENGE'.        "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.    "Internal TAble
      wa_fieldcat1-seltext_l  = 'PO QUANTITY'.  "Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
      wa_fieldcat1-col_pos    = '6'.            "Column Pos tion
      wa_fieldcat1-fieldname  = 'MEINS'.        "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.    "Internal TAble
      wa_fieldcat1-seltext_l  = 'BASE UNIT MEASURE'."Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
      wa_fieldcat1-col_pos    = '7'.            "Column Postion
      wa_fieldcat1-fieldname  = 'NETPR'.        "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.    "Internal Table
      wa_fieldcat1-seltext_l  = 'NET PRICE'.    "Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
      wa_fieldcat1-col_pos    = '8'.            "Column Postion
      wa_fieldcat1-fieldname  = 'KUNNR'.        "Field Name
      wa_fieldcat1-tabname    = 'GT_ITEM'.    "Internal Table
      wa_fieldcat1-seltext_l  = 'CUSTOMER NO'.  "Display Text Screen
      APPEND wa_fieldcat1 TO gt_fieldcat1.
      CLEAR wa_fieldcat1.
    ENDFORM.                                                    " fieldcat1
    *&      Form  heading1
          text
    -->  p1        text
    <--  p2        text
    FORM heading1 .
      REFRESH : gt_header.
      CLEAR   : wa_header.
      wa_header-typ  = 'H'.
      wa_header-info = 'THIS IS AN INTERACTIVE LIST'.
      APPEND wa_header TO gt_header.
    ENDFORM.                                                    " heading1
    *&      Form  top
          text
    FORM top.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
        it_list_commentary       = gt_header
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
    ENDFORM.                    "top
    *&      Form  display_data1
          text
    -->  p1        text
    <--  p2        text
    FORM display_data1 .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
        i_callback_program                = SY-CPROG
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
        i_callback_top_of_page            = 'TOP'
      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                         =
        it_fieldcat                       = gt_fieldcat1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
        t_outtab                          = gt_item
       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.                    " display_data1
    Reward points if helpful.
    Kiran Kumar.G.A
            Have a Nice Day..

  • How to disable line selection functionality in ALV.

    Hallo guys,
    I need to disable the ALV functionality to select one(or more) lines.
    How to hide this push button on the right side?
    Thanks.

    hi
    good
    check this
    *& Report  ZDEMO_ALVGRID_SELROW                                        *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display capture each row a user has *
    *& selected                                                            *
    REPORT  zdemo_alvgrid_selrow                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      SEl,                         "stores which row user has selected
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-box_fieldname     = 'SEL'.
                                     "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into corresponding fields of table it_ekko.
    endform.                    " DATA_RETRIEVAL
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
        WHEN '&DATA_SAVE'.  "user presses SAVE
        loop at it_ekko into wa_ekko.
          if wa_ekko-sel EQ 'X'.
          Process records that have been selected
          endif.
        endloop.
      ENDCASE.
    ENDFORM.
    thanks
    mrutyun^

  • How to edit only some rows in ALV

    Hi Experts,
    I have editable ALV. I need to allow edit only for some rows, not generaly all of them.
    Do you have any idea how to do it?
    I use ALV through FM module REUSE_ALV_GRID_DISPLAY.
    Thenks&regards,
    Jirka

    Hi,
    You need to use events. Sample code from sdn.
    TYPE-POOLS:SLIS.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    data: begin of it_chg occurs 0,
          index type sy-tabix,
          end of it_chg.
    DATA:  X_EVENTS    TYPE SLIS_ALV_EVENT.
    DATA: BEGIN OF ITAB OCCURS 0,
          NAME(10) TYPE C,
          ZTERM TYPE C,
          END OF ITAB.
    PERFORM FILL_TABLE.
    loop at itab where zterm = 'A'.
    it_chg-index = sy-tabix + 3. 
    " addition 3 IS FOR FIELD LABELS
    append it_chg.
    clear it_chg.
    endloop.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    **fieldcatalog
    X_FIELDCAT-FIELDNAME = 'NAME'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '10'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-FIELDNAME = 'ZTERM'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '10'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    **events
    REFRESH:IT_EVENTS.
    CLEAR:X_EVENTS,IT_EVENTS.
    X_EVENTS-NAME = SLIS_EV_END_OF_LIST.
    X_EVENTS-FORM = 'MODIFY_LIST'.
    APPEND X_EVENTS TO IT_EVENTS.
    CLEAR X_EVENTS.
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = SY-REPID
          IT_FIELDCAT        = IT_FIELDCAT
          IT_EVENTS          = IT_EVENTS
        TABLES
          T_OUTTAB           = ITAB
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *&      Form FILL_TABLE
          text
    FORM FILL_TABLE.
      ITAB-NAME = 'vijay'.
      ITAB-ZTERM = 'A'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'ABC'.
      ITAB-ZTERM = 'B'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'TEST'.
      ITAB-ZTERM = 'C'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'DILIP'.
      ITAB-ZTERM = 'D'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = '123'.
      ITAB-ZTERM = 'E'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'GEN'.
      ITAB-ZTERM = 'A'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'ALV'.
      ITAB-ZTERM = 'F'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'ALVTEST'.
      ITAB-ZTERM = 'A'.
      APPEND ITAB.
      clear itab.
    ENDFORM.                    "FILL_TABLE
    *&      Form  MODIFY_LIST
          text
    FORM MODIFY_LIST.
    data: l_lines type i.
    describe table itab lines l_lines.
      L_LINES  = L_LINES + 3.
      "because we have 3 lines extra occupied by lables.
      "if we have header,i mean top of page add the no.of lines
      "how many ever top of page have + 3 for labels.
      DO L_LINES TIMES.
        read table it_chg with key INDEX = sy-index.
        if sy-subrc = 0.
    **This code is for reading the out put line
    **and modify accordinlg to our requiremnet.
    **don't chnage this.
          READ LINE SY-INDEX INDEX SY-LSIND.
          IF SY-SUBRC = 0.
            MODIFY LINE SY-INDEX INDEX SY-LSIND
                       FIELD FORMAT ITAB-NAME INPUT.
          ENDIF.
        ENDIF.
      ENDDO.
    ENDFORM.                    "MODIFY_LIST

  • Help,Webdynpro ALV report

    Hello,
    My Webdynpro ALV report display SFLIGHT all fields .
    But I want to show only five fields,
    how code?
    CODE::
    data:node_flights type ref to if_wd_context_node,
           it_flights type sflight_tab1,
           is_flights type sflight,
           it_final type IF_MAIN=>elements_flights,
           is_final type IF_MAIN=>element_flights.
      select * from sflight into table it_flights up to 10 rows.
      node_flights = wd_context->get_child_node( 'FLIGHTS' ).
      data:l_ref_cmp_usage type ref to if_wd_component_usage.
      l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
      data:l_ref_interfacecontroller type ref to iwci_salv_wd_table.
      l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
    navigate from <CONTEXT> to <NODE_FLIGHT> via lead selection
      node_flights = wd_context->get_child_node( name = `NODE_FLIGHT` ).
    fill context node
      node_flights ->bind_table( it_flight ).
    endmethod.
    thanks

    HI,
    There is no need to change your code.
    Do one thing.
    Create a node SFLIGHT and do not add dictionary structure SFLIGHT.
    Then create what are the required five attributes under it.
    Make sure all these five refer to the dictionary data elements.
    example: If you want carrid declare dectionary structure S_CARR_ID.
    Like wise.
    Now finally goto component usage->ALV->INTERFACECONTROLLER in the
    left side tree of web dynpro component.
    Then create component usage and drag SFLIGHT node to DATA of the context.
    It is one of the way.
    Second way is.
    Create SFLIGHT node and mention SFLIGHT as stricture and select five required attributes that you need.
    Now after creation of SFLIGHT NODE just delete the structure name present in the PROPERTIES of
    SFLIGHT NODE.
    Now finally goto component usage->ALV->INTERFACECONTROLLER in the
    left side tree of web dynpro component.
    Then create component usage and drag SFLIGHT node to DATA of the context.
    I hope it helped you.
    Regards and Best wishes.

  • How to trigger top-of-page in ALV Grid

    How to trigger Top-Of-Page in ALV Grid...
    can any one plese send the sample code...
    thanks.

    here is sample code. try this. u need to build an internal table and then call function commentary write and pass that internal table.
    *&      Form  TOP_OF_PAGE
          Top_of_page
    FORM top-of-page.                                           "#EC CALLED
    *ALV Header declarations
      DATA: lit_header TYPE slis_t_listheader,
            lwa_header TYPE slis_listheader.
    Title
      lwa_header-typ  = 'H'.
      lwa_header-info = text-013.
      APPEND lwa_header TO lit_header.
      CLEAR lwa_header.
    BOM Number
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
        EXPORTING
          input  = p_matnr
        IMPORTING
          output = gv_matnr.
    Pass BOM number
      lwa_header-typ  = 'S'.
      lwa_header-key = text-014.
      lwa_header-info = gv_matnr .
      APPEND lwa_header TO lit_header.
      CLEAR: lwa_header ,
             gv_matnr .
    BOM description
      lwa_header-typ  = 'S'.
      lwa_header-key = text-015 .
      lwa_header-info = gv_maktx .
      APPEND lwa_header TO lit_header.
      CLEAR: lwa_header.
    start/end date format MM/DD/YY
      lwa_header-typ  = 'S'.
      lwa_header-key = text-016 .
      CONCATENATE s_erdat-low+4(2) '/'
                  s_erdat-low+6(2) '/'
                  s_erdat-low(4) ' - '
                  s_erdat-high+4(2) '/'
                  s_erdat-high+6(2) '/'
                  s_erdat-high(4)
                  INTO lwa_header-info.
      APPEND lwa_header TO lit_header.
      CLEAR: lwa_header.
    Run Date of Report format MM/DD/YY
      lwa_header-typ  = 'S'.
      lwa_header-key = text-017 .
      CONCATENATE  sy-datum+4(2) '/'
                   sy-datum+6(2) '/'
                   sy-datum(4) INTO lwa_header-info .
      APPEND lwa_header TO lit_header.
      CLEAR: lwa_header.
    call function REUSE_ALV_COMMENTARY_WRITE to use TOP_OF_PAGE event.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = lit_header.
    ENDFORM .                              " FORM top-of-page.

  • How to convert an Interactive report to ALV report..please give a example..

    Hi experts,
    How to convert an interactive report to ALV report..plz suggest me an example...
    thanks in advance,
    Varsha.

    hi varsha,
    chk this link.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
    you will get good idea.
    use this FM.
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE' 
                I_callback_user_command = 'USER_COMMAND' 
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]      "create a field catlog.
                i_save                  = 'X'
           tables
                t_outtab                = it_tab        "pass the final internal table.
           exceptions
                program_error           = 1
                others                  = 2.
    Regards
    Anver

  • How to call BSP page from Webdynpro ABAP ?

    Hi All,
         I have a BSP page which has a page attibute . I need to pass a parameter from Webdynpro ALV table to the BSP page attibute and also need to display that BSP Page . Can any one help me out , how to proceed in this ?
    Regards,
    Kalpana A .

    hi kalpana,
    Use Exit Plug and pass data as URL Parameter.
    http://help.sap.com/saphelp_nw04s/helpdata/en/45/1bc575ba064574e10000000a114a6b/content.htm
    for how to pass url please check this
    http://help.sap.com/saphelp_nw70/helpdata/EN/7b/fb57412df8091de10000000a155106/frameset.htm
    Yogesh N

  • How to insert blank lines in the ALV output.

    Hi Friends,
    Could any body help me out How to insert blank lines in the ALV output.?? Any Code pls...
    Thank you,
    Vikram.C

    hi vikram
    do like this
    In the fieldcatalog table all the fields should be in editable mode
    ie lw_fcat-edit = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    is_layout = lv_layout
    it_fieldcat = lt_fcat[]
    i_save = 'A'
    is_variant = lv_variant
    TABLES
    t_outtab = lt_license[]
    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. " display_data
    *& Form user_command
    FORM user_command USING r_ucomm TYPE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN 'ADD'. "
    data: lv_ind type i.
    data: lv_line type i.
    describe table lt_license lines lv_line.
    loop at lt_license into lw_license.
    lv_ind = sy-tabix.
    if lv_ind = lv_line.
    append initial line to lt_license.
    endif.
    endloop.
    ENDCASE.
    ENDFORM. "user_command
    reward points if useful
    Rohan

Maybe you are looking for