I'm working on a trans.routine wich should select the enddate of the last absence from the active table of a DSO. The routine I have now:
SELECT SINGLE gm_vld_to FROM /bic/azds_afwz00 INTO RESULT
WHERE employee EQ SOURCE_FIELDS-pernr
AND /bic/zchaaso EQ '0200'
AND /bic/zchmudn NE SOURCE_FIELDS-docnr.
However, the date selected should be the highest value in the DSO, but lower than the 'gm_vld_to' in the record that is being loaded. For instance if I have two records in the DSO, one with gm_vld_to = 21.03.2008 and one with gm_vld_to = 22.05.2008 and the record that is loaded has gm_vld_to = 19.04.2008, the value should be: 21.03.2008.
Does anyone have an idea how to code this?