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: 

To capture the current line in table contol.

Former Member
0 Kudos
102

Hi friends,

I have created a table control.

Now my requiremnet is in my table control i have 10 rows of data.

Now i need to capture the whole record on which i have clicked.

How should i capture the current row clicked in the table contol.

can any one suggest..

Regards,

Priyanka.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
78

Hi,

check the following code:

process before output.

   loop at itab
       into wa
       with control datams  "table control name
       cursor datams-current_line.

       module XXXX.  "you can define any module you want 

  endloop.

module XXXX  output.
  if datams-current_line = 1.
    " you will get the values for the current line.
  endif.
  
endmodule.

hope it helps.

Regards,

Chris Gu

Edited by: Gu Chris on Nov 19, 2008 9:25 AM

7 REPLIES 7

JozsefSzikszai
Active Contributor
0 Kudos
78

current line of table control is stored in sy-stepl. you can do something like READ TABLE ... INTO ... INDEX ... Of course you have to LOOP through the table control, to update the internal table.

0 Kudos
78

can u provide me sample code.

Regards,

Priyanka.

0 Kudos
78

sorry, might have been wrong, better to do something like this:

in the PAI:

1. put a GET CURSOR statement, where the addition LINES will tell in which line the cursor is.

2. LOOP the table control to fill your data from screen to internal table

3. READ TABLE ... INDEX x (here comes the number you have from step 1.)

0 Kudos
78

Eric can u provide the logic for this.

iam very much confused with ur answers.

Regards,

Priyanka.

Former Member
0 Kudos
78

In PAI.

U will be having a LOOP AT itab "itab -> table control's internal table

inside that loop put a PAI module.

use CURRENT_LINE property of table control.

read table using current line as index

as eric has suggested you can use "get cursor" Command also to get the current line index

for example

 
PROCESS AFTER INPUT. 
LOOP AT G_ZADVUPDATE_DS_ITAB. 
    CHAIN. 
      FIELD tab_cont-field1. 
      FIELD tab_cont-field2. 
    module get_current_line. 
    ENDCHAIN. 
  ENDLOOP. 

in PAI module

 
data : tabix type sy-tabix . 
tabix = ztab_cont-CURRENT_LINE . 
read table itab index tabix. 

Edited by: mrugesh phatak on Nov 17, 2008 3:48 PM

Former Member
0 Kudos
79

Hi,

check the following code:

process before output.

   loop at itab
       into wa
       with control datams  "table control name
       cursor datams-current_line.

       module XXXX.  "you can define any module you want 

  endloop.

module XXXX  output.
  if datams-current_line = 1.
    " you will get the values for the current line.
  endif.
  
endmodule.

hope it helps.

Regards,

Chris Gu

Edited by: Gu Chris on Nov 19, 2008 9:25 AM

former_member1245113
Active Contributor
0 Kudos
78

Hi Priyanka,

use dynpro_values_read.

which will return all the screen fields to you.

capture the internal table.

use get cursor to get the value on which the cursor is placed.

read table itab index THE_ABOVE_LINE.

hope this will serve your purpse.

Thanks and regareds

Ramchander Rao.Krishnamraju