Simply put 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. CLEAR: V_AUFNR. SELECT SINGLE AUFNR FROM AFIH INTO V_AUFNR WHERE ( IPHAS = '0' OR IPHAS = '2' ) AND EQUNR = CAUFVD_IMP-EQUNR. 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
Image may be NSFW.
Clik here to view.
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. Though I have tested it, you also test it for any undesirable trigger of this error pop-up.
Best of luck
KJogeswaraRao