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: 

Push Button in Table Control Module Pool

Former Member
0 Kudos

Hi guy,

My problem is simple . i have a table control and i have added a push button in the table control. Suppose my table control has 2 values (ROWS) . When i press the pushbutton of the second row i want to fetch the values of only the second row. I have placed the coding within the loop but i am still not getting how to get those values as the whole loop is run. i have tried using w/sel coloumn but am not able to fetch it.

any help would be great .

Thanks in advance.

Regards,

Devrath Sampat.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Have u checked the program DEMO_DYNPRO_TABLE_CONTROL_2.

13 REPLIES 13

Former Member
0 Kudos

Hi Dev,

You have to use the your_table_control_name-current_line attribute to find which row button was pressed and write code according to it. This way you can restrict the processing only to the intended row.

Regards,

Karthik D

0 Kudos

hi,

the problem with current_line is that it shows that which current line is being processed in the loop at the moment . How will i come to know that button of line 2 was pressed???

0 Kudos

Hi Dev,

I overlooked your question, sorry for misleading.

Actually you have to use GET CURSOR LINE statement in your PAI to know the line on which the button is pressed.

Try as below inside PAI;

GET CURSOR LINE lv_line.

Now you can process further using the lv_line which would have the row number.

Regards,

Karthik D

0 Kudos

i will try it out on monday. not at work dude.. thanks

Former Member
0 Kudos

Hi,

Have u checked the program DEMO_DYNPRO_TABLE_CONTROL_2.

0 Kudos

That prog gives the top line and the number of lines there in that table. i want to know which push button on line was clicked.

0 Kudos

Pls refer this link, its already answered,

http://scn.sap.com/thread/1165270

or

Set Function code for buttons. 

While debugging mode whenever button pressed, you will have the function code with line number of the table row selected.

Here you can write your code

0 Kudos

Hi,

write one new module say "select_row" in PAI loop..endloop.

loop.

.

.

module select_row.

endloop.

In abap editor.

Data:sel type char1.

module select_row input.

IF sy-ucomm = <your f.code>.

endif.

endmodule.                 " select_row  INPUT

0 Kudos

But that starts the loop from all the rows.

for now i am using w/sel col but thats a temp soln. i want to know how to use push buttons in table control. I willl keep u updated if i get anything.. thanks for the help btw guys

0 Kudos

Ah! I found this thead interesting so I excursed a bit.

Below is my finding.

You need to use the combination of GET CURSOR LINE and table_control-top_line. The below screen tells you the story. I scrolled my table control down so that the top line displayed in  my TC is the 7th line. Then i pressed push button on the 3rd line. Which infact was the 9th line of my internal table.

In user command you get these values.

The line of your interest is tc-top_line + l_v_index - 1.

Rest is your own logic . Do let me know. I would be interested in knowing if it really works.

0 Kudos

i will try it out on monday as i am not in office today. surely will let you know.

Thank you

0 Kudos

THank you,,,,,

Former Member
0 Kudos

Hi  Dev,

  Did you  want to fetch the values from the database table and put into the second column of the table, when you clicking the push button,  This process will do dynamically .

Is it your requirement.