05-11-2012 7:11 AM
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.
05-11-2012 7:19 AM
05-11-2012 7:16 AM
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
05-11-2012 7:19 AM
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???
05-11-2012 7:50 AM
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
05-11-2012 12:36 PM
05-11-2012 7:19 AM
05-11-2012 7:22 AM
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.
05-11-2012 7:40 AM
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
05-11-2012 7:41 AM
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
05-11-2012 8:55 AM
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
05-11-2012 10:56 AM
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.
05-11-2012 12:32 PM
i will try it out on monday as i am not in office today. surely will let you know.
Thank you
05-19-2012 7:28 AM
05-17-2012 10:02 AM
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.