BW Query is stored as component(reusable element) in database table RSZCOMPDIR. To delete it, you need to search for query’s component UID (COMPUID) for existing query’s technical name saved in COMPID field.
DATA: lv_compuid TYPE sysuuid_25,
lv_subrc TYPE sysubrc.
CALL FUNCTION ‘RSZ_X_COMPONENT_DELETE’
EXPORTING
i_compuid = lv_compuid “hashed UID
i_delete_variables = rs_c_false “delete all related variables
IMPORTING
e_subrc = lv_subrc.