2010 Dec 27 12:38 PM
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
2010 Dec 27 1:42 PM
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
2010 Dec 27 12:43 PM
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
2010 Dec 27 12:50 PM
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
2010 Dec 27 1:42 PM
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
2010 Dec 29 1:20 PM
Thanks prabhu & Max.
My problem has been solved with your solution.
Regards,
viswa
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |