Using Alias Tables in SAP Queries

When working with SAP queries, sometimes you need alias tables when you work with reports that cover a sequence of events, such as with sales document flow.  

Table VBFA allows for a single predecessor/successor relationship, such as with Sales Order and Delivery.  But you run into problems when you try to include another posting in the flow, such as the billing document.  

So you create an alias table to handle that.

Tcode SQ02, infoset – copy standard table VBFA to a 2nd document flow table, e.g. VBFA2:

SAP Table Help

Then you define the table joins, with the Sales Order/Delivery mapped to the first document flow table, and the Delivery/Billing document mapped to the alias table, e.g. VBFA2

SAP Table Tips

Assign fields/field groups to each table as needed.  

SAP Queries

In this example, this allows for an SAP query that links Sales Orders with their Deliveries, Billing documents, etc.  

Additional alias tables can be created in case of the need for reporting on more predecessor/successor relationships (quotation/sales order, delivery/shipping document, etc.)

SAP Queries Help