Get current line of TableControl within BAdI
I have implemented BAdI BADI_MAT_F_SPEC_SEL to disable field input of field 'MG03STEUER-TAXKM' on screen Sales Org. Data 1, table Tax Data. The field should be enabled or disabled based on the field value. I can retrieve the tables values via function module MLAN_GET_BILD but I also need the current line of the table to determine correct field value.
I tried to determine the index with the system fields SY-STEPL and SY-LOOPC but it does not work. I always get the same indices regardless of table scroll position:
lv_index = sy-loopc + sy-stepl - 1.
The TableControl I want to read is TC_STEUERN and it is contained in program name SAPLMGD1, screen number 2184. The scructure of the TabelControl has the current line index, but I can only access it via dynamic field assignment:
if fauswtab-fname = 'MG03STEUER-TAXKM'.
check sy-loopc > 0.
* get index of current table row
assign ('(SAPLMGD1)TC_STEUERN-CURRENT_LINE') to <fv_index>.
check sy-subrc = 0.
Is there an official 'clean' way to determine the current line index of a TableControl within a BAdI or an Exit?