Interactive alv report with migo miro and purchase order

hi all
to make my alv interactive i put the following code....
i dont know whether it is correct or not coz i hav not done alv before
FORM display.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-cprog
      is_layout          = wa_layout
      I_CALLBACK_USER_COMMAND  = 'HANDLE_USER_COMMAND'
      it_fieldcat        = it_fieldcat
    TABLES
      t_outtab           = itab.
ENDFORM.                    "DISPLAY
FORM HANDLE_USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                              RS_SELFIELD TYPE SLIS_SELFIELD.
   CASE R_UCOMM.
    WHEN '&IC1'.
      IF RS_SELFIELD-FIELDNAME = 'EBELN'.
        READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
        SET PARAMETER ID 'ITAB-EBELN' FIELD ITAB-EBELN.
       call transaction 'ME23N' AND SKIP FIRST SCREEN.
       CLEAR RS_SELFIELD.
      ENDIF.
  ENDCASE.
ENDFORM.                    "HANDLE_USER_COMMAND
this code is working
but i hav some problems
when ever i double click on PO number
1. it always opne the last PO number of the my alv list
2. I want to open the migo with migo number when i double clik on the migo number
3. and same for the MIRO
plz help its very urgent...
points wil b rewarded.

Hi,
Following report will explains how to do interactive list in alv report regarding purchase order. Kindly go through that one.
REPORT  YMS_ALVINTERSAMPLE NO STANDARD PAGE HEADING LINE-SIZE 650
MESSAGE-ID ZZ_9838.
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
       EBELN LIKE EKKO-EBELN,
       AEDAT LIKE EKKO-AEDAT,
       BUKRS LIKE EKKO-BUKRS,
       BSART LIKE EKKO-BSART,
       LIFNR LIKE EKKO-LIFNR,
       END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
      WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
       EBELN LIKE EKPO-EBELN,
       EBELP LIKE EKPO-EBELP,
       MATNR LIKE EKPO-MATNR,
       MENGE LIKE EKPO-MENGE,
       MEINS LIKE EKPO-MEINS,
       NETPR LIKE EKPO-NETPR,
       END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
      WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
      WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
      I_VARIANT1 TYPE DISVARIANT,
      I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
  V_REPID = SY-REPID.
  PERFORM BUILD_FIELDCATLOG.
  PERFORM EVENT_CALL.
  PERFORM POPULATE_EVENT.
START-OF-SELECTION.
  PERFORM DATA_RETRIEVAL.
  PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
  PERFORM DISPLAY_ALV_REPORT.
*&      Form  BUILD_FIELDCATLOG
      Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
  WA_FIELDCAT-TABNAME = 'IT_EKKO'.
  WA_FIELDCAT-FIELDNAME = 'EBELN'.
  WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_EKKO'.
  WA_FIELDCAT-FIELDNAME = 'AEDAT'.
  WA_FIELDCAT-SELTEXT_M = 'DATE.'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_EKKO'.
  WA_FIELDCAT-FIELDNAME = 'BUKRS'.
  WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
  WA_FIELDCAT-FIELDNAME = 'BUKRS'.
  WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
  WA_FIELDCAT-FIELDNAME = 'LIFNR'.
  WA_FIELDCAT-NO_OUT    = 'X'.
  WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
ENDFORM.                    "BUILD_FIELDCATLOG
*&      Form  EVENT_CALL
  we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
   EXPORTING
     I_LIST_TYPE           = 0
   IMPORTING
     ET_EVENTS             = V_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.
ENDFORM.                    "EVENT_CALL
*&      Form  POPULATE_EVENT
     Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
  READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
  IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
  ENDIF.
  READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
  IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'USER_COMMAND'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
  ENDIF.
ENDFORM.                    "POPULATE_EVENT
*&      Form  data_retrieval
  retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
  SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM.                    "data_retrieval
*&      Form  bUild_listheader
      text
     -->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
  DATA HLINE TYPE SLIS_LISTHEADER.
  HLINE-INFO = 'this is my first alv pgm'.
  HLINE-TYP = 'H'.
ENDFORM.                    "build_listheader
*&      Form  display_alv_report
      text
FORM DISPLAY_ALV_REPORT.
  V_REPID = SY-REPID.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM                = V_REPID
  I_CALLBACK_PF_STATUS_SET          = ' '
     I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
     I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
     I_GRID_TITLE                      = I_TITLE_EKKO
  I_GRID_SETTINGS                   =
  IS_LAYOUT                         = ALV_LAYOUT
     IT_FIELDCAT                       = I_FIELDCAT[]
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  IT_SORT                           =
  IT_FILTER                         =
  IS_SEL_HIDE                       =
    i_default                         = 'ZLAY1'
     I_SAVE                            = 'A'
    is_variant                        = i_variant
     IT_EVENTS                         = V_EVENTS
    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  TOP_OF_PAGE
      text
FORM TOP_OF_PAGE.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_LISTHEADER
   i_logo                   =
   I_END_OF_LIST_GRID       =
ENDFORM.                    "TOP_OF_PAGE
*&      Form  USER_COMMAND
      text
     -->R_UCOMM    text
     -->,          text
     -->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
  CASE R_UCOMM.
    WHEN '&IC1'.
      READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
      PERFORM BUILD_FIELDCATLOG_EKPO.
      PERFORM EVENT_CALL_EKPO.
      PERFORM POPULATE_EVENT_EKPO.
      PERFORM DATA_RETRIEVAL_EKPO.
      PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_EKPO.
  ENDCASE.
ENDFORM.                    "user_command
*&      Form  BUILD_FIELDCATLOG_EKPO
      text
