Module pool-Position button
I have tried to create position button in module pool like we have in NACE, wherein user doesnt have to scroll all the way into the Table COntrol to search for an entry. On the basis of the primary key which is Plant & Date he is able to go to that record.
But i have a small problem here.
The code i have written is:
MODULE position OUTPUT.
IF flag = 1.
DATA: f(25) TYPE c.
f = 'ITAB_PRODC-PLANT'.
tabctrl-v_scroll = 'X'.
tabctrl-current_line = tab.
SET CURSOR FIELD f LINE tab OFFSET 0.
SET PF-STATUS 'ZCHNGENTRY'.
This works, but it takes me only to the entry which is visible in the table control. In case if I search for an entry for which we have to scroll down, 'SET CURSOR' doesnt auto-scroll into the table control and take me to that entry.
Thanx in advance,
Nagarajan Ramamoorthy replied
Table Control can set its cursor only on the records currently displayed and can not set for other records.
Instead of doing like this, you can do as follows :
1. Sort the table according to your search fields i.e. Plant & Date
2. Search this table for given values using 'FIND IN TABLE' statement and get the least record number.
3. Assign that number to table control's TOP_LINE field. This step should be done in PBO and after 'LOOP...ENDLOOP' statement.