I was under the impression that, while getting data from database table 'for all entries' always imporves performance. Since we are not getting whole database table data. I was doing a select statement and I have used for all entries. I have only 20,000 records in the internal table. While selecting data from database table, it took more than one hour and timed out.
Latter, I hard coded some values and query worked and it just took few minutes.
So, do we need to avoid for all entries? What the best practice?
For more details Please check the code:
Source package has only 20,000 records and while getting data it timed out. So I commented for all entries and hardcoded the values. This time it took only few minutes. Can any one suggest the best practice for handling such things?
IF SOURCE_PACKAGE[] IS NOT INITIAL.
SELECT
CALMONTH
CALYEAR
COMPANY
/BIC/XPROF_CTR
PCOMPANY
/BIC/ZPRODASGN
/BIC/ZSLSRPTCD
CURKEY_TC
UNIT
GL_ACCOUNT
MATERIAL
FUNC_AREA
COSTCENTER
WBS_ELEMT
CURKEY_LC
/BIC/ZTEMPKEY
QUANTITY
/BIC/ZAMT_REP
/BIC/ZSALETYP
FROM
/BIC/AZGMROA1400
INTO TABLE IT_SOURCE_TMP
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE
CALMONTH BETWEEN CMONTH1 AND CMONTH2 AND
CALYEAR = CURR_YEAR AND
COMPANY = SOURCE_PACKAGE-COMPANY AND
/BIC/XPROF_CTR = SOURCE_PACKAGE-/BIC/XPROF_CTR AND
PCOMPANY = SOURCE_PACKAGE-PCOMPANY AND
/BIC/ZPRODASGN = SOURCE_PACKAGE-/BIC/ZPRODASGN AND
/BIC/ZSLSRPTCD = SOURCE_PACKAGE-/BIC/ZSLSRPTCD AND
CURKEY_TC = SOURCE_PACKAGE-CURKEY_TC AND
UNIT = SOURCE_PACKAGE-UNIT AND
GL_ACCOUNT = SOURCE_PACKAGE-GL_ACCOUNT AND
MATERIAL = SOURCE_PACKAGE-MATERIAL AND
/BIC/ZSALETYP in ('TS', 'CG', 'IS', 'IC',
'TO', 'FG', 'OD', 'SS',
'RD', 'I3', 'D1', 'D2',
'D3', 'MS', 'PF', 'RA') .
FUNC_AREA = SOURCE_PACKAGE-FUNC_AREA AND
COSTCENTER = SOURCE_PACKAGE-COSTCENTER AND
WBS_ELEMT = SOURCE_PACKAGE-WBS_ELEMT AND
CURKEY_LC = SOURCE_PACKAGE-CURKEY_LC and
/BIC/ZACCOUNT = SOURCE_PACKAGE-/BIC/ZACCOUNT .
ENDIF.