Local Fields in SAP Queries

When creating SAP query reports using Tcode SQ01, it’s sometimes necessary to create what is referred to as ‘Local Fields’.  These are fields you create that aren’t drawn from the transparent tables when maintaining the infoset.  So these fields are ‘local’ to the query you’re building.

A common reason for creating local fields is when you need to perform a calculation on a field.  One example is to get the ‘Per Unit’ price of an item that is normally purchased as a quantity greater than 1, such as a pack of batteries.   In SAP queries you can enter a formula for calculating the value, and you can also enter the conditions under which this formula would apply.

T-code SQ01 – Maintain SAP Query

From the initial query start screen, click ‘Change’ or ‘Create’ as needed after entering the query name according to your company’s naming conventions.

SAP Queries

Note that you can’t create a local field from the Edit menu until you have first gone to the ‘Field Selection’ option under the ‘Go To’ menu. 

SAP Tips and Tricks - Local Fields in SAP Queries

To enable the ‘Local Field’ functions, first access the Field Selection screen under the ‘Goto’ menu.

SAP Queries Tips

The fields contained in the tables selected for the query are displayed.

SAP Queries Help

Then go back to the ‘Edit’ menu to switch on the field short names.

SAP Queries Tip

Assign a name to any of the existing fields you may want to either reference in your new Local field, or for fields you may want to use in calculating a formula. 

SAP Local Fields

Next, go back to the ‘Edit’ menu, and the Local field functions will be activated:

SAP Local Fields Tips

Enter data on the new Local field as needed, including any formulas required:

Local Fields in SAP Queries

Once added and saved, the new local field will be displayed on the Layout Design screen of the SAP Query and can be flagged for selection, display, or both on the report. 

SAP Query