Identifying "Sales Invoice Header" was created form Order Document or from Invoice Document

Can we use “Order No.” from “Sales Invoice Header” table to identify if Invoice is created from Order Document or from Invoice Document?

If “Sales Invoice Header”.“Order No.” = ‘’ THEN

MESSAGE(‘Created form INVOICE Document’)

Else If “Sales Invoice Header”.“Order No.” <> ‘’ THEN

MESSAGE(‘Created form ORDER Document’);

If Not what to use to identify this.

Hi,
Yes that is True, Order No. is only get filled when you invoice from Sales Order.