I am making some HR reports in which I am pulling up position long text from hrp1001 by giving condition - where plavr = '01' . Now if the active plan version is not 01, my condition becomes vague.
Please let me know how to determine the active plan version dynamically in my sample code below
SELECT APERNR AOTYPE B~STEXT INTO CORRESPONDING FIELDS OF TABLE ITAB_EMP_DEATILS3 FROM PA0001 AS A
INNER JOIN HRP1000 AS B ON BOTYPE = AOTYPE AND BOBJID = APLANS WHERE ( BOTYPE = 'S' AND BPLVAR = '01' AND AENDDA = '99991231' AND BENDDA = '99991231') AND A~PERNR IN PNPPERNR.
SORT ITAB_EMP_DEATILS3 BY PERNR.
DELETE ADJACENT DUPLICATES FROM ITAB_EMP_DEATILS3.