Hello,
as Gopi said standard rule condition function is not available for this.
You need to find out which parameter is used in /n/SAPTRX/AFPD for the alert recipient.
Then create a rule condition function and check
If param_value is initial return code 4 else return code 0.
In the rule set you insert this condition before the alert activity and check the return code.
To read out EH data you can use
ls_ehdata TYPE /saptrx/eh_data,
ls_tables TYPE /saptrx/eh_access_flags,
CALL METHOD i_eai-eh_model->eh_data
EXPORTING
i_tables = ls_tables
RECEIVING
eh_data = ls_ehdata.
in the rule condition function.
Best regards,
Steffen