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

'Get Cursor Line' not replying any value

Former Member
0 Likes
3,690

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.

1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
3,299

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.

21 REPLIES 21
Read only

Former Member
0 Likes
3,299

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.

Read only

0 Likes
3,299

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

Read only

0 Likes
3,299

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.

Read only

0 Likes
3,299

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

Read only

0 Likes
3,299

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.

Read only

0 Likes
3,299

Hai Manu D'Haeyer,

Get cursor is also works in module pool . If you want i will send the document.

Read only

0 Likes
3,299

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

Read only

0 Likes
3,299

Arpit,

So you confirm your GET CURSOR is made inside the LOOP on TC?

Kr,

Manu.

Read only

0 Likes
3,299

It is in the PAI of Main screen.

Arpit

Read only

0 Likes
3,299

It should in loop endloop of table control in PAI which i guess is on a subscreen.

Nabheet

Read only

0 Likes
3,299

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!

Read only

0 Likes
3,299

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 .

Read only

0 Likes
3,299

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.

Read only

0 Likes
3,299

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

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
3,300

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

Read only

0 Likes
3,299

Thanks! Nabheet.

But client don't want selection column. He wants that on the basis of cursor position, rows should be deleted.

Read only

0 Likes
3,299

Is it like he will delete it one by one?

Nabheet

Read only

0 Likes
3,299

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.

Read only

0 Likes
3,299

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

Read only

Former Member
0 Likes
3,299

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.

Read only

Former Member
0 Likes
3,299

Successfully done.

Reason mentioned in my last comment.