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: 

interactive report help??

Former Member
0 Kudos
88

hi

i had an req to show the list display if ITAB with check box,& than to show the records on another list with the check box selected records only on final display.

i am not able to understand how to move the check box selected records to another list,what condition shd i use to do this?

please tell.

regards

5 REPLIES 5

Former Member
0 Kudos
65

Hi vipin ,

Can you please tell us that how you want to go on second list by push button or smthg else.

0 Kudos
65

well there is no push botton,but user want to print the final list.

bpawanchand
Active Contributor
0 Kudos
65

Hi

I hope this is a duplicate post

Regards

Pavan

former_member188685
Active Contributor
0 Kudos
65

if you are using ALV then it is simple..

check this 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-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-hotspot = '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

Regards

Vijay Babu Dudla

Former Member
0 Kudos
65

Hi,

In the user command, you write the below code

FORM user_command USING r_ucomm TYPE sy-ucomm
                        rs_selfield TYPE slis_selfield.

  DATA: e_grid TYPE REF TO cl_gui_alv_grid.

  IF e_grid IS INITIAL.
* This FM is use to get the grid control screen
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        e_grid = e_grid.
  ENDIF.

  IF e_grid IS NOT INITIAL.
* This method is used to get the changed the data in the ALV output
* into the internal table
    CALL METHOD e_grid->check_changed_data.
  ENDIF.

  CASE r_ucomm.
  -------------
  ------------

The method e_grid->check_changed_data, gets the changed data into the internal table you are using.

Now, in case r_ucomm, move the checked check box data to another internal table.

Display the those records only.

I hope this will solves your problem.

Thanks,

Phani Diwakar