Skip to Content
author's profile photo Former Member
Former Member

Regarding ALV Grid Problem

hi,

My requirement is to display an ALV report where i am making use of checkboxes to select the records in the report output and then making use of a 'Execute' button of application tool bar it has to go to another screen and display a classical report making use of the selected entries ... But in my case it is not moving from the first screen on to the second and is coming back to the first itself I don't want to come back to the first screen again rather i would like to continue with the logic and get that records display on to a screen screen ....Can somebody guide me as how to proceed on this .... If anyone of you have a sample code it will be of great help .......

Thanks,

Vara

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Aug 11, 2008 at 12:00 PM

    Please post your code here.

    Regards

    Vijay Babu Dudla

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2008 at 12:04 PM

    Did you use a [LEAVE TO LIST-PROCESSING|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=leaveTOLIST-PROCESSINGandbacktoALV&adv=false&sortby=cm_rnd_rankvalue] after your Writes.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2008 at 01:13 PM

    As Suggested by Raymond it is possible to Navigate using the LEAVE LIST PROCESSING.

    But you have do some more things apart from that. You need to set the status in the secondary list inorder to come back to ALV list, Otherwise it is not coming to basic ALV list.

    check the sample code..

    REPORT ztest_alv_check MESSAGE-ID zz .
    
    TYPE-POOLS: slis.
    DATA: x_fieldcat TYPE slis_fieldcat_alv,
          it_fieldcat TYPE slis_t_fieldcat_alv,
          l_layout TYPE slis_layout_alv.
    DATA: it_book TYPE STANDARD TABLE OF sbook WITH HEADER LINE.
    TYPES: BEGIN OF t_itab ,
            carrid LIKE sflight-carrid,
            connid LIKE sflight-connid,
            chk(1),
          END OF t_itab.
    DATA: BEGIN OF itab OCCURS 0,
            carrid LIKE sflight-carrid,
            connid LIKE sflight-connid,
            chk(1),
          END OF itab.
    
    SELECT carrid
           connid
    FROM sflight
    UP TO 20 ROWS
    INTO TABLE itab.
    
    x_fieldcat-fieldname = 'CHK'.
    x_fieldcat-seltext_l = 'Check'.
    x_fieldcat-checkbox = 'X'.
    x_fieldcat-input = 'X'.
    x_fieldcat-edit = 'X'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 1.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    
    
    x_fieldcat-fieldname = 'CARRID'.
    x_fieldcat-seltext_l = 'CONNID'.
    x_fieldcat-hotspot = 'X'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 2.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-seltext_l = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 3.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    
    
    
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program      = sy-repid
        is_layout               = l_layout
        i_callback_user_command = 'USER_COMMAND'
        it_fieldcat             = it_fieldcat
      TABLES
        t_outtab                = itab
      EXCEPTIONS
        program_error           = 1
        OTHERS                  = 2.
    IF sy-subrc NE 0.
    
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    
    AT USER-COMMAND.
      IF sy-ucomm = 'BACK'.
    *    LEAVE LIST-PROCESSING.
      ENDIF.
    *&---------------------------------------------------------------------*
    *&      Form  USER_COMMAND
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    *----------------------------------------------------------------------*
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    
      DATA: gd_repid LIKE sy-repid, "Exists
      ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      CASE r_ucomm.
    
        WHEN '&IC1'.
          READ TABLE itab INDEX rs_selfield-tabindex.
          IF sy-subrc EQ 0.
            LEAVE TO LIST-PROCESSING ."AND RETURN TO SCREEN 0.
            PERFORM show_bookings USING itab.
          ENDIF.
          BREAK-POINT.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM. "USER_COMMAND
    
    *&---------------------------------------------------------------------*
    *&      Form  show_bookings
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->ITAB       text
    *----------------------------------------------------------------------*
    FORM show_bookings USING itab TYPE t_itab.
    *-Set the PF-STATUS , Enable the Back Button with 
    *-BACK as function code.
      SET PF-STATUS 'AAA'.
      SELECT * FROM sbook
      INTO TABLE it_book
      WHERE carrid EQ itab-carrid AND
            connid EQ itab-connid.
    
      LOOP AT it_book.
    
        WRITE:/ it_book-carrid, it_book-connid.
    
      ENDLOOP.
    
    ENDFORM.                    "show_bookings

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.