Webdynpro table line selection

Hi,
I am working on an application in which I need to show some details of the selected entry of the table in a seperate frame below the table.
For example, user selects entry number 3, I need to show the details of entry number  3, in the seperate frame. Once he selects another entry, i need change the details accrodingly.
Currently, by default it is selecting 1st entry and shows the corresponding details. But when I select another entry, it dumps giving the following exception :-
com.sap.tc.webdynpro.progmodel.context.ContextException: Node(InvoiceDetailsView.Z_BAPI_INVOICE_READ.Output.X_Park_Dtl): selection cardinality does not allow multiple selection
    at com.sap.tc.webdynpro.progmodel.context.Node.setSelected(Node.java:853)
    at com.sap.tc.webdynpro.clientserver.data.DataContainer.updateSelection(DataContainer.java:533)
    at com.sap.tc.webdynpro.clientserver.uielements.adaptbase.AbstractAdapter.updateSelection(AbstractAdapter.java:787)
    at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter._clearAndSetMultipleSelection(TableAdapter.java:11801)
    at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter.access$6100(TableAdapter.java:116)
Please let me know how to solve this issue. Thanks.
Hari

Set selectionMode of the Table UI element to "auto".
Armin

Similar Messages

  • How to implement line selectability for a table control using table Wizard?

    Hello SDN Community,
    I have created a table control using the Table Wizard.  I found my exact question in this forum, but unfortunately it had not been andsered.  While I cannot paste a screen-print into this plane-text area, here are the steps I followed...
    1) SE51
    2) Create new screen 0100
    3) Click Layout button
    4) Clidk Table Control (with Wizard) and draw box on canvas.
    5) Step is "Start" - click Continue
    6) Step is "Name of Table Control" - provided name
    7) Step is "Table Name" - provided name of dictionary table (AUFK)
    8) Step is "Definition of Columns" - selected order numver and order text
    9) Step is "Table Control Attributes" - Line Selectability is in display mode - cannot set it.
    I would like to have a selectability column for my table.  Would appreciate any insight into how to do this.
    Thank you,
    Dean Atteberry.

    This is a puzzling...
    For the table control wizard, in the Table Control Attributes step, I was able to get line selectability to open up by declaring a char01 data element at the beginning of my type.
    The puzzling is in regards to the "Selection col. fld" entry field.
    If I leave it blank and try to go to the next step, I get message "Enter the name of the selection column if you are using a program table"
    So it looked like it wanted to know the name of my selection column.  So I type in "CHAR1".  and got the message "The field "CHAR1" for the selection column is already contained in the table."
    Hmmmmm.... don't understand............
    Dean Atteberry.

  • Getting error of Defining an internal table with header line, SELECT-OPTIO

    Hi all,
    i have a coding for my smart form,In this coding i have define an structure which being used,but when i execute it it give me
    error of Defining an internal table with header line, SELECT-OPTIONS, and RANGES is not allowed within a structure.Even tough you can see that in  my coding im not using SELECT-OPTION or RANGES,but can't understand why it gives me this error.
    Following are the code:
      DATA: BEGIN OF traptab OCCURS 50.
            INCLUDE STRUCTURE mseg.
      DATA: vgart LIKE mkpf-vgart,
            blart LIKE mkpf-blart,
            blaum LIKE mkpf-blaum,
            bldat LIKE mkpf-bldat,
            budat LIKE mkpf-budat,
            cpudt LIKE mkpf-cpudt,
            cputm LIKE mkpf-cputm,
            aedat LIKE mkpf-aedat,
            usnam LIKE mkpf-usnam,
            tcode LIKE mkpf-tcode,
            xblnr LIKE mkpf-xblnr,
            bktxt LIKE mkpf-bktxt,
            frath LIKE mkpf-frath,
            frbnr LIKE mkpf-frbnr,
            wever LIKE mkpf-wever,
          END OF traptab. 
    Thanks & Regards,
    sappk25

    thanks

  • How to make 2 lines in a webdynpro table cell?

    Hi
    Is it possiable to create a WebDynpro Table Call that can contains 2 lines in 1 cell ?

    Hi Ami,
    There are a limited number of UI elements that you may use for a Table Cell Editor, however, with a TextView, you can display text that includes a line break.
    The line break is achieved by including the carriage-return-line-feed characters in the Table's data source...
    LOOP AT lt_flight_tab ASSIGNING <f>.
         CONCATENATE 'Line One' cl_abap_char_utilities=>cr_lf 'Line Two'  INTO <f>-test.
    ENDLOOP.
    Cheers,
    Amy

  • Table control: Line selection single issue

    Hi experts,
    I have created a table control and in the screen painter I have defined the line selection as "Single" for table control.
    The table control can display upto 20 lines in a screen and i can select a single record only which pertains to my requirement. if I try to select two records it will not allow.
    Issue: consider  i select a single record from the first 20 lines displayed in screen, then i scroll the records in the table control so that it displays the records from 21 to 40. if I select a single record now from line 21 to 40, the first record that i selected is not getting deselected. That is, totally two lines are getting selected.
    How to overcome this issue
    Thanks in advance
    Regards
    Anand

    Ok
    The "problem" is here:
    Types: Begin of ty_ic,
      ic(20),
      desc(20),
      sel(1)                                 <--------------------------------
    End of ty_ic.
    You've ha a field for selected line and that field is used in table control definition as you've written:
    "Note: wa_ic is the structure used in table control and wa_ic-sel is the mark field defined the table control attributes"
    So you're using the structure WA_IC as header line of internal table IT_IC and also as input/put field of your table control (I mean the screen fields of table control are based on WA_IC).
    You don't need any code in PBO to move the data from internal table to table control, because the headerline of IT_IC and field of table control are the same, infact you've implemented only the code in PAI to save the data from table control to IT_IC:
    Loop at it_ic.
    Modify it_ic from wa_ic index tc_ic-current_line
    Endloop
    t's a good solution if it needs to transfer all data to table control automatically: it doesn't need any code in PBO
    but, of course, there'll be a problem when you don't need to display something, in this case you have to think a solution, I mean you have to write a code in order to avoid to display those data.
    It's the case of the selected line: in your situation all selected lines keep the selection, because the code to clear IT_IC-SEL is missing: only the user can deselect a line, but if he doesn't do it, the line will remain selected after navigation.
    So you make to be sure to clear all selected lines are not displayed.
    You need to create a code in PAI out of the loop of table control where you clear the flag SEL, in order to do it you need to consider:
    - The index of the first record displayed in table control is stored in field TC_IC-TOP_LINE
    - The index of the last record displayed in table control can be calculated: the variable SY-LOOPC indicates how many rows can be displayed in table control, so the last record will be: TC_IC-TOP_LINE + SY-LOOPC.
    So you need to clear the field SEL for all records not displayed, a code like this:
    PROCESS PAI.
      LOOP AT IT_IC.
         MODULE GET_LOOPC.
      ENDLOOP.
      MODULE CLEAR_SEL.
      MODULE GET_LOOPC..
          TOT_LINE_DISPLAYED = SY-LOOPC.
      ENDMODULE
      MODULE CLEAR_SEL.
    * Here you need to clear the selection of the records before of TOP_LINE
           IF TC_IC-TOP_LINE > 1.
              LOOP AT IT_IC INTO WA_IC  TO TC_IC-TOP_LINE.
                 CLEAR WA_IC-SEL.
                 MODIFY IT_IC FROM WA_IC.
              ENDLOOP.
         ENDIF.
    * Here you need to clear the selection of the records after the last one:
          LAST_INDEX = TOT_LINE_DISPLAYED + TC_IC-TOP_LINE.
         DESCRIBE TABLE IT_IC LINES SY-TABIX,
         IF SY-TABIX > LAST_INDEX.
              LOOP AT IT_IC INTO WA_IC  FROM LAST_INDEX.
                 CLEAR WA_IC-SEL.
                 MODIFY IT_IC FROM WA_IC.
              ENDLOOP.
         ENDIF.
      ENDMODULE.

  • WD ABAP: How to get the contents of selected table lines?

    Hi,
    I'm trying to figure out how to get the contents of table lines back from the UI. I display a table with several lines of data. The user selects some rows. I want to move the contents of the selected rows to another table. I have a context attribute, say DATA, with attributes FIELD1... FIELDn, using a DDIC structure. These are bound to the table UI element and the corresponding table columns. To get the selected rows, I use wd_context->get_selected_elements(). This works, but what I get from this method is references to if_wd_context_element. How do I know which row (row number = ?) this corresponds to? And how do I get the actual data? I want a structure with FIELD1 = value1 FIELD2 = value2 etc. My context attributes FIELD refer to table columns, but I'm looking for the table line...
    Can somebody help me?
    Thanks,
    Ira

    Hi Ira,
    wd_context->get_selected_elements() returns WDR_CONTEXT_ELEMENT_SET which is a table type of IF_WD_CONTEXT_ELEMENT. You can loop through the WDR_CONTEXT_ELEMENT_SET, get into variable say node_elelement which is of type ref to If_Wd_Context_Element. Then you could use the method GET_STATIC_ATTRIBUTES of If_Wd_Context_Element which returns a structure with values of all the attributes in the selected row.
    If you need the row number, while populating the node you could have an additional attribute called rowno and populate it correctly. When you select the data using method GET_STATIC_ATTRIBUTES, you would get the appropriate row number.
    Regards,
    Srini.

  • CL_GUI_ALV_GRID: Line selection and backend table

    Dear community,
    is there a way to propagate line selection of ALV GRID GUI automagically to the backend data table?
    This is my scenario:
    1) A table containing several records with one column 'SELECTED' for selection status
    2) ALV_GRID to display the table with layout info for line selection
    alv_layo-sel_mode   = 'A'.
    alv_layo-box_fname  = 'SELECTED'.
    3) At PBO methods set_table_for_first_display and refresh_table_display are called with the table containing some records marked as 'SELECTED'.
    First problem here: 'SELECTED' entries are not propagated to the ALV grid (the lines in the GUI are not marked). I know I could use set_selected_rows to force the selection, but is this really necessary?
    4) Then, at PAI method check_changed_data is called (and yes, event mc_evt_modified is registered).
    Second problem: Changes in selection are not propagated automagically to the underlying table. I also know I could use get_selected_rows to force this update manually, but again: is this really necessary?
    Can anyone explain the behavior why sorting etc. is propagated automatically to the underlying table, but not the selection of rows? Am I missing something?
    Hint: Removing box_fname = 'SELECTED' and setting the fieldcatalog to display the column 'SELECTED' as editable checkbox works also. But our users are familiar with the rowmark, so this is no option.
    Any suggestions are welcome.
    Thanks,
    Torsten.
    Here an (almost) complete listing of the code:
    PROCESS BEFORE OUTPUT.
      MODULE SET_STATUS_TITLE_0100.
      MODULE INIT_ALV_GRID_0100.
      MODULE DISPLAY_DATA_0100.
      MODULE SET_GRID_SELECTION_0100.
    PROCESS AFTER INPUT.
      MODULE EXIT_COMMAND_0100 AT EXIT-COMMAND.
      MODULE UPDATE_TABLE_DATA_0100.
      MODULE USER_COMMAND_0100.
    MODULE init_alv_grid_0100 OUTPUT.
      IF NOT gr_container IS BOUND.
    *   Container erzeugen
        CREATE OBJECT gr_container ...
    *   ALV Grid erstellen
        CREATE OBJECT gr_alv_grid ...
    *   ALV für die erste Anzeige vorbereiten
        gs_alv_layo-zebra      = on.         " Gestreifte Anzeige
        gs_alv_layo-no_toolbar = on.         " Keine Toolbar
        gs_alv_layo-no_rowmark = off.        " Keine Zeilenmarkierung
        gs_alv_layo-edit       = off.        " Editieren ermöglichen
        gs_alv_layo-sel_mode   = 'A'.        " Selektionsmodus
        gs_alv_layo-cwidth_opt = off.        " Optimierte Spaltenbreite!
        gs_alv_layo-info_fname = 'LCOLOR'.   " ALV-Control: Feldname mit
                                             " einfacher Farbcodierung für
                                             " Zeile
        gs_alv_layo-ctab_fname = 'CCOLOR'.   " ALV-Control: Feldname mit
                                             " komplexer Farbcodierung
                                             " für Zellen
        gs_alv_layo-box_fname  = 'SELECTED'. " Markierte Zeilen
    *   Feldkatalog für die Anzeige vorbereiten
    *    CLEAR gs_fcat.                       " Mehrfachsel. ermöglichen
    *    gs_fcat-fieldname = 'SELECTED'.      " Dazu muss das Feld für die
    *    gs_fcat-edit      = on.              " Selektion editierbar sein.
    *    gs_fcat-checkbox  = on.              " Ausserdem muss die
    **   gs_fcat-outputlen = '3'.             " Zeilenmark. eingeschaltet
    *    APPEND gs_fcat TO gt_fcat.           " und box_fname gesetzt sein.
    *   Ereignisbehandlung
        SET HANDLER
          lcl_event_handler=>on_click
          lcl_event_handler=>on_hotspot
          lcl_event_handler=>on_double_click
          lcl_event_handler=>on_user_command
          lcl_event_handler=>on_data_changed
        FOR gr_alv_grid.
        CALL METHOD gr_alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified
          EXCEPTIONS
            error      = 1
            OTHERS     = 2.
      ENDIF.
    ENDMODULE.                 " INIT_ALV_GRID_0100  OUTPUT
    MODULE display_data_0100 OUTPUT.
    * PBO Modul für alle weiteren Anzeigezyklen.
      IF gr_alv_grid IS BOUND.
        CALL METHOD gr_alv_grid->set_table_for_first_display ...
      ENDIF.
    ENDMODULE.                 " DISPLAY_DATA_0100  OUTPUT
    MODULE set_grid_selection_0100 OUTPUT.
      IF gr_alv_grid IS BOUND.
        CALL METHOD gr_alv_grid->refresh_table_display.
      ENDIF.
    * Alterative: Set selected rows manually
    *    CALL METHOD gr_alv_grid->set_selected_rows
    ENDMODULE.                 " SET_GRID_SELECTION_0100 OUTPUT
    MODULE update_table_data_0100 INPUT.
        CALL METHOD gr_alv_grid->check_changed_data.
    * Alternative: Get selected rows and update table manually
    *    CALL METHOD gr_alv_grid->get_selected_rows ...
    ENDMODULE.                 " UPDATE_TABLE_DATA_0100  INPUT

    Hello Torsten
    I may be wrong but I think the field LVC_S_LAYO-BOX_FNAME is a relict from the stone-age SLIS-based ALV programming.
    Using modern OO-based ALV we do not need any kind of "MARK" row but we have the appropriate methods available.
    Regards
      Uwe

  • How to handle the single line selection in table control

    Hi All,
       I am facing a problem in the table control of modulepool program.
       I have line selection as "Single" in the table control attributes. But when i am selecting a line in the table control as long as it is in the same page,the line selection is single but when i am selecting the line in the next page,the previous selection is not deselected. So I am seeing two selection for "Single line selector" attribute.
       Could any one help me solve this problem?
    Thanks & Regards,
    S.Lakshmi

    Hi Lakshmi,
    Just Go to Table control , click on it , you can see the attributes screen , there you can see option for
    <b>Line selection</b>
    none
    multiple selection
    single selection
    check the radio button single selection.
    that will solve your problem..
    regards
    vijay

  • WD table get Line selection

    Hello all,
    how can'i get the selected line in a Table UI element ( not ALV UIelement), which  can methode in which class trigger this line selection? and olso the ction that cant trigger it.
    Thank you all

    Hi,
    Up to now we are discussing about table ui element. your requirement is ALV Table.
    Go to veiw->select methods->create one method say onselect, make it event handler(method type ) and in event click
    f4 you get all options there you can select onleadselect select that write your code in your new method.
    Cehckk this..
    Get selected rows in ALV
    WEB DYNPRO ALV GRID  GET SELECTED ROWS...
    selected row in alv web dynpro
    Cheers,
    Kris.
    Edited by: kissnas on May 30, 2011 1:10 PM

  • How to use AT LINE-SELECTION and AT USER-COMMAND in one report????

    Dear all,
    I have a problem in reports I want to use AT USER-COMMAND.and AT LINE-SELECTION.both in the one report.
    But as soon as I use SET PF-STATUS my AT LINE-SELECTION event stop workingand only AT USER-COMMAND is working.
    How can I use both of them in one report for your reference I am giving my test program below.
    REPORT ZTEST111 .
    SET PF-STATUS '100'.
    DO 10 TIMES.
    WRITE:/ SY-INDEX.
    HIDE SY-INDEX.
    ENDDO.
    START-OF-SELECTION.
    AT LINE-SELECTION.
    MESSAGE I002(SY) WITH SY-INDEX.
    AT USER-COMMAND.
    MESSAGE I002(SY) WITH 'USER COMMAND'.
    END-OF-SELECTION.
    Thanks in advance
    Sachin Gautam

    hi
    Syntax
    AT USER-COMMAND.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
    Note
    Self-defined function codes are all those that include character combinations, except for the following:
    The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
    All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
    The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
    Table 1
    Function code Function
    %CTX Call a context menu
    %EX Exit
    %PC Save to file
    %PRI Print
    %SC Search for ...
    %SC+ Find next
    %SL Search in office
    %ST Save to report tree
    Table 2
    Function code Function
    BACK Back
    P- Scroll to previous page
    P-- Scroll to first page
    P+ Scroll to next page
    P++ Scroll to last page
    PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
    PL- Scroll to first line of the page
    PL-n Scroll n lines back
    PL+ Scroll to last line of the page
    PL+n Scroll n lines up
    PNOP No effect
    PP- Scroll back one page
    PP-n Scroll n pages back
    PP+ Scroll one page forward
    PP+n Scroll n pages forwad
    PPn Scroll to beginning of page n
    PRI, PRINT Print
    PS-- Scroll to first column
    PS++ Scroll to last column
    PS- Scroll one column to the left
    PS-n Scroll n columns to the left
    PS+ Scroll one column to the right
    PS+n Scroll n columns to the right
    PSn Scroll to column n
    PZn Scroll to line n
    RW Cancel

  • At line selection in alv report

    hi,
    i had developed a code in which at 1st execution the normal output is displayed and if i click on a purticular Itemid it displays the whole of items  and i want to display only that item's data which i had clicked on.
    following is the code which i am using for the at line-selection.
    **BEGIN - TEST CODE FOR LINE SELECTION**
    data: fld LIKE ITAB-ITEMID,
          val LIKE ITAB-ITEMID.
    at line-selection.
      get cursor field fld value val.
      IF fld = 'ITAB-ITEMID'.
            SET PARAMETER ID 'ANR' FIELD val.
            CLEAR ITAB-ITEMID.
      ENDIF.
        PERFORM PRN_SMSTOCK_ALV USING VAL.
        IF SY-SUBRC <> 0.
          MESSAGE 'NO RECORD FOUND' TYPE 'W'.
        ENDIF.
      FORM PRN_SMSTOCK_ALV USING VAL.
    *****END OF TEST CODE FOR LINE SELECTION******
    plzz help me out by providing the solution for this problem.

    Hi,
    You need to add extra piece of code as below:
    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'   "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    *       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.
      ENDCASE.
    ENDFORM.
    "For further information please refer the link below :
    http://www.sapdev.co.uk/reporting/alv/alvgrid_ucomm.htm
    Thanks,
    Sriram Ponna.

  • At Line Selection on ALV Grid

    Hi guys: I need to double click on a field in the ALV report that should bring up another structure (which I have created) called s_det
    s_det has only document number & company code.
    Please provide the code for doing this in ALV. I know I cant use At Line Selection. Please give me simple code.
    thanks so much
    Brian

    Hi
    take this as an example for ur solution.
    In this if we double click on first level display then it opens second level display.Just have a look on the following code.
    This is Interactive ALV report of displaying each row with colours and Headers.
    TYPE-POOLS SLIS.
    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,
           L_COLOR(4) TYPE C,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    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,
           L_COLOR1(4) TYPE C,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO.
    DATA: V_REPID TYPE SY-REPID,
          I_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FLDCAT TYPE SLIS_FIELDCAT_ALV,
          I_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT,
          GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GD_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST ALV REPORT',
          I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDARY ALV REPORT'.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM FLDCATALOG.
    PERFORM CALL_EVENTS.
    PERFORM POPULATE_EVENT.
    PERFORM BLD_LAYOUT.
    PERFORM BLD_LAYOUT1.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM DISPLAY_ALV_REPORT.
    FORM FLDCATALOG.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'EBELN'.
    WA_FLDCAT-SELTEXT_M = 'PO NUMBER'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'AEDAT'.
    WA_FLDCAT-SELTEXT_M = 'DATE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'BUKRS'.
    WA_FLDCAT-SELTEXT_M = 'DOCUMENT TYPE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'LIFNR'.
    WA_FLDCAT-SELTEXT_M = 'VENDOR CODE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    ENDFORM.
    FORM CALL_EVENTS.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = I_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    FORM POPULATE_EVENT.
    *READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    *IF SY-SUBRC = 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-FORM.
    *ENDIF.
    READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
    IF SY-SUBRC = 0.
      WA_EVENT-FORM = 'USER_COMMAND'.
      MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
    ENDIF.
    ENDFORM.
    FORM BLD_LAYOUT.
    GD_LAYOUT-INFO_FIELDNAME = 'L_COLOR'.
    ENDFORM.
    FORM DATA_RETRIEVAL.
    DATA LN_COLOR(1) TYPE C.
    SELECT EBELN AEDAT BUKRS BSART LIFNR
    FROM EKKO INTO TABLE IT_EKKO.
    LOOP AT IT_EKKO INTO WA_EKKO.
    LN_COLOR = LN_COLOR + 1.
    IF LN_COLOR = 8.
      LN_COLOR = 1.
    ENDIF.
    CONCATENATE 'C' LN_COLOR '11' INTO WA_EKKO-L_COLOR.
    MODIFY IT_EKKO FROM WA_EKKO.
    ENDLOOP.
    ENDFORM.
    FORM DISPLAY_ALV_REPORT.
    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           = '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_EKKO
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = GD_LAYOUT
       IT_FIELDCAT                       = I_FLDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = I_EVENTS
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      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.
    FORM TOP_OF_PAGE.
    DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
          WA_HEADER TYPE SLIS_LISTHEADER.
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = 'THIS IS MY FIRST ALV'.
    APPEND WA_HEADER TO T_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_HEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    FORM USER_COMMAND USING R_COMM TYPE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_COMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM FLDCAT_EKPO.
          PERFORM CALL_EVENT_EKPO.
         PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM DISPLAY_ALV_REPORT_EKPO.
      ENDCASE.
    ENDFORM.
    FORM FLDCAT_EKPO.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'EBELN'.
    WA_FLDCAT-SELTEXT_M = 'PO NUMBER'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_EKPO.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'EBELP'.
    WA_FLDCAT-SELTEXT_M = 'LINE NO'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_EKPO.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'MATNR'.
    WA_FLDCAT-SELTEXT_M = 'MATERIAL NUMBER'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'MENGE'.
    WA_FLDCAT-SELTEXT_M = 'QUANTITY'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'MEINS'.
    WA_FLDCAT-SELTEXT_M = 'BASE UNIT OF MEASURE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'NETPR'.
    WA_FLDCAT-SELTEXT_M = 'PRICE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    ENDFORM.
    FORM CALL_EVENT_EKPO.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = I_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    *FORM POPULATE_EVENT_EKPO.
    *READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    *IF SY-SUBRC = 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-FORM.
    *ENDIF.
    *ENDFORM.
    FORM BLD_LAYOUT1.
    GD_LAYOUT1-INFO_FIELDNAME = 'L_COLOR1'.
    ENDFORM.
    FORM DATA_RETRIEVAL_EKPO.
    DATA LN_COLOR1(1) TYPE C.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR
    INTO TABLE IT_EKPO
    FROM EKPO.
    LOOP AT IT_EKPO INTO WA_EKPO.
    LN_COLOR1 = LN_COLOR1 + 1.
    IF LN_COLOR1 = 8.
      LN_COLOR1 = 1.
    ENDIF.
    CONCATENATE 'C' LN_COLOR1 '11' INTO WA_EKPO-L_COLOR1.
    MODIFY IT_EKPO FROM WA_EKPO.
    ENDLOOP.
    ENDFORM.
    FORM DISPLAY_ALV_REPORT_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           = ' '
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE1'
      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                         = GD_LAYOUT1
       IT_FIELDCAT                       = I_FLDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = I_EVENTS
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      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.
    FORM TOP_OF_PAGE1.
    DATA: T_HEADER1 TYPE SLIS_T_LISTHEADER,
          WA_HEADER1 TYPE SLIS_LISTHEADER.
    WA_HEADER1-TYP = 'H'.
    WA_HEADER1-INFO = 'SECONDARY ALV LEVEL'.
    APPEND WA_HEADER1 TO T_HEADER1.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_HEADER1
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               = .
    ENDFORM.
    reward points,if it is useful.
    Thanks,
    chandu.

  • How the Pop UP window got closed on line select

    Hi All,
    at BP_ADDR component we are calling component BP_SEARCH_HELPS by cross component usage on F4,
    then we are doing bank details search, then on single line select at View BP_SEARCH_HELPS/BankKeySearchHelpResult
    then it goes to event handler method EH_ONSELECT then.
    inside this method we have code for to call window outbound plug RETURNRESULT'
    METHOD eh_onselect.
    via viewmanager:
      DATA: lr_window          TYPE REF TO cl_bsp_wd_window.
      lr_window ?= me->view_manager->get_window_controller( ).
      lr_window->call_outbound_plug( iv_outbound_plug   = 'RETURNRESULT' ).
    endmethod.
    but at Window out bound plug there is no code for cross comp Window navigation (like Fire_outbound_plug with navigation link)
    then also popup is closing and it gets navigating to BP_ADDR component, how it happenning...?
    code at window BP_SEARCH_HELPS/BankKeySearchHelpW outbound plug is
    method OP_RETURNRESULT.
    endmethod.
    there is no navigation link also defined for window BP_SEARCH_HELPS/BankKeySearchHelpW at Runtime repository.
    one more question is how the event handler method EH_ONSELECT is executed for line select (we r not define any server event for any field of table's context node), is it property of Table context node?
    Thanks,
    VjMhyd

    Hi VJ,
    I hope you are able to find the answer to your question that "how pop up is closing and navigation is done to BP_ADDR component" if not here is the answer.
    Go to your window class and search for method call_outbound_plug ( remove the filter check box ). inside that method firstly your outbound plug method RETURNRESULT will be called and then you will find another method fire_outbound_plug. inside this method there is code to navigate back and close the pop up. this code is only triggered for pop up cases and that's how navigations takes places.
      check if this is a popup rep. view
        if ME->IS_TOPLEVEL_WINDOW = ABAP_TRUE.
        We ignore the navigation for popups but save the outbound plug if given
        and tell the current popup to get closed
          data: LV_VIEW_MANAGER    type ref to LCL_VIEW_MANAGER,
                LV_APPL_CONTROLLER type ref to CL_BSP_WD_APPL_CONTROLLER.
          try.
              LV_VIEW_MANAGER ?= ME->VIEW_MANAGER.
              LV_APPL_CONTROLLER ?= LV_VIEW_MANAGER->GET_APPLICATION_CONTROLLER( ).
              LV_APPL_CONTROLLER->POPUP_MANAGER->CLOSE_POPUP( IV_OUTBOUND_PLUG ).
            catch CX_SY_MOVE_CAST_ERROR.                    "#EC NO_HANDLER
          endtry.
    I hope this clarifies your issue.
    Thanks
    Sudhir Grover

  • DYNP_VALUES_READ Limitations for multiple lines select options

    Hi all !
       First post here, but a tough one I think. Here is my inquiry :
       I have worked on an specific abap function used in many long abap list reports. Theses reports are launched in background processing. The aim of this routine is to stop the report execution if a background job with the same selection parameters is already launched for the current user (to Prevent useless several launch of a time-expensive program).
        Because this routine is dynamic, I read the selection screen of the current report with the function 'DYNP_VALUES_READ'. And I compare the result with the variant of the backgroung job (read with function 'RS_VARIANT_CONTENTS').
        The real problem is that function "DYNP_VALUES_READ" only extract the first line of select-options. I found an alternative solution to extract the select options values (a dynamic assign with field symbols), but external conversions (for WBS elements for example ) are lost, so the comparison detects differences between the background job's variant values and the current selection screen values.
        Does anybody know a way to get entire select options values from a selection screen just as they are displayed on screen ?
    Thanks for reading my message
    Message was edited by: Thomas BRICOUT

    Thomas,
    Perhaps the following code will help you.  A function module in the code captures everything on the selection screen into an internal table.  It doesn't actually capture the information the way you want it, but I believe you will be able to work with it to achieve your desired result.  If it doesn't meet your needs, it is still useful for printing selection screen fields and their values.
    Bruce
    report zybttes2.
    tables: zf137,   " 137 General Ledger Document Details Table
            zf137a.  " 137 General Ledger Document Details Table, Archive
    selection-screen begin of block b1 with frame title text-004." BCT003
    parameters: p_zf137   radiobutton group xxx,                " BCT003
                p_zf137a  radiobutton group xxx.                " BCT003
    selection-screen end of block b1.                           " BCT003
    selection-screen begin of block parameter with frame title text-001.
    selection-screen skip 1.
    select-options: s_date for zf137-zzpostdat.
    selection-screen skip 1.
    selection-screen begin of line.
    selection-screen comment 3(6) text-002.
    selection-screen end of line.
    selection-screen skip 1.
    select-options: s_loan for zf137-zzloan.
    selection-screen skip 1.
    selection-screen begin of line.
    selection-screen comment 3(6) text-003.
    selection-screen end of line.
    selection-screen skip 1.
    select-options: s_ccentr for zf137-zzcostctr.
    selection-screen skip 1.
    selection-screen end of block parameter.
    data: ww(3) type n.
    data: zz(3) type c.
    data: c1(1) type c value '0'.
    do 2 times.
      ww = ww + 1.
      zz = ww.  shift zz left  deleting leading  c1.
      write: / zz.
    enddo.
      Capture and then print the selection screen fields and their values
    data: begin of i_info occurs 20,
            flag,
            olength type x,
            line  like raldb-infoline,
          end of i_info.
    call function 'PRINT_SELECTIONS'
      exporting
        mode      = 'TABLE'
        rname     = sy-cprog
        rvariante = sy-slset
      tables
        infotab   = i_info.
    loop at   i_info.
      write: / i_info-line.
    endloop.
    write:  / 'end'.

  • TOP-OF-PAGE During line-selection in alv report

    Hi Expart
    In intractive Alv report u using top-of-page during line-selection . If u using so u give me one example with codeing .
    Regards
    Bhabani

    Hi,
    try this code...
    *& Report  ZCS_PRG8
    REPORT  Z_SJALV__PRG8.
    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 IT_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.
    reward if helpful
    regards
    Shashi

Maybe you are looking for

  • Reader 9.1 printing garbage

    Hi, I have a problem with Reader 9.1 When I print a pdf document from it, the page is filled with 'gobbledy-****' characters, but in the correct positions. (ie. the lines are in the correct place and roughly the right length). The characters are the

  • Can't download large pdf file

    I'm trying to download a large pdf file (26.2 mb) to my iPad.  It appears to download, then appears, as 440 blank pages.  It offers to open the file in iBook, but that also doesn't have any results.  Is there a limit on the size of the pdf file it ca

  • How to reconcile EXcise duty recovered and Ex duty paid (Between two G/l a)

    Hi, I had two G/l accounts one is Excice duty recovered  and another one is Excise duty paid(Exp) .  Now i want to reconcile both the accounts. Is there any report to reconcile this... Your earliest action would be highly appreciable. Best regards, V

  • Still not possible (4.0 EA3) to copy displayed column headings from ref cursor output.

    Hi, I've created an enhancement request to allow displayed column headings from ref_cursor output to be copied. This is still not possible (4.0 EA3) The ref cursor data can be copied, but not the headings.. See July 2012 discussion of problem in comm

  • Windows Media Play Song Information

    Good Day, I have been using Windows Media player until recently when I tried Itunes. I am now totally using Itunes. The one thing that I liked with Media Player is you could right click on a song title and select "get album information" and it would