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: 

module pool table control/ooalv line selection.

Former Member
0 Kudos
1,358

Am struggling about line selection.

In the table control, irrespective of line number I select, it is getting selected the first line(only), and navigating to the next screen and display first line item details.

eg: if I select the third line, the first line is getting selected(selection is shifting to first line) and in the next screen first line related data is showing.

Since I am new to module pool, am requesting you...

Thanks in advance.

1 ACCEPTED SOLUTION

former_member184569
Active Contributor
0 Kudos
251

  v_line TYPE sy-stepl.

Option 1.

CLEAR v_line.

   GET CURSOR LINE v_line.

*To get the correct row position in Table control in case of vertical scroll bars.

  v_line = v_line + tctrl-top_line - 1.        

Option 2. 

You can also use the following to get the current line.

v_line = tctrl-current_line.

Let me know if it is working fine.

5 REPLIES 5

david_carballido
Active Participant
0 Kudos
251

You have to use the fields that you put into the attributes of your table control to get the row selected, for example:

TYPES: BEGIN OF itab,

          field1 TYPE char1,

          field 2 TYPE char1,

          mark TYPE char1,

        END OF itab.

CONTROLS tv_100 TYPE TABLEVIEW USING SCREEN 100.

DATA: gt_itab TYPE TABLE OF ty_itab,

      gw_data TYPE ty_itab.

START-OF-SELECTION.

CALL SCREEN 100.

Into your screen you have to put this sentences

PROCESS BEFORE OUTPUT.

   MODULE STATUS_0100.            -> Logica to PBO

     LOOP AT gt_itab INTO gw_itab WITH CONTROL tv_100.

   ENDLOOP.

PROCESS AFTER INPUT.

   LOOP AT gt_itab.

     MODULE read_table_control.    -> Logica to set values from your table control to internal table

   ENDLOOP.


   MODULE user_command_0100.       -> Logica to process any action

Into de MODULE read_table_control

MODULE read_table_control INPUT.

  

  MODIFY gt_itab FROM gw_itab INDEX tv_100-current_line.

ENDMODULE.

And the field MARK of the internal table GT_ITAB have to be assigned to the attributes of table control TV_100


And then process the row selected into de MODULE user_command_100

READ TABLE gt_itab INTO gw_itab WITH KEY mark = 'X'.

IF sy-subrc = 0.

   ......

ENDIF.

I hope this help you

Regards.

DCC

former_member184569
Active Contributor
0 Kudos
252

  v_line TYPE sy-stepl.

Option 1.

CLEAR v_line.

   GET CURSOR LINE v_line.

*To get the correct row position in Table control in case of vertical scroll bars.

  v_line = v_line + tctrl-top_line - 1.        

Option 2. 

You can also use the following to get the current line.

v_line = tctrl-current_line.

Let me know if it is working fine.

0 Kudos
251

Hi,

Create a table control using Wizard option. While creating, you will be prompted to enter a field(say SEL) to hold the selections in the table control.

If a record is selected that field(SEL) will hold a value of 'X'. So while you display the second screen just display those records whose field SEL has a value of 'X'.

Hope this helps

Former Member
0 Kudos
251

Hi ,

      While creating a table control wizard, add one more column for line selection, Add the field in your internal table with which you are creating a table control.

     When you are navigating to next screen ( Before call statment ) , populate the data for which the column field value is 'X' , through that you can populate only the selected values .

Regards,

Aditya.

Former Member
0 Kudos
251

Hi John,

Have a look on this link http://*********/dialog/tabcontrol/tc_mark.htm.

Hope this will be helpful for you

Regards,

Prasanna