2011 Dec 28 10:19 AM
Hello Gurus,
On a main screen , I have created one Tabstrips with two Tabs. Tab1 contains 2 Table controls. Each table control has its own Buttons. I have given functionality of deleting table control records by button delete. (Single row record)
For this, I have to catch the cursor position by using GET CURSOR LINE. But this is not replying any value. it always gives 0 value.
Please suggest me the correct path for doing this.
Thanks
Arpit Chelawat
I have to write this code in PAI of main screen, since subscreen doesn't have OK_CODE.
2011 Dec 28 10:28 AM
The best way is to add a selection column and proceed ahead. Using cursor wont give the user to delete multiplelines at one go
Nabheet
Hello Gurus,
On a main screen , I have created one Tabstrips with two Tabs. Tab1 contains 2 Table controls. Each table control has its own Buttons. I have given functionality of deleting table control records by button delete. (Single row record)
For this, I have to catch the cursor position by using GET CURSOR LINE. But this is not replying any value. it always gives 0 value.
Please suggest me the correct path for doing this.
Thanks
Arpit Chelawat
I have to write this code in PAI of main screen, since subscreen doesn't have OK_CODE.
2011 Dec 28 10:26 AM
One more thing, I have not used 'sel' field for row selection in table control. The only way to get row is GET CURSON LINE.
Please help me.
2011 Dec 28 10:33 AM
Hi Arpit,
GET CURSOR LINE work only with classical report not with module pool/Dialog program. In you program can not used the get cursor line for read table control line. You have to check which is active tab and according act in your program.
Kind Rgds
Ravi Lanjewar
2011 Dec 28 10:42 AM
Thanks Ravi.
I have to first check the active Tab and get the correct one. But will you help me how can I check active Tab. I know, it's silly question but getting frustrated with it. Please help.
2011 Dec 28 10:44 AM
Check what ok code is present in tab_strip-activetab you will come to know or through gv_dynnr screen number which you have set in your code.
Nabehet
2011 Dec 28 1:34 PM
Hi,
@Ravi Lanjewar,
GET CURSOR LINE work only with classical report not with module pool/Dialog program.
This is not true. GET CURSOR LINE works great in MP... Please have a look to F1 doc...
@OP,
Just use the GET CURSOR LINE within your LOOP/ENDLOOP in PAI.
Also, no need to handle any fcode in gui status for this...
cheers,
m.
2011 Dec 29 4:49 AM
Hai Manu D'Haeyer,
Get cursor is also works in module pool . If you want i will send the document.
2011 Dec 29 6:14 AM
Hello Gurus,
Yes, its True.We can use GET CURSOR LINE in MP and I am using it also. But the problem is that it is returning 0 as output and sy-subrc value '4'. I checked in F1 doc,sy-subrc value 4 means 'cursor is outside a table control or a step loop'. I think because of TABSTRIP, the cursor position is not recognizing by GET CURSOR LINE. I have also checked the active TAB. It is correct one.
Please help me.
Arpit
2011 Dec 29 7:54 AM
Arpit,
So you confirm your GET CURSOR is made inside the LOOP on TC?
Kr,
Manu.
2011 Dec 29 9:27 AM
2011 Dec 29 9:33 AM
It should in loop endloop of table control in PAI which i guess is on a subscreen.
Nabheet
2011 Dec 29 9:46 AM
It is in the PAI of Main screen.
Within the LOOP/ENDLOOP? (why is it so difficult to answer this small question? )
Otherwise it will definitely not work!
2011 Dec 29 9:55 AM
Hai Arpit,
Get cursor not returns any value until the field in table control has set to RESPONDS TO DOUBLE CLICK. After that goto pf-status of the screen i.e table control screen. Double click on pf-status, in function keys you have recommended function key settings . In that there is F2 , there you have to create a fct code. THen you write your logic .
2011 Dec 29 10:08 AM
Get cursor not returns any value until the field in table control has set to RESPONDS TO DOUBLE CLICK
nope...;)
Here the OP wants to know which line is to be deleted when pressing a button DELETE.... So, no need to change gui status, he will just need a fcode for the DELETE function... and put the GET CURSOR inside the LOOP/ENDLOOP in PAI....
cheers,
m.
2012 Jan 03 1:40 PM
Hello,
Problem has been resolved.
Since, subscreen doesn't contain OK_CODE, so I had write my User_command in PAI of main screen. This was my mistake. I have put my USER_COMMAND in PAI of subscreen then it works. Thank you all.
Rewarded points.
Arpit
2011 Dec 28 10:28 AM
The best way is to add a selection column and proceed ahead. Using cursor wont give the user to delete multiplelines at one go
Nabheet
2011 Dec 28 10:33 AM
Thanks! Nabheet.
But client don't want selection column. He wants that on the basis of cursor position, rows should be deleted.
2011 Dec 28 10:34 AM
2011 Dec 28 10:38 AM
Yes Nabheet. He wants to delete record one by one based on the Cursor position.
I have seen some codes and written my code accordingly but somehow, not getting any reply from GET CURSOR LINE.
2011 Dec 28 10:41 AM
I just tried the same in my code
GET CURSOR LINE
It has to be used in LOOP endloop make sure that. based on it you can proceed further
Nabheet
2011 Dec 28 12:27 PM
Hai Aprit,
We can use GET CURSOR in module pool also.
first of all goto layout and double click on the table control field and check the attribute RESPONDS TO Double CLICK there and goto pf-status of table control screen . Double click on pf-status, there you find out F2 there you have to maintain FCTCODE for that and write your logic like this in PAI.
data : ws_field(30),
val type c.
if sy-ucomm = 'FCTCODE'.
get cursor field ws_field value val.
// write your code
endif.
2012 Jan 03 1:42 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |