10-16-2015 11:16 AM
Hi,
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.
* ...
* ...
endif.
Is there an official 'clean' way to determine the current line index of a TableControl within a BAdI or an Exit?
10-16-2015 12:21 PM
10-16-2015 12:25 PM
I have already tried this, but it returns 0 always. According to the FM documentation, this FM should be used during Process-On-Value request.
10-16-2015 12:52 PM
Hi,
The method of badi is called as many number of times as there are fields in the screen.
You can make use of this as you have the table data and already know which line to disable.
Create an instance attribute which will store the count of the times this method is called for the field TAXKM. Which means, if the table has 3 rows, then the method for that table field will be called 3 times with the fieldname in question.
So you will know from the count which is the row number for which the method is called.
You will also need another instance variable to act as a flag to know if the method for the screen is called for the first time so that the counting can be done properly.
Regards,
Ashish
10-16-2015 1:33 PM
Hi,
I don't think that this will work because the BAdI will be called for each visible line. In my case, the table has three lines and two of them are visible lines.
The BAdI for field TAXKM will be called three times with the following system field values:
So even if I count the number of calls of the BAdI, I still do not know which lines are visible because of the table scroll position.
10-16-2015 9:51 PM
10-19-2015 8:30 AM