sitemap
SapMaterial.com
Improve performance of SELECT

This tip has been copied from SearchSap.com
Tip submitted by: Ben Meijs

As you all know, it is important to use as many key fields as possible in WHERE clauses of SELECT
statements. Sometimes you are not sure about the value of some key
fields. They seem to be empty (Initial value) but you are afraid to use this in your ABAP coding.

Using the option GE (greater equal) in your coding can improve your performance considerably
without the risk of table lines not being selected.



Code


REPORT ZZBM_SELECT_1 .
TABLES: S001.
CONSTANTS: SSOUR_INI  LIKE S001-SSOUR VALUE   IS INITIAL,
VRSIO_INI  LIKE S001-VRSIO VALUE   IS INITIAL,
SPMON_INI  LIKE S001-SPMON VALUE   IS INITIAL,

SPTAG_INI  LIKE S001-SPTAG VALUE   IS INITIAL,
SPWOC_INI  LIKE S001-SPWOC VALUE   IS INITIAL,
SPBUP_INI  LIKE S001-SPBUP VALUE   IS INITIAL.


DATA: TA_S001 TYPE STANDARD TABLE OF S001.
DATA: WA_S001 TYPE S001.

SELECT-OPTIONS:
SO_SPTAG   FOR S001-SPTAG OBLIGATORY,
SO_KUNNR   FOR S001-KUNNR OBLIGATORY,
SO_VKORG   FOR S001-VKORG OBLIGATORY,
SO_VTWEG   FOR S001-VTWEG OBLIGATORY,
SO_SPART   FOR S001-SPART OBLIGATORY,
SO_MATNR   FOR S001-MATNR OBLIGATORY.

START-OF-SELECTION.

SELECT        * FROM  S001

INTO TABLE TA_S001
WHERE  SSOUR  GE SSOUR_INI     "Greater Equal initial value
AND    VRSIO  GE VRSIO_INI     "   idem
AND    SPMON  GE SPMON_INI     "   idem
AND    SPTAG  IN SO_SPTAG
AND    SPWOC  GE SPWOC_INI     "   idem
AND    SPBUP  GE SPBUP_INI     "   idem
AND    KUNNR  IN SO_KUNNR
AND    VKORG  IN SO_VKORG
AND    VTWEG  IN SO_VTWEG
AND    SPART  IN SO_SPART
AND    MATNR  IN SO_MATNR.
All of the  product names here are trademarks of their respective companies.  The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity.  Information used on this site is at your own risk.
ABAP TECHNICAL

SAP Introduction

sap abap faq

sap Tables

SAP Transaction codes

Internal tables

data dictionary

performance tuning

transports & Requests

Sap scripts

Smartforms

lsmw

reports

sap Workflow

module pool/ dialog
programming

table control

user exits

sap memory

abap memory

alv reports

ABAP ADVANCED

IDOC

ALE

BAPI

BADI

RFC


FUNCTIONAL SIDE

Materials Management

FICO

Human Resources

BIW / BW / SEM


Free Documentation
Abap Material

Ale Material

BAPI Material

BC Material

IDOC Material

R/3 Database Management

SAP material

RFC

Transport

Sales & Distribution Material

Basic Data and Function
Material

Basis (BC) Material

Billing Material

CA Material

CATT : Computer Aided Test
Tool

Capacity Evaluation and
leveling Material

Capacity Planning Material

Cross Application Material

Countries

Customer Service Material

Enterpise  Material

Financial / Controlling (FICO)

Internet Time Sheet

Inspection Material

HR Material

Material Management
Material

Payments Material

Payroll Material

Pension Fund

Production Planning and
Control

Plant Maintenance

Quality Management Material

Real Estate Material

SAP material

Wage Types