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

Problem in setting the cursor in table control MPP

Former Member
0 Likes
909

Hi All,

I am giving find (ctrl+f) option in table control abap as follows..

if SY-ucomm eq 'FIND'.

clear:mline.

refresh tab.

tab-tabname = 'ZFID_COD_FOD'.

tab-fieldname = 'C_NOTE_NO'.

tab-value = ''.

append tab.

call function 'POPUP_GET_VALUES'

exporting

popup_title = 'FIND'

start_column = '1'

start_row = '1'

tables

fields = tab.

if sy-subrc <> 0.

endif.

loop at tab where value is not initial.

read table it_codfod into wa_codfod

with key c_note_no = tab-value.

if sy-subrc = 0.

mline = sy-tabix.

endif.

endloop.

endif.

Above code is working fine to get the position of the search field into mline(local field)..

set cursor field 'WA_CODFOD-C_NOTE_NO' line mline.

By using above code i am trying to place the cursor at specific line(mline).

Now my problem is if table control is like below

1

2

3

4

5

page up page down (buttons)

if i search bet'n 1-5 for ex 3 it's finding the position as 3 and placing the cursor at 3rd row correctly.

but if i search for 7 it's finding the position as 7 and it's faling to place the cursor at 7th row.

please any body help me to solve above issue...

Thanks & regards,

Viswa

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
792

Hi

set cursor field 'WA_CODFOD-C_NOTE_NO' line mline.

The value of MLINE can be from 1 and N, where N is the number of the lines shown in the table control, so if your table control can display 5 line, MLINE will be from 1 to 5.

Now you need to create the link between the line of the table control and the line of internal table, the rule is:

Internal Table Line = <table control>-TOP_LINE + <table control line> - 1.

Max

Hi All,

I am giving find (ctrl+f) option in table control abap as follows..

if SY-ucomm eq 'FIND'.

clear:mline.

refresh tab.

tab-tabname = 'ZFID_COD_FOD'.

tab-fieldname = 'C_NOTE_NO'.

tab-value = ''.

append tab.

call function 'POPUP_GET_VALUES'

exporting

popup_title = 'FIND'

start_column = '1'

start_row = '1'

tables

fields = tab.

if sy-subrc <> 0.

endif.

loop at tab where value is not initial.

read table it_codfod into wa_codfod

with key c_note_no = tab-value.

if sy-subrc = 0.

mline = sy-tabix.

endif.

endloop.

endif.

Above code is working fine to get the position of the search field into mline(local field)..

set cursor field 'WA_CODFOD-C_NOTE_NO' line mline.

By using above code i am trying to place the cursor at specific line(mline).

Now my problem is if table control is like below

1

2

3

4

5

page up page down (buttons)

if i search bet'n 1-5 for ex 3 it's finding the position as 3 and placing the cursor at 3rd row correctly.

but if i search for 7 it's finding the position as 7 and it's faling to place the cursor at 7th row.

please any body help me to solve above issue...

Thanks & regards,

Viswa

4 REPLIES 4
Read only

Former Member
0 Likes
792

Hi,

always modify the Cursor by top line when you trying to use set cursur or get cursor.

  • getting the cursor line in Table Control

get cursor field selfield line selline.

selindex = tc_batch-top_line + selline - 1.

  • Setting the cursor line in Table Control

selindex = tc_batch-top_line + selline - 1.

set cursor field 'WA_CODFOD-C_NOTE_NO' line mline.

Prabhudas

Read only

0 Likes
792

Hi Prabhu,

Thankyou for your reply..

Please tell me how to include that in my program..

modify tbc_ctrl from wa.. "like this

Please correct me if i am wrong..

thanks & regards,

Viswa

Read only

Former Member
0 Likes
793

Hi

set cursor field 'WA_CODFOD-C_NOTE_NO' line mline.

The value of MLINE can be from 1 and N, where N is the number of the lines shown in the table control, so if your table control can display 5 line, MLINE will be from 1 to 5.

Now you need to create the link between the line of the table control and the line of internal table, the rule is:

Internal Table Line = <table control>-TOP_LINE + <table control line> - 1.

Max

Read only

0 Likes
792

Thanks prabhu & Max.

My problem has been solved with your solution.

Regards,

viswa