When a Crystal Report behaves like that it means that there is some logic that cannot be done on the DB server, so it must be done locally. Usually this is caused by using a CR function in the record selection formula that doesn't translate into the DB's language.
In this case, I believe it is when the parameters are null that is causing it (For example, the statement {E_ORD_H.COMP_CODE}=<null>
does not mean that CR will be able to anticipate this situation and substitute {E_ORD_H.COMP_CODE} is null
in its place in the subreport's query. Instead, you need to explicitly check for those null-valued parameters:
not(isnull({?Pm-E_ORD_H.COMP_CODE}))
and {E_ORD_H.COMP_CODE} = {?Pm-E_ORD_H.COMP_CODE}
and not(isnull({?Pm-E_ORD_H.CUST_CODE}))
and {E_ORD_H.CUST_CODE} = {?Pm-E_ORD_H.CUST_CODE}
and not(isnull({?Pm-E_ORD_H.ORD_NUM}))
and {E_ORD_H.ORD_NUM} = {?Pm-E_ORD_H.ORD_NUM}