Hi Larry,
If you want to validate only s_vbeln then, under event At Selection-screen on s_vbeln you should keep only part of code which is validating the sales order number under the event At Selection-screen on s_vbeln.
In your code both sales order validation and purchase order validation are happening under the same event AT SELECTION-SCREEN ON S_VBELN.
You can write something like this
AT SELECTION-SCREEN ON S_EBELN.
SELECT SINGLE EBELN FROM EKKO INTO V_EBELN WHERE EBELN IN S_EBELN.
IF SY-SUBRC <> 0.
MESSAGE 'PO DOES NOT EXIST' TYPE 'I'.
ELSE.
MESSAGE 'PO EXISTS' TYPE 'I'.
ENDIF.
AT SELECTION-SCREEN ON S_VBELN.
SELECT SINGLE VBELN FROM VBAK INTO V_VBELN WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE 'SALES ORDER DOES NOT EXIST' TYPE 'I'.
ELSE.
MESSAGE 'SALES ORDER EXISTS' TYPE 'I'.
ENDIF.
coming to the differences between At selection-screen' and 'At selection-screen on <field>...
Please check the below link
Selection Screen Events in ABAP - ABAP Development - SCN Wiki
Rewrad if helpful.
Regards,
Vasu Gunuputi.