SAP ABAP Program Performance Optimization 2

xiaoxiao2021-03-06  21

The following is some of the previously seen something about SAP ABAP program performance optimization As You All Know, IT 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.About WHERE 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 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 gespbup_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.about delete code: * --- d01k919273 begin delete

* --- Delete Deliveries Not to Be Processed

* loop at TH_VBUK.

* Delete TH_VLPMA WHERE VBELN EQ TH_VBUK-VBELN.

* endloop. "TH_VBUK.

* --- D01k919273 End delete

* --- Begin Add d01k919273

LOOP AT TH_VLPMA INTO TH_VLPMATMP.

Read Table TH_VBUK with Key Vbeln = TH_VLPMATMP-VBELN

Binary Search.

Check SY-SUBRC NE 0.

Append TH_VLPMATMP.

Endloop.

* --- End add d01k919273

转载请注明原文地址:https://www.9cbs.com/read-42535.html

New Post(0)