Alv grid - how create transaction ?

Hello,
I copied an existant program with 2 dynpro and an alv grid on the second dynpro.
In the copied program, I create a transaction but when I run it, the first dynpro is showed
and when I call the second dynpro, the program exit and nothing is showed.
(the original program run ok )
Any idea ?
tks.

Hi,
   Check below mentioned points
   Activate all the objects of the Program
   check porper pf-status is assiged to the respective screen.
   check
  CREATE OBJECT cont_dock
     EXPORTING
         repid                       = sy-repid
        dynnr                       = 'XXXX' "check this screen no

Similar Messages

  • Need help for hotspot linking from an ALV Grid to another transaction

    Hi all,
    I have to make a field in an ALV Grid link to a transaction. I activated the hotspot for the field in the field catalog and created a 'User_command' that i call in the REUSE_ALV_GRID_DISPLAY, but when i click on the hotpsot, it doesnot take me to the transaction. Please provide some help.
    Here is the code:
    *Internal table and work area for field catalog
    DATA: i_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,
              wa_fieldcat TYPE slis_fieldcat_alv,
              v_repid LIKE sy-repid,
              wa_layout TYPE slis_layout_alv,
              i_event TYPE slis_t_event,
    internal table and work area for subtotals
            i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
            wa_sort TYPE slis_sortinfo_alv.
      PERFORM prepare_fieldcatalog.
      PERFORM prepare_layout.
      PERFORM prepare_subtotal.
      PERFORM display_alv.
    FORM display_alv .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       i_callback_program               = v_repid
       i_callback_pf_status_set          = 'STATUS'
       i_callback_user_command           = 'USER_COMMAND'
        is_layout                         = wa_layout
        it_fieldcat                       = i_fieldcat
       IT_SORT                           = i_sort
       it_events                         = i_event
        TABLES
          t_outtab                          = i_final
    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
    *&      Form  prepare_fieldcatalog
    FORM prepare_fieldcatalog .
      PERFORM f_build USING:
        c_bukrs text-011,
        c_gjahr text-012,
        c_lifnr text-013,
        c_ebeln text-014,
        c_ebelp text-015,
        c_dmbtr text-016,
        c_hkont text-017,
        c_wrbtr text-018,
        c_wmwst text-019,
        c_mwskz text-020,
        c_text1 text-021,
        c_kbetr text-022,
        c_spcode text-023.
    ENDFORM.                    " prepare_fieldcatalog
    *&      Form  f_build
    FORM f_build  USING    p_c_fieldname TYPE slis_fieldname
                           p_text TYPE c.
      CLEAR wa_fieldcat.
      CASE p_c_fieldname.
        WHEN c_dmbtr OR c_wrbtr OR c_wmwst.
          wa_fieldcat-do_sum = 'x'.
      ENDCASE.
      IF p_c_fieldname = c_ebeln.
        wa_fieldcat-hotspot = 'X'.
      ENDIF.
      wa_fieldcat-fieldname = p_c_fieldname.
      wa_fieldcat-seltext_m = p_text.
      APPEND wa_fieldcat TO i_fieldcat.
    ENDFORM.                    " f_build
    *&      Form  prepare_layout
    FORM prepare_layout .
      wa_layout-info_fieldname = c_rowcolor.
    wa_layout-f2code = '<F2CODE>'.
    *APPEND wa_layout to i_layout.
    ENDFORM.                    " prepare_layout
    *&      Form  USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm
                                   rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN c_back OR c_canc OR c_exit.
          LEAVE TO SCREEN 0.
        WHEN c_click.
          READ TABLE i_final INTO wa_final INDEX rs_selfield-tabindex .
          IF sy-subrc EQ 0.
            IF rs_selfield-fieldname EQ c_ebeln.
              SET PARAMETER ID c_bes FIELD wa_final-ebeln.
              CALL TRANSACTION c_me23n AND SKIP FIRST SCREEN.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " USER_COMMAND
    *&      Form  status
    FORM status  USING    p_extab TYPE slis_t_extab.
      SET PF-STATUS c_standard.
    ENDFORM.                    " status
    *&      Form  prepare_subtotal
    FORM prepare_subtotal .
      wa_sort-spos = c_10.
      wa_sort-fieldname = c_mwskz.
      wa_sort-subtot = 'X'.
      wa_sort-up = 'X'.
      APPEND wa_sort TO i_sort.
    ENDFORM.                    " prepare_subtotal

    Hi,
    Check this example..
    TYPE-POOLS: slis.
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: BEGIN OF wa_ekko,
    ebeln like ekko-ebeln,
    ekorg like ekko-ekorg,
    ekgrp like ekko-ekgrp,
    END OF wa_ekko.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    DATA it_ekko LIKE STANDARD TABLE OF wa_ekko WITH HEADER LINE.
    SELECT * UP TO 100 ROWS
    FROM ekko
    INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
              i_program_name     = v_repid
              i_internal_tabname = 'WA_EKKO'
              i_inclname         = v_repid
         CHANGING
              ct_fieldcat        = gt_fieldcat.
    have hotspot for a PO.
    DATA: s_fieldcat LIKE LINE OF gt_fieldcat.
    s_fieldcat-hotspot = 'X'.
    MODIFY gt_fieldcat FROM s_fieldcat TRANSPORTING hotspot
           WHERE fieldname = 'EBELN'.
    Pass the program.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
              i_callback_program      = v_repid
              it_fieldcat             = gt_fieldcat
              i_callback_user_command = 'USER_COMMAND'
         TABLES
              t_outtab                = it_ekko.
          FORM display_detail                                           *
    -->  UCOMM                                                         *
    -->  SELFIELD                                                      *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
      IF ucomm = '&IC1'.
        READ TABLE it_ekko INDEX selfield-tabindex.
        IF sy-subrc = 0.
          SET PARAMETER ID 'BES' FIELD it_ekko-ebeln.
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM.
    Thanks,
    Naren

  • F4 help in ALV grid, how to check the entries?

    Hello,
    I have created F4 help on the cells in a ALV using OO ABAP. The F4 Help works fine and the user can select the entries from it. BUt in F4 help, the user can manually enter values also.
    I want to either disallow the user the enter values manually or validate his entries and ask him to choose from F4 only.
    How to achieve this??

    Use this in Top Include
    class local_event_handler definitin deferred.
    data handler type ref to local_event_handler
    After ALV Grid, register the edit event as shown below after the SET_TABLE_FOR_FIRST_DISPLAY and also set the handler as event handler
    if handler is initial.
      create object handler.
    endif.
    set handler handler->handle_data_changed
                                                    for main_grid. " Main Grid is your ALV Grid
    call method main_grid->register_edit_event
          exporting
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    Class Definition / Implementation
    class local_event_handler definition.
      public section.
        methods
            handle_data_changed
               for event data_changed of cl_gui_alv_grid
                 importing er_data_changed.
        methods
           local_event_handler .
    endclass.                    "local_event_handler DEFINITION
    class local_event_handler implementation.
      method local_event_handler.
        " do nothing
      endmethod.                    "llocal_event_handler
      method handle_data_changed.
        read table er_data_changed->mt_mod_cells into ls_mod_cell index 1.
        perform handle_data_changed using er_data_changed.
        " ls_mod_cell-row_id contains the row number that changed. More details in er_data_changed
      endmethod.                    "handle_data_changed
    endclass.                  "handle_btn_click

  • ALV Grid: how to save changes made in an editable Grid

    Hi,
    How to save changes made bu the user in any of the editable cells in a ALV Grid?
    Regards,
    deb.

    Hi,
    If you are using the FM look at the following example code...
    data: LC_GLAY TYPE LVC_S_GLAY.
    LC_GLAY-EDT_CLL_CB = 'X'.<<<<<------
    gt_layout-zebra = 'X'.
    gt_layout-detail_popup = 'X'.
    gt_layout-colwidth_optimize = 'X'.
    call function 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = i_repid
    i_callback_user_command = 'USER_COMMAND1'
    it_fieldcat = header
    is_layout = gt_layout
    i_callback_top_of_page = 'TOP-OF-PAGE1'
    i_grid_title = text-h17
    it_sort = gt_sort[]
    i_default = 'X'
    i_save = 'U'
    is_variant = gt_variant
    it_events = gt_events
    I_GRID_SETTINGS = LC_GLAY<<<<<<------
    TABLES
    t_outtab = itab.
    clear itab.
    Form USER_COMMAND1
    FORM USER_COMMAND1 USING u_ucomm LIKE sy-ucomm
    us_selfield TYPE slis_selfield."#EC CALLED
    case u_ucomm.
    when '&DATA_SAVE'.<<<<<<<<----
    This will come after the data was EDITTED and when SAVE was clicked by user in output scren.
    Here now in the final internal table(ITAB) you can find the data changed in EDIT mode.
    After this you can do manipulation what ever you want.
    Thanks.
    If this helps you reward with points.

  • Using GETGUI command --in ALV grid, how to extract multiple DATA

    Using GETGUI command , I am able to get a single value form the ALV grid. Please explain me how I can read multiple data like rows and columns data from the ALV grid.
    Please be detailed as I already tried selecting the whole block of ALV grid, but I could not help myself.
    Regards
    Srinivas.

    Hi Srinivas,
    You will have to use the concept of Regular expressions for this. We will have to loop through each row/coloumn to do what u desire.
    The ID of an element on grid will be something like GRIDNAME-<ELEMENT NAME>[ROW NO] [COLUMN NO]
    we need to parameterize the row and also the el;ementname changes for each column along with the column number. Please let me know if this much detail is enough. If not i can show u a real time ecatt code snippet on how to play around with grids.
    Regards,
    Justin

  • ALV GRID: How to change Subtotal and Main total values in standard row

    Hi Experts,
    By using SORT-SUBTOT = 'X' and  FIELDCATALOG-DO_SUM    = 'X', I will get subtotal and Main total.
    My requiremnt is I need be calculate values manually and pass the calculated values to subtotal and maintotal.
    is it possible in ALV GRID?
    By adding extra row we will do this but I am looking standard subtotal and maintotal row change.
    Thanks in advance,
    Mahe

    Hi,
    With function REUSE_ALV_GRID_DISPLAY you cannot do this.
    It´s possible if you create a class inherited from cl_gui_alv_grid and rewrite the method set_data_table, you can do this. Like:
    CLASS xgrid DEFINITION INHERITING FROM cl_gui_alv_grid.
      PROTECTED SECTION.
        METHODS: set_data_table REDEFINITION.
    ENDCLASS.                    "xgrid DEFINITION
    CLASS xgrid IMPLEMENTATION.
      METHOD set_data_table.
    * ....MODIFY data_table ...
        CALL METHOD super->set_data_table
          CHANGING
            data_table = data_table.
      ENDMETHOD.                    "set_data_table
    ENDCLASS.                    "xgrid IMPLEMENTATION
    DATA:    grid  TYPE REF TO xgrid.
      CREATE OBJECT custom_container EXPORTING container_name = mycontainer.
      CREATE OBJECT grid  EXPORTING i_parent = custom_container.
      CALL METHOD grid1->set_table_for_first_display ...
    Best regards,
    Leandro Mengue

  • ALV GRID-how to select all the check boxes using push button

    Hai All,
    I displayed ALV grid & every record contains one check box as first column.
    If user clicks on one push button all the check boxes needs to selected.
    Could any one tell me how to do this?
    Regards,
    Bhaskar

    Hi Bhaskar,
       Try this code :
    *" Table declarations...................................................
    TABLES :
      spfli.                              " Flight Schedule
    *" Data declarations...................................................
    Work variables                                                      *
    DATA :
      w_checkbox  TYPE c,                  " Check Box
      w_checkbox1 TYPE c,                  " Check Box
      w_lineno    LIKE sy-lilli,           " Current Line No
      w_lines     TYPE i.                  " No. Of Records in Int.Table
    Internal table to hold Flight Schedule data                         *
    DATA :
       t_spfli LIKE
      STANDARD TABLE
            OF spfli.
    Structure to hold Function Codes                                    *
    DATA :
      fs_fcode LIKE LINE OF t_fcode.
                          TOP-OF-PAGE EVENT                             *
    TOP-OF-PAGE.
      PERFORM top_of_page.
                       START-OF-SELECTION EVENT                         *
    START-OF-SELECTION.
      PERFORM fetch_spfli_data.
      SET PF-STATUS 'YMENU1'.
      DESCRIBE TABLE t_spfli LINES w_lines.
      fs_fcode = 'EXIT'.
      APPEND fs_fcode TO t_fcode.
      fs_fcode = 'SELECT'.
      APPEND fs_fcode TO t_fcode.
      fs_fcode = 'DESELECT'.
      APPEND fs_fcode TO t_fcode.
      fs_fcode = 'RETRIEVE'.
      APPEND fs_fcode TO t_fcode.
                        AT USER-COMMAND EVENT                           *
    AT USER-COMMAND.
      PERFORM user_command.
    FORM top_of_page .
      WRITE :/50 'Flight Schedule Information'(008).
      ULINE.
      FORMAT COLOR 1.
      WRITE :/10 'Carrier ID'(001),
              25 'Connection ID'(002) ,
              43 'Airport From'(003),
              59 'Airport To'(004),
              74 'Departure Time'(007),
              93 'Arrival Time'(011),
             106 space.
    ENDFORM.                               " FORM TOP_OF_PAGE
    FORM fetch_spfli_data .
      SELECT carrid                        " Carrier ID
             connid                        " Connection ID
             airpfrom                      " Airport From
             airpto                        " Airport To
             deptime                       " Departure Time
             arrtime                       " Arrival Time
        FROM spfli
        INTO CORRESPONDING FIELDS OF
       TABLE t_spfli.
      IF sy-subrc EQ 0.
        PERFORM display_spfli_data.
      ENDIF.                               " IF SY-SUBRC EQ 0
    ENDFORM.                               " FORM FETCH_SPFLI_DATA
    FORM display_spfli_data .
      SORT t_spfli BY carrid ASCENDING.
      LOOP AT t_spfli INTO spfli.
        FORMAT COLOR 2.
        WRITE :/2 w_checkbox AS CHECKBOX,
                  spfli-carrid   UNDER text-001,
                  spfli-connid   UNDER text-002,
                  spfli-airpfrom UNDER text-003,
                  spfli-airpto   UNDER text-004,
                  spfli-deptime  UNDER text-007,
                  spfli-arrtime  UNDER text-011.
      ENDLOOP.                             " LOOP AT T_SPFLI...
    ENDFORM.                               " FORM DISPLAY_SPFLI_DATA
    FORM user_command .
      CASE sy-ucomm.
        WHEN 'SELECT'.
          w_checkbox1 = 'X'.
          DO w_lines TIMES.
            w_lineno = sy-index + 3.
            READ LINE w_lineno FIELD VALUE w_checkbox.
            IF w_checkbox = '*'.
              CONTINUE.
            ELSE.
              MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
            ENDIF.                         " IF W_CHECKBOX = '*'
          ENDDO.                           " DO W_LINES TIMES.
        WHEN 'DESELECT'.
          w_checkbox1 = ' '.
          DO w_lines TIMES.
            w_lineno = sy-index + 3.
            READ LINE w_lineno.
            IF w_checkbox = '*'.
              CONTINUE.
            ELSE.
              MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
            ENDIF.                         " IF W_CHECKBOX = '*'
          ENDDO.                           " DO W_LINES TIMES.
        WHEN 'RETRIEVE'.
          w_checkbox = ' '.
          DO w_lines TIMES.
            w_lineno = sy-index + 3.
            READ LINE w_lineno FIELD VALUE w_checkbox INTO w_checkbox.
            IF w_checkbox = 'X'.
              PERFORM fetch_sflight_data.
              PERFORM display_sflight_data.
            ENDIF.                         " IF W_CHECKBOX = 'X'
          ENDDO.                           " DO W_LINES TIMES.
      ENDCASE.                             " CASE SY-UCOMM
    ENDFORM.                               " FORM USER_COMMAND
    This report gives you the SPFLI Data and places a check box in front of each record. When u click on select all button it will select all the records. And if you click on deselect all it will deselect all the records. When you are trying this maintain the pf-status 'YMENU1' and give the function codes as in the code.
    Regards,
    Swapna.

  • ALV Grid( How to calculate percentage) using alv gridfunctional module.

    Dear Gurus,
    In my report first coulmn and second column are sales and margin but third coulmn is margin%. now at last of report i want to display total sales and total margin and overall margin percentage. I am able to do total of sales and margin by using standard functionality of grid. I need to know to calculate overall percentage. I am not using alv oops method . I am using fucntional modules .
    Thanks in advance.
    Regards
    Dave

    Hi Devendra shrama,
    Percentage calculation in ALV
    The following method is a bit of a mission but it
    seems to be the only way around this at the moment.
    Also it only works with an ALV Grid not an ALV List.
    You have to take over the total lines manually.
    1. In the ALV output tab add extra fields that are the
    same as those on which you are sorting and contain the
    same values.
    2. In the Field Catalog you must add these fields but
    they must be hidden i.e. no_out = 'X'.
    3. These fields must be included in the Sort Catalog
    with subtot = 'X'.
    4. In order to handle the final total line in your
    layout for the ALV you must set field no_totalline'X' because you are going to be taking this over as
    well.
    5. Create a form called SUBTOTAL_TEXT or similar
    structured as follows:
    form subtotal_text using ep_subtot_line like
    output_tab
    es_subtottxt type
    slis_subtot_text.
    In this form you will do the percentage calculation
    again at total level. The structure ep_subtot_line
    will contain a field for each of the fields in your
    output_tab i.e. ep_subtot_line-sales,
    ep_subtot_line-cost and ep_subtot_line-margin. Put the
    margin calculation into ep_subtot_line-margin.
    6. In the eventtab that you pass to the ALV_GRID
    function module you must create a record with the
    field name = 'SUBTOTAL_TEXT' and the field form = the
    name of the form you created in step 5 above.
    This works OK.
    i hope it helps you.Happy solving.
    thanks
    karthik

  • Alv grid: how to set cursor to the next field

    Hi Abapers,
    When I input the data in first cell and do a tab for coming to next cell to give the input it is coming back to my first cell in the ALV grid.
    Any idea's on how do I deal with this.
    Many Thanks,
    Jagan.

    Hi Group,
    Finally I got the solution for this, here is the stuff we need to do:
    ***********04/03/2010
    *----Get the current cell
                CALL METHOD wa_grid->get_current_cell
                  IMPORTING
                    es_col_id = li_col
                    es_row_no = li_rows.
    **--Get Scroll Position
                CALL METHOD wa_grid->get_scroll_info_via_id
                  IMPORTING
                    es_col_info = ls_col
                    es_row_no   = ls_num.
    ***********04/03/2010
                CALL METHOD wa_grid->refresh_table_display.
               CLEAR: wa_profile1.     ", wa_pro_new.
    ********04/03/2010
    *--Set Scroll Position
                CALL METHOD wa_grid->set_scroll_info_via_id
                  EXPORTING
                    is_col_info = ls_col
                    is_row_no   = ls_num.
    *----Set the cell information
                ls_row-index = li_rows-row_id.
                CALL METHOD wa_grid->set_current_cell_via_id
                  EXPORTING
                    is_row_id    = ls_row
                    is_column_id = li_col
                    is_row_no    = li_rows.
    ********04/03/2010
    Hope this info might be useful to anyone facing the similar issue.
    Cheers,
    Jagan.

  • ALV GRID  - how to handle scrollbar click

    Hello,
    Is it possible to handle scrollbar movment/click
    in alv grid control?
    Thanks in advance for your help.
    Harry

    Hello vijay,
    I'am implementing a calendar with the alv grid control.
    Since I do not want to process all the data at one time
    I need to know when the scrollbar reach the upper or lower extremity so that I can populate + other processes the alv grid.
    Something very similar to the actual behaviour of "F4_DATE" function module displaying the Calendar control.
    Hope you can help me
    Thanks

  • ALV grid - how to break a long string into several lines?

    I have a ALV grid, where one of the fields contains a textstring that is typically 100 characters long.
    Is it possible to break this long string into shorter strings on multiple rows?
    Kind of like in Excel, when using row break...

    Thats not possible in ALV

  • ALV GRID - How to activate the option "Display graphic"  ?

    Hello,
    I'm using
          CREATE OBJECT r_container
            EXPORTING
              container_name = 'CONTAINER'.
          CREATE OBJECT r_grid
            EXPORTING
              i_parent = r_container
    Create Event Receiver
          CREATE OBJECT cl_event_receiver.
    Populate Field Catalog
          PERFORM get_fieldcatalog.
          r_grid->set_table_for_first_display(
            CHANGING
              it_outtab        = it_table
              it_fieldcatalog  = it_fieldcat[] ).
    and, as you can see I'm display it_table specifing the field of the table (I'm not usinf dictionnary reference  ).
    My problem is:
    all run perfectly except the button "Display graphic" ( the graphic is showed but is empty).
    How to solve it ?
    tks.

    Hi,
    It will help if u can elaborate on your actual problem.
    Display graphic button?
    Where do you want to display the graphic?
    And what graphic?

  • ALV Grid : How to use Matcode / Search Help ? :-)

    Hi all,
    I'm using REUSE_ALV_GRID_DISPLAY, and I want to edit a field and use a matchcode/search help to enable the user to choose in a list.
    In my Fieldcat routine I've :
            w_fieldcat_alv-edit          = 'X'.
            w_fieldcat_alv-datatype      = 'CHAR'.
            w_fieldcat_alv-inttype       = 'C'.
            w_fieldcat_alv-ref_tabname   = 'MARA'.
            w_fieldcat_alv-ref_fieldname = 'MATNR'.
    At the ALV display, the field can be edited, the matchcode and a correct list is displayed but I can't select a field.
    When I select a field, it's not copied to the alv cell.
    Someone can help me, plz ?
    Regards,
    Erwan

    Hi,
    THe following code is working fine..In the field catalog have the field INPUT = 'X' also..
    TYPE-POOLS: slis.
    DATA: BEGIN OF itab OCCURS 0,
            VBELN TYPE VBELN,
          END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0,
            VBELN TYPE VBELN,
            POSNR TYPE POSNR,
            NETPR TYPE NETPR,
            matnr type matnr,
          END OF itab1.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'VBELN'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'POSNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'POSNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    clear: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'NETPR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'NETPR'.
    s_fieldcatalog-do_sum    = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    clear: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'MATNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'MATNR'.
    s_fieldcatalog-ref_tabname = 'MARA'.
    s_fieldcatalog-ref_fieldname = 'MATNR'.
    s_fieldcatalog-edit = 'X'.
    s_fieldcatalog-input = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    SELECT VBELN UP TO 10 ROWS
           FROM
           VBAK
           INTO TABLE ITAB.
    IF NOT ITAB[] IS INITIAL.
      SELECT VBELN POSNR NETPR matnr
             FROM VBAP
             INTO TABLE ITAB1
             FOR ALL ENTRIES IN ITAB
             WHERE VBELN = ITAB-VBELN.
    ENDIF.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = v_repid
       IT_FIELDCAT                    = t_fieldcatalog
      TABLES
        t_outtab                       = itab1
    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.
    THanks,
    Naren

  • ALV Grid Calling Transaction Code

    Hello Everybody
    Can anyone help me about my problem in using ALV Grid calling a transaction code...?Here is the sample code below..
           IF rs_selfield-fieldname = 'BELNR'.
            SET PARAMETER ID 'BLN' FIELD  rs_selfield-value.
            CALL TRANSACTION 'FB03'  AND SKIP FIRST SCREEN.
          ENDIF.
    the main problem is how can I set my parameter id for company since
    my rs_field-value is for the column BELNR ( document # field only)
    it returns error when i set this code since i have no value to pass for rs_selfield for company code
            SET PARAMETER ID 'BUK' FIELD 
    Help
    thanks in advance
    aVaDuDz

    Hi,
    *"Table declarations...................................................
    TABLES:
      rbkp,                                " Document Header Invoice receipt
      rseg,                                " Document Item: Incoming Invoice
      eban,                                " Purchase Requisition
      t001w.                               " Plants/Branches
    *"Selection screen elements............................................
    PARAMETERS:
      p_gjahr LIKE rbkp-gjahr.             " Fiscal Year
    SELECT-OPTIONS:
      s_belnr FOR rbkp-belnr,              " Document number of an invoice
      s_bldat FOR rbkp-bldat,              " Document Date in Document
      s_budat FOR rbkp-budat,              " Posting Date in the Document
      s_werks FOR rseg-werks.              " Plant
    *" Data declarations...................................................
    Work variables                                                      *
    DATA:
      w_flag1  TYPE c VALUE '0',           " Flag variable 1
      w_flag2  TYPE c VALUE '0',           " Flag variable 2
      w_index1 TYPE sy-tabix.              " Index variable
    Field String to hold Document Header Invoice receipt                *
    DATA:
      BEGIN OF fs_rbkp,
        belnr TYPE rbkp-belnr,             " Document number of an invoice
        gjahr TYPE rbkp-gjahr,             " Fiscal Year
        bldat TYPE rbkp-bldat,             " Posting Date in the Document
        budat TYPE rbkp-budat,             " Posting Date in the Document
        lifnr TYPE rbkp-lifnr,             " Different invoicing party
      END OF fs_rbkp,
    Internal table to hold Document Header Invoice receipt              *
      t_rbkp LIKE STANDARD TABLE OF fs_rbkp.
    Field String to hold Document Item: Incoming Invoice                *
    DATA:
      BEGIN OF fs_rseg,
        belnr TYPE rseg-belnr,             " Document number of an invoice
        ebeln TYPE rseg-ebeln,             " Purchasing Document Number
        wrbtr TYPE rseg-wrbtr,             " Amount in document currency
      END OF fs_rseg,
    Internal table to hold Document Item: Incoming Invoice              *
    t_rseg LIKE STANDARD TABLE OF fs_rseg.
    Field String to hold Purchase Requisition                           *
    DATA:
      BEGIN OF fs_eban,
        banfn TYPE eban-banfn,             " Purchase requisition number
        ernam TYPE eban-ernam,             " Person who Created the Object
        afnam TYPE eban-afnam,             " Name of requisitioner/requester
        badat TYPE eban-badat,             " Requisition (request) date
        ebeln TYPE eban-ebeln,             " Purchase order number
      END OF fs_eban,
    Internal table to hold Purchase Requisition                         *
      t_eban LIKE STANDARD TABLE OF fs_eban.
    Field String to hold Desired Data                                   *
    DATA:
      BEGIN OF fs_final,
        ebeln TYPE rseg-ebeln,             " Purchasing Document Number
        banfn TYPE eban-banfn,             " Purchase requisition number
        badat TYPE eban-badat,             " Requisition (request) date
        bldat TYPE rbkp-bldat,             " Posting Date in the Document
        lifnr TYPE rbkp-lifnr,             " Different invoicing party
        wrbtr TYPE rseg-wrbtr,             " Amount in document currency
        afnam TYPE eban-afnam,             " Name of requisitioner/requester
        ernam TYPE eban-ernam,             " Name of Person who Created the
                                           " Object
      END OF fs_final,
    Internal table to hold Desired Data                                 *
      t_final LIKE STANDARD TABLE OF fs_final.
                          INITIALIZATION                                *
    INITIALIZATION.
      p_gjahr = sy-datum+0(4).
                          AT SELECTION-SCREEN EVENT                     *
    AT SELECTION-SCREEN.
      IF s_belnr IS INITIAL OR s_bldat IS INITIAL OR s_budat IS INITIAL.
        MESSAGE ' (Invoice) Add Creation Date .' TYPE 'E'.
      ENDIF.                               " IF S_BELNR...
                          AT SELECTION-SCREEN ON FIELD EVENT            *
    AT SELECTION-SCREEN ON s_werks.
      SELECT SINGLE werks                  " Plant
        FROM t001w
        INTO t001w
       WHERE werks IN s_werks.
      IF sy-subrc NE 0.
        MESSAGE 'Invalid plant' TYPE 'E'.
      ENDIF.                               " IF SY-SUBRC NE 0.
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      PERFORM get_purchaserequistion.
      LOOP AT t_rseg INTO fs_rseg.
        READ TABLE t_rbkp INTO fs_rbkp WITH KEY belnr = fs_rseg-belnr
                                                        BINARY SEARCH.
        IF sy-subrc EQ 0.
          READ TABLE t_eban INTO fs_eban WITH KEY ebeln = fs_rseg-ebeln
                                                        BINARY SEARCH.
          IF sy-subrc EQ 0.
            IF fs_rbkp-bldat LE fs_eban-badat.
              DELETE t_rseg INDEX sy-tabix.
            ENDIF.                         " IF FS_RBKP-BLDAT...
          ENDIF.                           " IF SY-SUBRC EQ 0
        ENDIF.                             " IF SY-SUBRC EQ 0
      ENDLOOP.                             " LOOP AT T_RSEG...
      LOOP AT t_rbkp INTO fs_rbkp.
        WHILE w_flag1 EQ '0'.
          READ TABLE t_rseg INTO fs_rseg WITH KEY belnr = fs_rbkp-belnr
                                                          BINARY SEARCH.
          w_index1 = sy-tabix.
          IF sy-subrc EQ 0.
            WHILE w_flag2 EQ '0'.
              READ TABLE t_eban INTO fs_eban WITH KEY ebeln = fs_rseg-ebeln
                                                              BINARY SEARCH.
              IF sy-subrc EQ 0.
                fs_final-bldat = fs_rbkp-bldat.
                fs_final-lifnr = fs_rbkp-lifnr.
                fs_final-ebeln = fs_rseg-ebeln.
                fs_final-wrbtr = fs_rseg-wrbtr.
                fs_final-banfn = fs_eban-banfn.
                fs_final-badat = fs_eban-badat.
                fs_final-afnam = fs_eban-afnam.
                fs_final-ernam = fs_eban-ernam.
                APPEND fs_final  TO t_final.
                CLEAR fs_final.
                DELETE t_eban INDEX sy-tabix .
              ELSE.
                w_flag2 = '1'.
                DELETE t_rseg INDEX w_index1.
              ENDIF.                       " IF SY-SUBRC EQ 0
            ENDWHILE.                      " WHILE W_FLAG2...
            w_flag2 = '0'.
          ELSE.
            w_flag1 = '1'.
          ENDIF.                           " IF SY-SUBRC EQ 0
        ENDWHILE.                          " WHILE W_FLAG1...
        w_flag1 = '0'.
      ENDLOOP.                             " LOOP AT T_RBKP...
      CLASS lcl_event_receiver DEFINITION DEFERRED.
    Declare reference variables to the ALV grid and the container
      DATA :
        cust_con TYPE scrfname VALUE 'BCALVC_TOOLBAR_D100_C1',
        cont_on_dialog TYPE scrfname VALUE 'BCALVC_TOOLBAR_D101_C1',
        ref1 TYPE REF TO cl_gui_custom_container,
        ref2 TYPE REF TO cl_gui_alv_grid,
        event_receiver TYPE REF TO lcl_event_receiver,
        fcat    TYPE lvc_t_fcat,
        wa      TYPE lvc_s_fcat,
        wa_layo TYPE lvc_s_layo.
      CALL SCREEN 200.
    class lcl_event_receiver: local class to define and handle own
    *functions......................................................
    Definition:
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
                IMPORTING e_object e_interactive,
        handle_user_command
            FOR EVENT user_command OF cl_gui_alv_grid
                IMPORTING e_ucomm.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    class lcl_event_receiver (Implementation)
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA: ls_toolbar  TYPE stb_button.
    E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
    append a separator to normal toolbar
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    append an icon to show booking table
        CLEAR ls_toolbar.
        MOVE 'PORDER' TO ls_toolbar-function.
        MOVE icon_employee TO ls_toolbar-icon.
        MOVE 'Show Bookings' TO ls_toolbar-quickinfo.
        MOVE 'PONUMBER' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    append a separator to normal toolbar
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    append an icon to show booking table
        CLEAR ls_toolbar.
        MOVE 'PREQUISITION' TO ls_toolbar-function.
        MOVE icon_employee TO ls_toolbar-icon.
        MOVE 'Show Bookings' TO ls_toolbar-quickinfo.
        MOVE 'PRNUMBER' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.                           " handle_toolbar
      METHOD handle_user_command.
    *Event handler method for event USER_COMMAND:
        CASE e_ucomm.
          WHEN 'PORDER'.
            CALL TRANSACTION 'ME23N'.
          WHEN 'PREQUISITION'.
            CALL TRANSACTION 'ME53N'.
        ENDCASE.
      ENDMETHOD.                           " handle_user_command
    ENDCLASS.                              " lcl_event_receiver
    *& Module STATUS_0200 OUTPUT
    text
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'GUI'.
      SET TITLEBAR 'TITLE'.
      IF sy-ucomm = 'BACK'.
        LEAVE PROGRAM.
      ENDIF.
      PERFORM form_fcat.
      PERFORM form_layo.
      IF ref1 IS INITIAL.
        CREATE OBJECT ref1
        EXPORTING
    PARENT = ref1
        container_name = 'CUST_CON'
    STYLE =
    LIFETIME = lifetime_default
    REPID =
    DYNNR =
    NO_AUTODEF_PROGID_DYNNR =
        EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS                      = 6
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
      IF ref2 IS INITIAL.
        CREATE OBJECT ref2
        EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
        i_parent = ref1
    I_APPL_EVENTS = space
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    I_NAME =
        EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init  = 2
        error_cntl_link  = 3
        error_dp_create  = 4
        OTHERS = 5
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL METHOD ref2->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    is_layout = wa_layo
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
        CHANGING
        it_outtab = t_final
        it_fieldcatalog = fcat
    IT_SORT =
    IT_FILTER =
       EXCEPTIONS
       invalid_parameter_combination = 1
       program_error                 = 2
       too_many_lines                = 3
       OTHERS                        = 4
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR ref2.
        SET HANDLER event_receiver->handle_toolbar FOR ref2.
    *Call method 'set_toolbar_interactive' to raise event TOOLBAR.
        CALL METHOD ref2->set_toolbar_interactive.
      ENDIF.
    ENDMODULE.                             " STATUS_0200 OUTPUT
    Form FORM_FCAT                                                     *
    text                                                               *
    FORM form_fcat.
      CLEAR fcat.
      CLEAR wa.
      wa-fieldname = 'EBELN'.
      wa-col_pos = 1.
      wa-scrtext_l = ' PURCHASE ORDER NUMBER'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'BANFN'.
      wa-col_pos = 2.
      wa-scrtext_l = 'PURCHASE REQUISITION NUMBER'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'BADAT'.
      wa-col_pos = 3.
      wa-scrtext_l = 'PR CREATION DATE'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'BLDAT'.
      wa-col_pos = 4.
      wa-scrtext_l = 'INVOICE DATE'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'LIFNR'.
      wa-col_pos = 5.
      wa-scrtext_l = 'VENDOR NUMBER'.
      APPEND wa TO fcat.
      wa-fieldname = 'WRBTR'.
      wa-col_pos = 6.
      wa-do_sum  = 'X'.
      wa-scrtext_l = ' PO AMOUNT'.
      APPEND wa TO fcat.
      wa-fieldname = 'AFNAM'.
      wa-col_pos = 7.
      wa-scrtext_l = 'REQUISITIONER'.
      APPEND wa TO fcat.
      wa-fieldname = 'ERNAM'.
      wa-col_pos = 8.
      wa-scrtext_l = 'PR CREATOR'.
      APPEND wa TO fcat.
    ENDFORM.                               " FORM_FCAT
    Module USER_COMMAND_0200 INPUT                                      *
    text                                                                *
    MODULE user_command_0200 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                             " USER_COMMAND_0200 INPUT
         FORM FORM_LAYO                                                *
    There are no interface parameters to be passed to this subroutine.*
    FORM form_layo.
      CLEAR wa_layo.
      wa_layo-zebra = 'X'.
      wa_layo-grid_title = 'GRID TITLE'.
      wa_layo-no_toolbar = 'X'.
    ENDFORM.                               " FORM_LAYO
         FORM GET_PURCHASEREQUISITION                                   *
    This subroutine selects all the Purchase requisitions from table   *
    EBAN for all the selected Invoices based on the Purchase orders.   *
    There are no interface parameters to be passed to this subroutine. *
    FORM get_purchaserequistion.
      SELECT belnr                         " Document number of an invoice
             gjahr                         " Fiscal Year
             bldat                         " Posting Date in the Document
             budat                         " Posting Date in the Document
             lifnr                         " Different invoicing party
        FROM rbkp
        INTO TABLE t_rbkp
       WHERE belnr IN s_belnr
         AND gjahr EQ p_gjahr
         AND bldat IN s_bldat
         AND budat IN s_budat.
      IF NOT t_rbkp[] IS INITIAL.
        SELECT belnr                       " Document number of an invoice
               ebeln                       " Purchasing Document Number
               wrbtr                       " Amount in document currency
          FROM rseg
          INTO TABLE t_rseg
           FOR ALL ENTRIES IN t_rbkp
         WHERE belnr EQ t_rbkp-belnr
           AND werks IN s_werks.
      ENDIF.                               " IF NOT t_rbkp[] IS INITIAL...
      IF NOT t_rseg[] IS INITIAL.
        SELECT banfn
               ernam
               afnam
               badat
               ebeln
          FROM eban
          INTO CORRESPONDING FIELDS OF TABLE t_eban
           FOR ALL ENTRIES IN t_rseg
         WHERE ebeln EQ t_rseg-ebeln.
      ENDIF.                               " IF NOT t_rseg[] IS INITIAL...
    ENDFORM.                               " GET_PURCHASEREQUISITION
    reward points if helpful.
    regards,
    kiran kumar k.

  • Problem with ALV Grid (created via FM)

    Dear forumers,
    When double-clicking on any data row of an ALV grid, the following runtime error occurs:
    Runtime error: PERFORM_NOT_FOUND
    Exception: CX_SY_DYN_CALL_ILLEGAL_FORM
    Short Text
    =======
    Call (PERFORM) to a non-existent routine.
    What happened?
    ==========
    There exist various options:                                                     
    Error in the ABAP Application Program                                                                               
    The current ABAP program "SAPLSLVC_FULLSCREEN" had to be terminated
    because it has come across a statement that unfortunately cannot be executed.                   
    or                                                                               
    Error in the SAP kernel.                                                         
    The current ABAP "SAPLSLVC_FULLSCREEN" program had to be terminated because the  
    ABAP processor detected an internal system error.
    How can I resolve this error for an ALV grid? The ALV grid is created via the FM, 'REUSE_ALV_GRID_DISPLAY' and the field catalog is built via the FM, 'REUSE_ALV_FIELDCATALOG_MERGE'.
    Please help. Thanks so much.
    I also noticed in the Data Browser, SE16 - that if the table contents are displayed in an ALV Grid, double-clicking on any data row will not generate the same error. It also has an additional column on the leftmost to aid the data row selection. Any other ideas on this?
    Edited by: Deborah Tan on Jun 23, 2010 8:16 AM

    Hi Deborah,
    While calling 'REUSE_ALV_GRID_DISPLAY', You should have also passed the parameter I_CALLBACK_USER_COMMAND with any form name, or You have passed table IT_EVENTS with form name 'USER_COMMAND' with a form mentioned in it.
    If You do not require any user interaction on your ALV, comment the line where I_CALLBACK_USER_COMMAND is passed, or delete the line for 'USER_COMMAND' from the table that is passed in IT_EVENTS.
    Else, if You require user interaction, You need to code a form for user command in your program as FORM_USER_COMMAND USING  OK_CODE  SELFIELD.
    Remember the name of the form (for e.g. 'FORM_USER_COMMAND') should be the same that you pass in CALLBACKUSER_COMMAND or the one in 'USER_COMMAND' in table for IT_EVENTS.
    Regards,
    Birendra

Maybe you are looking for

  • I just got my iPhone 4 & need a lil help. May I please get some help?

    Ok...I finally got home & am able to play around w/ my new iPhone 4. I logged onto my iTunes account and a screen popped up saying "An iPhone has previously been linked to this computer"..Then I get 2 options: -Set up as new iPhone -Restore from the

  • List view issues

    version 12.1.2 I have a list view with 2 rows, 2 columns. column sizes are ( c1 = 85% and c2 = 15 %). C1 displays table data, and c2 has a button on each row, which takes me to different page. When I click the button I am expecting it to take me to t

  • Upgrading oracle database 9.2.0.5 to 9.2.0.8 for Oracle E-Business suite

    I have applied patch to upgrade Oracle E-business suite(11.5.10) database from 9.2.0.5 to 9.2.0.8. but after applying patch also it showing 9.2.0.5. please help me.

  • What ssd should i get for my lenovo t61 please advise

    what ssd should i get for my lenovo t61 please advise i like the samsungs , will sata II work on it ?

  • Flash 10 fails in 64-bit linux

    Hello, My System: 64-bit system, Mandriva 2008.1 for 64-bit, Firefox 2.0.0.13 for 64-bit, 2 GB RAM, wireless with WPA encryption and broadband. Recently I wanted to upgrade Flash Player from v9 to v10 (YouTube and likely many other sites IIRC are enc