Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Flow of screens from slecetion screen to alv to screen

Former Member
0 Kudos

I have my first selection screen. On selection a radio button ALV is displayed.

I have a hotspot on ALV. On clicking we get another screen where these fields can be changed.

On clicking on BACK button we again come to ALV display.

But from ALV I need to go back to my first screen. But it is going to the last screen.

The pf_status set for the ALV is no longer valid.

Sy-ucomm is blank.

..

thanks in advance

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos

post the code if possible(not involved in more lines of code or not involved in custom tables).

former_member188685
Active Contributor
0 Kudos

I just recreated the same steps, and coded in this following way.

i have a selection screen , when enter some value and Execute the report then in displayed the ALV report. then When i check some thing and double click on any line. then it navigates to the secondary list. Once it is done i press back button, it back to the Main ALV , once it is in the main ALV list, if i press back button it navigates the selection screen. is it that you are expecting or any thing else./ check it once.

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-options: carrid for itab-carrid.

SELECT carrid
       connid
FROM sflight
UP TO 20 ROWS
INTO TABLE itab
where carrid in carrid.

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 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