If you are on the first record in the data, there is no "previous" record. So if you just have
If ({ICITEM.ITEMNO}<>previous({ICITEM.ITEMNO}) and {OESHDT.TRANNUM}<>previous({OESHDT.TRANNUM}) then
the call to "previous" will return a null. When you compare anything to null in Crystal, or in a database, the value is null, not the false that you would expect. Null is neither true nor false, so it would skip adding the value from your first record. (See my blog post for more info on null handling: What is Null and Why is it Important for Crystal Reports | SAP BI BLOG). So, we use Crystal's "OnFirstRecord" like this:
If OnFirstRecord or ({ICITEM.ITEMNO}<>previous({ICITEM.ITEMNO}) and {OESHDT.TRANNUM}<>previous({OESHDT.TRANNUM}) then
The way that Crystal (and most databases) handle "Or" statements, is they only process through until they hit the first "true" value and ignore the rest of the statement. So, in this case, on the first record it will stop when OnFirstRecord returns "true" and add the value of the first record.
-Dell