I need to write a DTP Filter ABAP Routine to select from the Infoobject 0Material all the materials starting with A*- B*. Could you please help me with the ABAP Code. I have tried several examples but still it doesn't work correctly. Maybe something is wrong in my code.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = '0MATERIAL'.
l_idx = sy-tabix.
Data: lv_mat_low type /bi0/oi0material VALUE 'A*',
lv_mat_high type /bi0/oi0material VALUE 'B*'.
l_t_range-sign = 'I'.
l_t_range-fieldname = '0MATERIAL'.
l_t_range-iobjnm = '0MATERIAL'.
l_t_range-option = 'BT'.
l_t_range-low = lv_mat_low.
l_t_range-high = lv_mat_high.
p_subrc = 0.
Also, when I add the routine, in the selection screen at DTP Filter, do I also need to add the field: From A* TO B*?
Sometimes, when I do not use the routine, but just selection through the DTP Filter, it gathers all the materials starting with A but not with B. Or sometimes the opposite. Is there any reason for this?
Any help is appreciated.