FORM BUILD_FIELDCATLOG_EKPO.
  WA_FIELDCAT-TABNAME = 'IT_EKPO'.
  WA_FIELDCAT-FIELDNAME = 'EBELN'.
  WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'IT_EKPO'.
  WA_FIELDCAT-FIELDNAME = 'EBELP'.
  WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-TABNAME = 'I_EKPO'.
  WA_FIELDCAT-FIELDNAME = 'MATNR'.
  WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
  WA_FIELDCAT-FIELDNAME = 'MENGE'.
  WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
  WA_FIELDCAT-FIELDNAME = 'MEINS'.
  WA_FIELDCAT-SELTEXT_M = 'UOM'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
  WA_FIELDCAT-FIELDNAME = 'NETPR'.
  WA_FIELDCAT-SELTEXT_M = 'PRICE'.
  APPEND WA_FIELDCAT TO I_FIELDCAT.
  CLEAR WA_FIELDCAT.
ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
*&      Form  event_call_ekpo
  we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
   EXPORTING
     I_LIST_TYPE           = 0
   IMPORTING
     ET_EVENTS             = V_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.
ENDFORM.                    "event_call_ekpo
*&      Form  POPULATE_EVENT
       Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
  READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
  IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
  ENDIF.
  ENDFORM.                    "POPULATE_EVENT
*&      Form  TOP_OF_PAGE
      text
FORM F_TOP_OF_PAGE.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_LISTHEADER
   i_logo                   =
   I_END_OF_LIST_GRID       =
ENDFORM.                    "TOP_OF_PAGE
*&      Form  USER_COMMAND
      text
     -->R_UCOMM    text
     -->,          text
     -->RS_SLEFIELDtext
*retreiving values from the database table ekko
FORM DATA_RETRIEVAL_EKPO.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
ENDFORM.
FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: HLINE1 TYPE SLIS_LISTHEADER.
HLINE1-TYP = 'H'.
HLINE1-INFO = 'CHECKING PGM'.
ENDFORM.
FORM DISPLAY_ALV_EKPO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                = ' '
  I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = V_REPID
  I_CALLBACK_PF_STATUS_SET          = ' '
  I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
   I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  =
  I_BACKGROUND_ID                   = ' '
   I_GRID_TITLE                      = I_TITLE_EKPO
  I_GRID_SETTINGS                   =
  IS_LAYOUT                         =
   IT_FIELDCAT                       = I_FIELDCAT[]
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  IT_SORT                           =
  IT_FILTER                         =
  IS_SEL_HIDE                       =
  I_DEFAULT                         =
   I_SAVE                            = 'A'
  IS_VARIANT                        =
   IT_EVENTS                         = V_EVENTS
  TABLES
    T_OUTTAB                          = IT_EKPO
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.
Thanks,
Sankar  M

