As you all know, it is important to use as many key fields as possible in WHERE clauses of SELECT statements. Sometimes...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
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.
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.
Dig Deeper on SAP Basis administration and NetWeaver administration