Application Development and Automation 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: 
Read only

which row selected first in table control

Former Member
0 Likes
3,470

Hi Guru,

I have a table control in which multiple rows can be selected.

My requirement is to know which row is selected first.

Can it be possible?

Plz help.

Thanks & Regards,

Abdul.

Hi Guru,

I have a table control in which multiple rows can be selected.

My requirement is to know which row is selected first.

Can it be possible?

Plz help.

Thanks & Regards,

Abdul.

13 REPLIES 13
Read only

Former Member
0 Likes
2,313

Hi Abdul,

It is very easy. The table control to be displayed is displayed according to your entries in your internal table. When you select any entry there is a 1 char field in the table control that gets selected. So in PAI when you loop on your internal table, all the selected fields will be marked as X in your 1 char field. It will be in the same order.

Hope its clear.

Read only

0 Likes
2,313

Hi Siddharth,

Question is not that , how we can know which selected first in table control.

Read only

0 Likes
2,313

Hi Ramesh,

Can it be possible??If yes, do you know the solution?

Regards,

Abdul

Read only

0 Likes
2,313

i think it can not be possible....

Read only

Former Member
0 Likes
2,313

s/m Abdul,

Declare ABAP variable to store line selection indicator.

    DATA: MARK TYPE C.

In your internal table also keep a field as SEL

Now in the Screen

In the PAI.

PROCESS AFTER INPUT.

  loop at itab.
       module update_table.
     endloop.

Now insert the following ABAP code into this PAI module!

*&---------------------------------------------------------------------*
*&      Module  update_table  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module update_table input.

read table itab into wa_itab index tc100-CURRENT_LINE.

   wa_itab-SEL = mark.
   modify itab from wa_itab index tc100-CURRENT_LINE.

endmodule.                 " update_table  INPUT

I have given for both Single as well as Multi Select.

You can read the table itab where sel = 'X' this will give you the first selected record.

Read only

0 Likes
2,313

w/s mohammed bhai,

but how to trigger PAI when we select a row in table control.

I checked.It is not triggering PAI when i select a row in table control.

Regards,

Abdul

Read only

0 Likes
2,313

The PAI will trigger when you press Enter or any executing button.

Read only

0 Likes
2,313

Yes abdul. You are correct. Just by selecting the rows doesnt call PAI.

I dont think this is possible to know which row has been selected first in ascending order.

Only thing we can get are the selected rows.

Or else we need to call PAI everytime we select a row in table control.

Read only

0 Likes
2,313

hi,

but i dont want to press enter or any execution button.

Can it be possible to trigger now.....(we can just click on a row.No pressing of button etc)

regards,

Abdul

Read only

0 Likes
2,313

Yes Siddharth.

Do you know how to trigger PAI everytime..as you have written "Or else we need to call PAI everytime we select a row in table control."

Regards,

Abdul

Read only

0 Likes
2,313

Hi Abdul.

As such it is not possible since PAI won't be triggered from selection line.

But there is one alternative way for your requirement.

1) Disable default selection (means user cannot select it by pressing selection line)

     PBO

     loop at screen.

       if screen-name  = 'ITAB-SEL'.

         screen-active = 0.

         modify screen.

       endif.

     endloop.


2) Deploy additional column for the selection in table control with either button or hyperlink (Which Triggers PAI).

    In your PAI,highlight the selected record by passing itab-sel = 'X'

3)Write the logic to find out which one is the first selected.

Hope it helps you

Read only

former_member188251
Active Participant
0 Likes
2,313

Hi All,

If we have another field 'counter' in the original internal table which stores the record number (1 for 1st rec, 2 for 2nd rec etc)  , cant this be used to get the record number of the selected record in the table control. Pls let me know your thoughts.

--Shankar--

Read only

Former Member
0 Likes
2,313

Hi Rahiman,

Instead of selecting w/SelColumn check box in your table control. just put button in your table control and give FCODE for this. and please dont ask any example for this. it is very simple. and handle fcode with your selected line of table control.

Regards

Amit