Open vs closed economy

Is it possible to have simply Imports and Exports as exogenous variables in the resource constraint with the exchange rate ? Such that,

Y = C + G + I + (erP)(X - M)

er being the exchange rate and P the exogenous price of foreign goods. The price of the generic good being 1.

Thank you