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: 

how to display multiple rows of table control in other table control?

Former Member
0 Kudos
642

Hi...  My requirement is  when user select multiple rows from table control wizard & click on button i want display these rows corresponding values in other table control.  how to display when user select multiple rows & click on button ,to display corresponding values in other table control.   Please give me solution?   Regards Karthik

2 REPLIES 2

Former Member
0 Kudos
116

Hi Karthik,

Check out this sample code. Add 2 table controls TABLE_CONTROL and TABLE  and a button also 'COPY'.

I copied the standard program  RSDEMO_TABLE_CONTROL and added a new table control in that.


REPORT  yrsdemo_table_control          .
CONTROLS table_control TYPE TABLEVIEW USING SCREEN 100.
CONTROLS table TYPE TABLEVIEW USING SCREEN 100.
TABLES sdyn_sdw4.
DATA sdyn_sdw41 TYPE sdyn_sdw4.
DATA sdyn_itab LIKE STANDARD TABLE OF sdyn_sdw4.
DATA sdyn_itab1 LIKE STANDARD TABLE OF sdyn_sdw4.
DATA init.
DATA ok_code LIKE sy-ucomm.
DATA save_ok LIKE sy-ucomm.
DATA mark.
DATA  col TYPE cxtab_column.

CALL SCREEN 100.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'GRUND'.
  SET TITLEBAR '100'.
  IF init IS INITIAL.
* Datenbeschaffung
    SELECT carrid connid cityfrom airpfrom cityto airpto deptime arrtime
             distance distid
             FROM spfli
             INTO CORRESPONDING FIELDS OF TABLE sdyn_itab.
    DESCRIBE TABLE sdyn_itab LINES table_control-lines.
    init = 'X'.
  ENDIF.

ENDMODULE.                             " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  FILL_TABLE_CONTROL  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE change_sdyn_conn OUTPUT.
* you can change the content of current table control line via
* sdyn_conn
*  READ TABLE sdyn_itab INTO sdyn_conn INDEX table_control-current_line.

ENDMODULE.                             " FILL_TABLE_CONTROL  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  READ_TABLE_CONTROL  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE read_table_control INPUT.
* Check input values
  IF mark = 'X' AND save_ok = 'COPY'.
    INSERT sdyn_sdw4 INTO  sdyn_itab1 INDEX 1 .
*    DESCRIBE TABLE sdyn_itab1 LINES table_control-lines.
  ENDIF.

ENDMODULE.                             " READ_TABLE_CONTROL  INPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
ENDMODULE.                             " USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*
*&      Module  EXIT  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE exit INPUT.
  LEAVE PROGRAM.
ENDMODULE.                 " EXIT  INPUT
*&---------------------------------------------------------------------*
*&      Module  PUT_TABLE_CONTROL  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE put_table_control INPUT.

ENDMODULE.                 " PUT_TABLE_CONTROL  INPUT

Screen 100.

  

PROCESS BEFORE OUTPUT.

  MODULE status_0100.
  LOOP AT sdyn_itab INTO sdyn_sdw4 WITH CONTROL table_control.
    MODULE change_sdyn_conn.
  ENDLOOP.
  LOOP AT sdyn_itab1 INTO sdyn_sdw41 WITH CONTROL table.
    MODULE change_sdyn_conn.
  ENDLOOP.

*
PROCESS AFTER INPUT.
  MODULE exit AT EXIT-COMMAND.
  MODULE user_command_0100.

  LOOP AT sdyn_itab.
    MODULE read_table_control.
  ENDLOOP.
  LOOP AT sdyn_itab1.
    MODULE put_table_control.
  ENDLOOP.

Cheers,

Shambu

Former Member
0 Kudos
116

Hi,

when the user selects multiple rows in the internal table used for table control copy the rows marked as selected ('X) to another internal table which you are using for other table control which will display automatically in next PBO.

thanks.