Similar Messages

  • Create a Procedural ALV Report with editable fields and save the changes

    Hi,
    I am new to ABAP. I have created a Procedural ALV Report with 3 fields. I want to make 2 fields editable. When executed, if the fields are modified, I want to save the changes. All this I want to do without using OO concepts. Please help . Also, I checked out the forum and also the examples
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDIT_02
    BCALV_TEST_GRID_EDIT_04_FORMS
    BCALV_TEST_GRID_EDITABLE
    BCALV_EDIT_01
    BCALV_EDIT_02
    BCALV_EDIT_03
    BCALV_EDIT_04
    BCALV_EDIT_05
    BCALV_EDIT_06
    BCALV_EDIT_07
    BCALV_EDIT_08
    BCALV_FULLSCREEN_GRID_EDIT
    But all these are using OO Concepts.
    Please help.
    Regards,
    Smruthi

    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      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,
      line_color(4) TYPE c,     "Used to store row color attributes
    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.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      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-edit             = 'X'
      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-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-info_fieldname =      'LINE_COLOR'.
    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_pf_status_set = 'STATUS'
                i_callback_top_of_page   = 'TOP-OF-PAGE'
               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.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      DATA: ld_color(1) TYPE c.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
      LOOP AT it_ekko INTO wa_ekko.
        ld_color = ld_color + 1.
        IF ld_color = 8.
          ld_color = 1.
        ENDIF.
        CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
        MODIFY it_ekko FROM wa_ekko.
      ENDLOOP.
    ENDFORM.                    " DATA_RETRIEVAL
          FORM top-of-page                                              *
    FORM top-of-page.
      WRITE:/ 'This is First Line of the Page'.
    ENDFORM.
          FORM status                                                   *
    FORM status USING rt_extab TYPE slis_t_extab.  .
      SET PF-STATUS 'ALV'.
    ENDFORM.
          FORM USER_COMMAND                                          *
    -->  RF_UCOMM                                                      *
    -->  RS                                                            *
    FORM user_command USING rf_ucomm LIKE sy-ucomm
                             rs TYPE slis_selfield.            
      DATA ref1 TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref1.
      CALL METHOD ref1->check_changed_data.
      CASE rf_ucomm.
    when 'SAVE'.
    get all the modified entries and store them in an internal table and udpate them in to the required transaction or your custom table.
    endcase.
    endform.
    ENDFORM.
    here u need to 2 performs for PF status and USER_COMMAND in the ALV parameters.
    create a custom PF status and create push buttons and assign your ok codes in your PF status.
    if the field has to be edited in the ALV then pass EDIT = 'X' for that field in the fieldcatlog preparation.
    Hope this will help you.
    Regards,
    phani.

  • Create a ALV report with fields editable and  entry to be saved in ztable

    Hello Experts,
    I have created the ALV report which has two of the fields editable. Now whenever user puts an entry in the ALV it has to be saved in the ZTABLE.
    The report is displayed with editable fields but i'm not sure what has to be written in the 'USER COMMAND' subroutine to save the entries in ztable.
    Please see my code belwo:-
      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 = 'ALV_USER_COMM'
               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_bg2
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    Thanks,
    Naveen
    Edited by: jaikrishna on Sep 4, 2010 8:13 AM

    Hi,
    I have worked on similar requirement. You can do that on sy-ucomm value only and you have to call a FM and a method. For that end user has to click on a button which you need to create in the application toolbar. Say that button function code is 'SAVE'. Write the following code in your user command :
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
            RS_SELFIELD TYPE SLIS_SELFIELD.
    *Code to reflect the changes done in the internal table
      DATA : REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA: L_VALID TYPE C.
      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
          IMPORTING
            E_VALID = L_VALID.
      ENDIF.
      CASE SY-UCOMM.
        WHEN 'SAVE'.
    *Data will come with the edited values from ALV
    *Here you write your code to save entries into Z table
    ENDCASE.
    ENDFORM. "USER_COMMAND
    Thanks & Regards,
    Rock.

  • ALV report with dynamic columns, and repeated structure rows

    Hey Guys,
    I've done some ALV programming, but most of the reports were straight forward. This one is a little interesting. So here go the questions...
    Q1: Regarding Columns:
    What is the best way to code a report with columns being dynamic. This is one of the parameters the user is going to enter in his input.
    Q2: Regarding Rows:
    I want to repeat a structure(say it contains f1, f2, f3) multiple time in rows. What is the best way to do it? The labels for these fields have to appear in the first column.
    Below is the visual representation of the questions.
    Jan 06  , Feb 06, Mar 06....(dynamic)
       material 1
    Current Stock
    current required
    $Value of stock
       material 2
    Current Stock
    current required
    $Value of stock
       material 3
    Current Stock
    current required
    $Value of stock
    Thanks for your help.
    Sumit.

    Hi Sumit,
    Just check this sample from one of the SAP site
    ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
    Applies To:
    ABAP / ALV Grid
    Article Summary
    ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
    Code Sample
    REPORT zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring.
    * Build a field catalog dynamically and provide the ability to color
    * the cells.
    * To test, copy this code to any program name and create screen 100
    * as described in the comments. After the screen is displayed, hit
    * enter to exit the screen.
    * Tested in 4.6C and 6.20
    * Charles Folwell - [email protected] - Feb 2, 2005
    DATA:
    r_dyn_table TYPE REF TO data,
    r_wa_dyn_table TYPE REF TO data,
    r_dock_ctnr TYPE REF TO cl_gui_docking_container,
    r_alv_grid TYPE REF TO cl_gui_alv_grid,
    t_fieldcat1 TYPE lvc_t_fcat, "with cell color
    t_fieldcat2 TYPE lvc_t_fcat, "without cell color
    wa_fieldcat LIKE LINE OF t_fieldcat1,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_is_layout TYPE lvc_s_layo.
    FIELD-SYMBOLS:
    <t_dyn_table> TYPE STANDARD TABLE,
    <wa_dyn_table> TYPE ANY,
    <t_cellcolors> TYPE lvc_t_scol,
    <w_field> TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
    wa_fieldcat-fieldname = 'FIELD1'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 1'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    wa_fieldcat-fieldname = 'FIELD2'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 2'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table, save fieldcatalog to pass
    * to ALV call. The ALV call needs a fieldcatalog without
    * the internal table for cell coloring.
    t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    * CALENDAR_TYPE is a structure in the dictionary with a
    * field called COLTAB of type LVC_T_SCOL. You can use
    * any structure and field that has the type LVC_T_SCOL.
    wa_fieldcat-fieldname = 'T_CELLCOLORS'.
    wa_fieldcat-ref_field = 'COLTAB'.
    wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table including the internal table
    * for cell coloring.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = t_fieldcat1
    IMPORTING
    ep_table = r_dyn_table
    EXCEPTIONS
    generate_subpool_dir_full = 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.
    * Get access to new table using field symbol.
    ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
    CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
    ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere. Field names are
    * known at this point because field catalog is already
    * built. Read field names from the field catalog or use
    * COMPONENT <number> in a DO loop to access the fields. A
    * simpler hard coded approach is used here.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'ABC'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'XYZ'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'TUV'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'DEF'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. In this example, a test on
    * FIELD2 is used to decide on color.
    LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    * Get access to internal table used to color cells.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
    CLEAR wa_cellcolors.
    wa_cellcolors-fname = 'FIELD2'.
    IF <w_field> = 'DEF'.
    wa_cellcolors-color-col = '7'.
    ELSE.
    wa_cellcolors-color-col = '5'.
    ENDIF.
    APPEND wa_cellcolors TO <t_cellcolors>.
    MODIFY <t_dyn_table> FROM <wa_dyn_table>.
    ENDLOOP.
    * Display screen. Define screen 100 as empty, with next screen
    * set to 0 and flow logic of:
    * PROCESS BEFORE OUTPUT.
    * MODULE initialization.
    * PROCESS AFTER INPUT.
    CALL SCREEN 100.
    * MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
    IF r_dock_ctnr IS INITIAL.
    CREATE OBJECT r_dock_ctnr
    EXPORTING
    side = cl_gui_docking_container=>dock_at_left
    ratio = '90'.
    CREATE OBJECT r_alv_grid
    EXPORTING i_parent = r_dock_ctnr.
    * Set ALV controls for cell coloring table.
    wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    * Display.
    CALL METHOD r_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = wa_is_layout
    CHANGING
    it_outtab = <t_dyn_table>
    it_fieldcatalog = t_fieldcat2.
    ELSE. "grid already prepared
    * Refresh display.
    CALL METHOD r_alv_grid->refresh_table_display
    EXPORTING
    i_soft_refresh = ' '
    EXCEPTIONS
    finished = 1
    OTHERS = 2.
    ENDIF.
    ENDMODULE. " initialization OUTPUT
    Regards
    vijay

  • Report with default adress from Purchase order

    Hi
    I'm loooking for a report which can give me the adress infomation for each purchase order? please notice that I¨'m looking for the default adress and therefore do not have an adress number!

    then you should try to think how SAP could find this address from table ADRC when you open ME23N and you would not have any link in purchase order item table
    ADRNR field in table EKPO cannot be seen in ME23N.
    the address number field in delivery address screen is actually EKPO-ADNR2.
    if both fields do not have an entry, then it is the standard default which I explain earlier. and not manually entered/changed.

  • Problem with services hierarchy and purchase order

    Hi I'm in Srm 7 EHP8(classic scenario) and i have a problem with services hierarchies:
    I create a Purchase requisition in ECC with the next structure:
    1.Hier
    1.1 Serv1
    1.2 Serv2
    1.3 Serv3
    Then I upload this PR to SRM(I activated the BBP_EXTLOCALPO_BADI to change to the Extended-classic scenario to upload correctly the hierarchy)
    and in the SOCO  I only choose the position 1.1 Serv1 and create a purchase order.
    The problem is the purchase order created in ECC contain all the services of the purchase requisition, not only the service I choose(1.1 Serv1) to create the purchase order, in SRM the purchase order is correct with only one position(1.1 Serv1)
    Any Idea?.
    Thanks for the help.

    Hi,
    I have the same problem, any new about that?
    Rgs,
    Pedro

  • Purchase order report with basic price and Excise duty values

    Hi All,
    Is there any standard report in SAP to get the Purchase order basic price / qty and its Excise duty values ? Since we are including Excise duties for non - codified items (w/o material master and with cost center 'K') Purchase order and the ed values are added to the cost and the requirement is to see the split up (Basic priceEdEcs+Hcs)for these Purchase orders for the vendors. If there is no std report then please let me know how to link Purchase order table with this Condition value table in query to get the desired report.
    Thanks in advance
    Benny

    Hi,
    there is no standert report to fullfill this requierment
    you have to create this report with the help of abaer
    for that which tax code you are using its importnat thing
    for po table EKPO
    1. A524 (Normal supply point / Material) it will return condition record number for condition type.
    2. KONP (Conditions (Item)) .
    3. J_1IMTCHID (Combination of Material Number and Chapter ID).
    4. J_1IEXCTAX (Tax calc. - Excise tax rates
    5 get the IR no. from RBKP and RSEG, and get the relevant FI doc no. and goto BSET table
    for IR number  to get from table apply logic for doc type RE ,you will get fi number nad in refernce field you will get invoice number + fiscal year
    Map this by refernig on po for which grn and invoice happen
    Regards
    Kailas Ugale

  • Report with purchase requisitions and purchase orders: how?

    Hi,
    I need to get a list of items bought with their purchase requisitions and purchase orders (when they exist). This can be done looking at each purchase order (ME23N), ou purchase requisition (ME53N), and writing it down. But in some cases, I have to do it on about 450 operations. I'd like to get this list without having to search for each requisition ou order. I can get a complete list of orders and requisitions, but without any relationship between them (they are mixed as if they were the same thing, but there´s a field telling it that row is an order or a requisition). Using some macros in excel, I can find this relationship in 40% of the cases (for example, if item 421351 was purchased only once, an order for item 421351 is related to a requisition for item 421351). Is there any way to get this list automatically? Or is there any field that tell me this relationship?
    Thanks,
    Francisco Morbiolo
    Votorantim Cimentos
    Votorantim, SP - Brazil

    Sorry, I forgot to tell this: I don´t have access to SQ01/SQ02/SQ03.
    I get the orders and requisition reports using ZGLPS020.
    Thanks,
    Francisco Morbiolo
    Votorantim Cimentos
    Votorantim, SP - Brazil

  • Different between coding of simple ALV report and interactive ALV report

    Hi
    Please some one tell me the difference (extra coding) for interactive ALV report.
    I know how to design simple ALV report but i dont know what extra I hace to code for interactive ALV report.
    Thanks in advance.

    View at se38, ALV grid demos,  search BCALGRID

  • ALV Reporting with drill down capabillities

    I'm creating a abap custom report using the ALV.  I want to drill down to CJ03 which is projects.  I know how to do it in regular custom reporting, but I don't seem to be able to get it to work using the ALV.  Can anyone help?
    Thanks.
    Linda

    Hi Linda,
    Take a look at this sample program. The logic to handle any interaction with the user is in my "PORCESS_USER_COMMANDS" routine.
    This is defined in the "I_CALLBACK_USER_COMMAND" parameter in the ALV FM.
    Hope this helps.
    Cheers,
    Pat.
    [code]
    Modification History
    Date      | Author    | Chg Req #     | Description
    15.08.2001| Pat Yee   | $TMP          | Program Creation
    This program is an example of how the ALV Display works.
    It will display Customer Data.
    This report will also show how to display an ALV report with different
    colored lines and icons
    REPORT zpat.
    Include Programs
    INCLUDE <icon>.
    Database Tables
    TABLES: kna1.                  "Customer Master
    Types
    TYPE-POOLS: kkblo.
    Structures
    Structure to hold the Color Information
    DATA: BEGIN OF st_color,
            color(3) TYPE c,
          END OF st_color.
    Structure to hold the Icon Information
    DATA: BEGIN OF st_icon,
            icon(4) TYPE c,
          END OF st_icon.
    ALV Field Catalog Structure
    DATA: st_fieldcat   TYPE slis_fieldcat_alv.
    ALV Layout Structure
    DATA: st_layout     TYPE slis_layout_alv.
    Internal Tables
    Output Table
    DATA: BEGIN OF tbl_kna1 OCCURS 0.
            INCLUDE STRUCTURE st_icon.   "Icon Structure
            INCLUDE STRUCTURE kna1.      "Customer Master Structure
            INCLUDE STRUCTURE st_color.  "Color Structure
    DATA: END OF tbl_kna1.
    ALV Field Catalog Table
    DATA: tbl_fieldcat  TYPE slis_t_fieldcat_alv.
    Variables
    DATA: fieldname(30) TYPE c,
          g_repid       LIKE sy-repid.
    Start of Selection
    START-OF-SELECTION.
      g_repid = sy-repid.
      PERFORM get_data.
    End of Selection
    END-OF-SELECTION.
      PERFORM do_fancy_stuff.
      PERFORM get_layout.
      PERFORM get_fieldcat.
      PERFORM create_report.
    *&      Form  CREATE_REPORT
          Learn to read the subroutine name!
    FORM create_report.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_interface_check       = ' '
                i_callback_program      = g_repid
                i_callback_user_command = 'PROCESS_USER_COMMANDS'
                it_fieldcat             = tbl_fieldcat
                i_default               = 'X'
                i_save                  = ' '
                is_layout               = st_layout
           TABLES
                t_outtab                = tbl_kna1
           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.                               " CREATE_REPORT
    *&      Form  GET_FIELDCAT
          Build the Field Catalog
    FORM get_fieldcat.
    Here the field catalog is created. To display more fields simply
    'uncomment' the additional lines and add the field name. Also note
    that the field catalog is much more powerful than this. You can
    intensify fields, change the colour, assign reference fields, etc.
    Look at type slis_fieldcat_alv for more options.
      PERFORM write_fieldcat USING 'ICON'  'TBL_KNA1' '    ' 'X' 1 '2' 'X'
      PERFORM write_fieldcat USING 'KUNNR' 'TBL_KNA1' 'KNA1' 'X' 2 ' ' ' '
      PERFORM write_fieldcat USING 'NAME1' 'TBL_KNA1' 'KNA1' ' ' 3 '10' ' '
                                   'X'.
      PERFORM write_fieldcat USING 'STRAS' 'TBL_KNA1' 'KNA1' ' ' 4 ' ' ' '
      PERFORM write_fieldcat USING 'TELF1' 'TBL_KNA1' 'KNA1' ' ' 5 ' ' ' '
      PERFORM write_fieldcat USING 'ORT01' 'TBL_KNA1' 'KNA1' ' ' 6 ' ' ' '
      PERFORM write_fieldcat USING 'PSTLZ' 'TBL_KNA1' 'KNA1' ' ' 7 ' ' ' '
      PERFORM write_fieldcat USING 'SORTL' 'TBL_KNA1' 'KNA1' ' ' 8 ' ' ' '
      PERFORM write_fieldcat USING 'ERNAM' 'TBL_KNA1' 'KNA1' ' ' 9 ' ' ' '
      PERFORM write_fieldcat USING 'SPRAS' 'TBL_KNA1' 'KNA1' ' ' 10 ' ' ' '
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 10 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 11 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 12 ' '.
    ENDFORM.                               " GET_FIELDCAT
    *&      Form  WRITE_FIELDCAT
          Write the Field Catalog data to the Field Catalog Table
         -->name   Field name
         -->tab    Table name
         -->st     Structure Name
         -->key    Is this field a Key?
         -->pos    Position Number
         -->length Field Length
         -->icon   Display as Icon
         -->hot    Hotspot
    FORM write_fieldcat USING name tab st key pos length icon hot.
      st_fieldcat-fieldname   = name.
      st_fieldcat-tabname     = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key         = key.
      st_fieldcat-col_pos     = pos.
      st_fieldcat-outputlen   = length.
      st_fieldcat-icon        = icon.
      st_fieldcat-hotspot     = hot.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                               " WRITE_FIELDCAT
    *&      Form  PROCESS_USER_COMMANDS
          Interactive Reporting Commands
    FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
                                     selfield TYPE slis_selfield.
    This subroutine is called when there is user interaction in the output
    In this case if the user double clicks the Customer Number then the
    program will call transaction XD03 and display the Customer Master
    Data
      CASE syst-ucomm.
        WHEN '&IC1'.
    get cursor field fieldname.
          READ TABLE tbl_kna1 INDEX selfield-tabindex.
          SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.
          CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                               " PROCESS_USER_COMMANDS
    *&      Form  GET_LAYOUT
      set the layout of the ALV.
      add color to the row?
    FORM get_layout.
      st_layout-info_fieldname    = 'COLOR'.
      st_layout-colwidth_optimize = 'X'.
      st_layout-get_selinfos      = 'X'.
    ENDFORM.                    " GET_LAYOUT
    *&      Form  get_data
          Get some data to play with
    FORM get_data.
      SELECT * FROM kna1 INTO CORRESPONDING FIELDS OF TABLE tbl_kna1
             UP TO 30 ROWS.
    ENDFORM.                    " get_data
    *&      Form  do_fancy_stuff
          Do some fancy pants stuff for example changing the color of
          lines and adding icons
    FORM do_fancy_stuff.
    Here we will demonstrate changing the color of ALV Record lines as
    well as displaying Icons
      LOOP AT tbl_kna1.
    All records where NAME1 begins with 'M', will be displayed in Bluish
    Green
        IF tbl_kna1-name1(1) EQ 'M'.
          tbl_kna1-color = 'C41'.  "Bluish Green
          MODIFY tbl_kna1 TRANSPORTING color.
        ENDIF.
    All records with no TELF1 will be displayed in White and have a
    Warning Icon
        IF tbl_kna1-telf1 IS INITIAL.
          tbl_kna1-color = 'C00'.  "White
          tbl_kna1-icon  = '@AH@'. "Warning Icon
          MODIFY tbl_kna1 TRANSPORTING icon color.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " do_fancy_stuff[/code]

  • How to devolped an Interactive ALV Report to display sales orders

    hi,
             how to devolped an Interactive ALV Report to display sales orders pertaining to the selected Customers and item details in the secondary list.For this report what are the tables and fields wehave to used give with example.
    thank you
    radhakrishna

    Hi,
    look via se38 for BCALV* and SALV*.
    Try ABAPDOCU.
    Regards, Dieter

  • Need Help in  Interactive ALV Report

    Hi guru's,
      I need sample code of Interactive ALV   when on selecting an particular field, it should open an another ALV windows or pop-up window. Please help me and points will be rewarded for the right code.
    Regards
    Rajiv Christopher

    hi,
    may b it will b helpful 2 u.
    INTERACTIVE ALV
    REPORT Z50651_ALV_INTERACTIVE MESSAGE-ID ZMSG_50651
    LINE-SIZE 100
    LINE-COUNT 60
    NO STANDARD PAGE HEADING.
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
    G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
    R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
    PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
    PERFORM GET_DETAILS.
    PERFORM FIELDCAT.
    PERFORM LAYOUT.
    PERFORM VARIANT.
    PERFORM SAVE.
    PERFORM EVENTS.
    PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *& Form validate
    text
    --> p1 text
    <-- p2 text
    FORM VALIDATE .
    SELECT SINGLE VBELN
    FROM VBAP
    INTO V_VBELN
    WHERE VBELN IN S_VBELN.
    IF SY-SUBRC <> 0.
    MESSAGE E000 WITH 'enter valid vbeln'.
    ENDIF.
    ENDFORM. " validate
    *& Form get_details
    text
    --> p1 text
    <-- p2 text
    FORM GET_DETAILS .
    SELECT VBELN
    POSNR
    MATNR
    FROM VBAP
    INTO TABLE IT_VBAP
    WHERE VBELN IN S_VBELN.
    IF SY-SUBRC <> 0.
    MESSAGE E000 WITH 'no details found'.
    ENDIF.
    ENDFORM. " get_details
    *& Form fieldcat
    text
    --> p1 text
    <-- p2 text
    FORM FIELDCAT .
    WA_FIELDCAT-TABNAME = 'IT_VBAP'.
    WA_FIELDCAT-FIELDNAME = 'VBELN'.
    WA_FIELDCAT-OUTPUTLEN = 10.
    WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_VBAP'.
    WA_FIELDCAT-FIELDNAME = 'POSNR'.
    WA_FIELDCAT-OUTPUTLEN = 6.
    WA_FIELDCAT-SELTEXT_L = 'ITEM'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_VBAP'.
    WA_FIELDCAT-FIELDNAME = 'MATNR'.
    WA_FIELDCAT-OUTPUTLEN = 18.
    WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. " fieldcat
    *& Form LAYOUT
    text
    --> p1 text
    <-- p2 text
    FORM LAYOUT .
    WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM. " LAYOUT
    *& Form VARIANT
    text
    --> p1 text
    <-- p2 text
    FORM VARIANT .
    CLEAR G_VARIANT.
    G_VARIANT-REPORT = SY-REPID.
    ENDFORM. " VARIANT
    *& Form SAVE
    text
    --> p1 text
    <-- p2 text
    FORM SAVE .
    CLEAR G_SAVE.
    G_SAVE = 'A'.
    ENDFORM. " SAVE
    *& Form EVENTS
    text
    --> p1 text
    <-- p2 text
    FORM EVENTS .
    CLEAR XS_EVENTS.
    XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
    XS_EVENTS-FORM = 'TOP_OF_PAGE'.
    APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM. " EVENTS
    *& Form TOP_OF_PAGE
    text
    FORM TOP_OF_PAGE.
    WRITE :/ ' INTELLI GROUP'.
    ENDFORM. "TOP_OF_PAGE
    *& Form ALV_DISPLAY
    text
    --> p1 text
    <-- p2 text
    FORM ALV_DISPLAY .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = PF_STATUS
    I_CALLBACK_USER_COMMAND = USER_COMMAND
    I_STRUCTURE_NAME =
    IS_LAYOUT = WA_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = G_SAVE
    IS_VARIANT = G_VARIANT
    IT_EVENTS = G_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 = IT_VBAP
    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. " ALV_DISPLAY
    *& Form SET_PF_STATUS
    text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
    SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.
    ENDFORM. "SET_PF_STATUS
    *& Form SET_USER_COMMAND
    text
    FORM SET_USER_COMMAND USING R_UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN 'DC'.
    READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
    IF SY-SUBRC = 0.
    SELECT SINGLE MTART
    FROM MARA
    INTO V_MTART
    WHERE MATNR = IT_VBAP-MATNR.
    IF SY-SUBRC 0.
    MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
    ELSE.
    WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
    WRITE :/ 'MATERIAL TYPE :' , V_MTART.
    ENDIF.
    ENDIF.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    WHEN 'EXIT'.
    LEAVE TO SCREEN 0.
    WHEN 'CLOSE'.
    CALL TRANSACTION 'SE38'.
    ENDCASE.
    ENDFORM. "SET_USER_COMMAND
    Reward if useful...

  • Example of  Interactive ALV Report

    Hi all,
    Can anyone give me simplest example of Interactive ALV Report.
    Please give some description with that so that i can understand it ..
    Thanks
    Raj

    REPORT  ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838                      .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.
    ENDFORM.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        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  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.
    ENDFORM.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.
    another sample code
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.
    ENDFORM.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        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  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.
    ENDFORM.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.
    REPORT Z_PO_ALV_R02 NO STANDARD PAGE HEADING MESSAGE-ID ZROJA.
    *-----tables declaration
    TABLES:EKKO.
    TYPE-POOLS:SLIS.
    *-----data declaration
    TYPES:BEGIN OF X_EKKO,
    EBELN type EKKO-EBELN, "PO Number
    BUKRS type EKKO-BUKRS, "Company code
    BSART type EKKO-BSART, "Purchasing Document type
    LIFNR type EKKO-LIFNR, "Vendor
    SPRAS type EKKO-SPRAS, "Language Key
    ZTERM type EKKO-ZTERM, "Terms of payment key
    END OF X_EKKO,
    BEGIN OF X_EKPO,
    EBELN type EKPO-EBELN,
    EBELP type EKPO-EBELP, "Item number
    WERKS type EKPO-WERKS, "Plant
    MATNR type EKPO-MATNR, "Material Number
    MATKL type EKPO-MATKL, "Material Group
    END OF X_EKPO.
    DATA:IT_EKKO TYPE STANDARD TABLE OF X_EKKO,
    IT_EKPO TYPE STANDARD TABLE OF X_EKPO,
    WA_EKKO TYPE X_EKKO,
    WA_EKPO TYPE X_EKPO, "#EC *
    IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
    *-----Selection-screen design
    SELECTION-SCREEN BEGIN OF BLOCK B1.
    SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.
    SELECTION-SCREEN END OF BLOCK B1.
    *-----SELECTION-SCREEN VALIDATION
    AT SELECTION-SCREEN.
    SELECT EBELN
    FROM EKKO
    INTO TABLE IT_EKKO
    WHERE EBELN IN S_EBELN.
    *-----if there are no values display an error
    IF SY-SUBRC NE 0.
    MESSAGE E009.
    ENDIF.
    *-----Data retrieval
    START-OF-SELECTION.
    *-----retrieving data from the PO header
    SELECT EBELN BUKRS BSART LIFNR SPRAS ZTERM
    FROM EKKO
    INTO TABLE IT_EKKO
    WHERE EBELN IN S_EBELN.
    *-----if there are no records display an error
    IF SY-SUBRC NE 0.
    MESSAGE E003.
    ENDIF.
    *-----Field catalog for the PO Header
    REFRESH IT_FIELDCAT[].
    WA_FIELDCAT-COL_POS = '1'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-KEY = 'X'.
    WA_FIELDCAT-HOTSPOT = 'X'.
    WA_FIELDCAT-REF_FIELDNAME = 'EBELN'.
    WA_FIELDCAT-REF_TABNAME = 'EKKO'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-COL_POS = '2'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-REF_FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-REF_TABNAME = 'EKKO'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-COL_POS = '3'.
    WA_FIELDCAT-FIELDNAME = 'BSART'.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-REF_FIELDNAME = 'BSART'.
    WA_FIELDCAT-REF_TABNAME = 'EKKO'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-COL_POS = '4'.
    WA_FIELDCAT-FIELDNAME = 'LIFNR'.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-REF_FIELDNAME = 'LIFNR'.
    WA_FIELDCAT-REF_TABNAME = 'EKKO'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-COL_POS = '5'.
    WA_FIELDCAT-FIELDNAME = 'SPRAS'.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
    WA_FIELDCAT-REF_TABNAME = 'EKKO'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-COL_POS = '6'.
    WA_FIELDCAT-FIELDNAME = 'ZTERM'.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-REF_FIELDNAME = 'ZTERM'.
    WA_FIELDCAT-REF_TABNAME = 'EKKO'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    *-----to display the header details
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    IT_FIELDCAT = IT_FIELDCAT[]
    TABLES
    T_OUTTAB = IT_EKKO[].
    *& Form USER_COMMAND
    text
    -->UCOMM text
    -->FIELD1 text
    FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM FIELD1 TYPE "#EC CALLED
    SLIS_SELFIELD. "#EC *
    READ TABLE IT_EKKO INTO WA_EKKO INDEX FIELD1-TABINDEX.
    *-----retrieving item details from the PO Item table
    SELECT EBELN EBELP WERKS MATNR MATKL
    FROM EKPO
    INTO TABLE IT_EKPO
    WHERE EBELN = WA_EKKO-EBELN.
    *-----to display an error if other than PO Number is clicked
    IF SY-SUBRC NE 0.
    MESSAGE E001.
    ENDIF.
    *-----Fieldcatalog for the PO item details
    REFRESH IT_FIELDCAT1[].
    WA_FIELDCAT1-COL_POS = '1'.
    WA_FIELDCAT1-FIELDNAME = 'EBELN'.
    WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT1-REF_FIELDNAME = 'EBELN'.
    WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR WA_FIELDCAT1.
    WA_FIELDCAT1-COL_POS = '2'.
    WA_FIELDCAT1-FIELDNAME = 'EBELP'.
    WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT1-REF_FIELDNAME = 'EBELP'.
    WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR WA_FIELDCAT1.
    WA_FIELDCAT1-COL_POS = '3'.
    WA_FIELDCAT1-FIELDNAME = 'WERKS'.
    WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT1-REF_FIELDNAME = 'WERKS'.
    WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR WA_FIELDCAT1.
    WA_FIELDCAT1-COL_POS = '4'.
    WA_FIELDCAT1-FIELDNAME = 'MATNR'.
    WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT1-REF_FIELDNAME = 'MATNR'.
    WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR WA_FIELDCAT1.
    WA_FIELDCAT1-COL_POS = '5'.
    WA_FIELDCAT1-FIELDNAME = 'MATKL'.
    WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT1-REF_FIELDNAME = 'MATKL'.
    WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR WA_FIELDCAT1.
    *-----to display the item details
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IT_FIELDCAT = IT_FIELDCAT1[]
    TABLES
    T_OUTTAB = IT_EKPO[].
    ENDFORM. "user_command_form
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • How to create an interactive alv report in which some parameters

    hi all,
    i want to create an interactive alv report in which some parameters in selection screen
    & when fill those & press f8 then an alv list display will show & when user double click on
    any row then those contents get shown in header details of module pool program  which call by
      tcode mentioned in same alv .And same an interactive alv report used for change & display.
    please help me give me some code same as  required above.
    ketan
    abap consultant.
    Edited by: ketan pande on Feb 14, 2009 6:09 AM

    Hi Ketan,
    Please find Sample Code.
    TYPE-POOLS:slis.
    DATA:
      w_carrid TYPE scarr-carrid,
      it_fieldcat TYPE slis_t_fieldcat_alv,
      fs_fieldcat LIKE LINE OF it_fieldcat,
      it_eventcat TYPE slis_t_event,
      fs_eventcat LIKE LINE OF it_fieldcat.
    DATA:
      t_spfli LIKE STANDARD TABLE OF spfli,
      fs_spfli LIKE LINE OF t_spfli,
      t_sflight LIKE STANDARD TABLE OF sflight,
      fs_sflight LIKE LINE OF t_sflight.
    SELECT-OPTIONS:
      s_carrid FOR w_carrid.
    START-OF-SELECTION.
      SELECT * FROM spfli INTO TABLE t_spfli WHERE carrid IN s_carrid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = sy-repid
          i_callback_user_command = 'PICK'
          i_structure_name        = 'SPFLI'
        TABLES
          t_outtab                = t_spfli
        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  PICK
    FORM pick USING command LIKE sy-ucomm
                    selfield TYPE slis_selfield.
      READ TABLE t_spfli INTO fs_spfli INDEX selfield-tabindex.
      CASE command.
        WHEN '&IC1'.
          SELECT * FROM sflight
          INTO TABLE t_sflight
         WHERE carrid = fs_spfli-carrid
           and connid = fs_spfli-connid.
          CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
             i_program_name               = sy-repid
           I_INTERNAL_TABNAME           =
             i_structure_name             = 'SFLIGHT'
           I_CLIENT_NEVER_DISPLAY       = 'X'
           I_INCLNAME                   =
           I_BYPASSING_BUFFER           =
           I_BUFFER_ACTIVE              =
            CHANGING
              ct_fieldcat                  = it_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.
          CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
           I_INTERFACE_CHECK              = ' '
           I_BYPASSING_BUFFER             =
           I_BUFFER_ACTIVE                = ' '
             i_callback_program             = sy-repid
           I_CALLBACK_PF_STATUS_SET       = ' '
           I_CALLBACK_USER_COMMAND        = ' '
           I_STRUCTURE_NAME               =
           IS_LAYOUT                      =
             it_fieldcat                    = it_fieldcat
           IT_EXCLUDING                   =
           IT_SPECIAL_GROUPS              =
           IT_SORT                        =
           IT_FILTER                      =
           IS_SEL_HIDE                    =
           I_DEFAULT                      = 'X'
           I_SAVE                         = ' '
           IS_VARIANT                     =
            it_events                      = it_eventcat
           IT_EVENT_EXIT                  =
           IS_PRINT                       =
           IS_REPREP_ID                   =
           I_SCREEN_START_COLUMN          = 0
           I_SCREEN_START_LINE            = 0
           I_SCREEN_END_COLUMN            = 0
           I_SCREEN_END_LINE              = 0
           IR_SALV_LIST_ADAPTER           =
           IT_EXCEPT_QINFO                =
           I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
         IMPORTING
           E_EXIT_CAUSED_BY_CALLER        =
           ES_EXIT_CAUSED_BY_USER         =
            TABLES
              t_outtab                       = t_sflight
          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.
      ENDCASE.
    ENDFORM.                    "pick
    Hope this will Be Helpful
    Thanks
    Kalyan

  • Interactive ALV Report

    Hi Experts,
    I am new to ALV Reports, can any one provide some inputs on how to create an Interactive ALV Reports using OOPS Concept.
    I am getting the data from SFLIGHT on first ALV and i want that when i single click any cell or row or any check box associated with the row i should get the corresponding booking details from table SBOOK.
    Thanks
    Ravi

    Hi dude,
    Go through this Link: [http://www.sap-img.com/abap/an-interactive-alv-report.htm]
    for more information search in SDN only..
    Re: Interactive ALV  Report Using Function...?

Maybe you are looking for

  • Same form submitted multiple times?

    Hi there!      I have been working with Acrobat 9 for the first time, took a look through help and some google searches but im not finding anything related to my concerns. There are only 2 recipients of the form however they both need to fill this fo

  • How to make footnotes/endnotes in Turabian format?

    I am trying to finish my final essay paper for my history class and I am finding it a little difficult to change my Footnotes/endnotes in Turabian format. I have tried looking on the inspector as where most changes are made for an essay, but I can no

  • Printing alv with logo

    hai    I have created the ALV report with the company logo in it , while taking the printout  the log will not apper in the print.I am using the grid alv. Could u please tell me how to apper log in the print out. bye

  • Recompilation of all triggers in a schema.

    Hi folks! I got a gotcha! I'd changed couple of table structures here and there in the schema and subsequently, quite understandably, all the triggers that are related to the afore-altered tables went into invalid status. It is taking a toll on me to

  • Help with sys_connect_by_path

    Hi, I'm newbie in retrieving hierarchical data, so please help with this. I have Oracle 8.1.7.0.0. I have a view with this kind of data: TYP     COMP_TYP 005     010 010     005 020     010 030     010 030     020 040     005 060     040 065     005