Try the following code in the include ZXWOCU07 of user-Exit IWO10009. (You will arrive here through Tcode SMOD. Take help of your ABAP friend).
DATA: V_AUFNR TYPE AUFNR, V_AUART TYPE AUART. CLEAR: V_AUFNR, V_AUART. SELECT SINGLE AUFNR FROM AFIH INTO V_AUFNR WHERE ( IPHAS = '0' OR IPHAS = '2' ) AND EQUNR = CAUFVD_IMP-EQUNR. SELECT SINGLE AUART FROM AUFK INTO V_AUART WHERE AUFNR = V_AUFNR. IF V_AUFNR IS NOT INITIAL AND V_AUFNR <> CAUFVD_IMP-AUFNR AND CAUFVD_IMP-IPHAS <> '3'. IF ( CAUFVD_IMP-AUART = 'ZM02' OR CAUFVD_IMP-AUART = 'ZM03' ). MESSAGE 'One or more Orders are open on this Equipment' TYPE 'E' DISPLAY LIKE 'I '. ENDIF. ENDIF.
After implementing this code you would get the following error
when you try to create a ZM02 or ZM03 types Orders (you change these order types in code as per yours), if already any Order of these types is pending (CRTD or REL status) on this particular Equipment.
Test well with the help of your ABAPer in DEV220 or DEV100 for all combinations of creating Orders. You need to test well for any undesirable creation of Orders and undesirable trigger of this error pop-up. You have to take help of ABAPer
Best of luck
KJogeswaraRao