‎2007 May 21 11:28 AM
hi iam using a select command in which iam selecting from besg table . but the problem is that around 4000 record are getting selected so it takes a lot of time to execute as well as it is giving a time out error for another object that is also using the same exit. can u plss suggest me how to overcome this problem?
MY SAMPLE CODE:
SELECT hkont
FROM bseg
INTO
TABLE gi_cstctr
WHERE
kostl = bseg-kostl AND prctr = bseg-prctr.
IF sy-subrc EQ 0. "if rows are returned
SORT gi_cstctr BY hkont. "sorting the internal table.
ENDIF.
*if cost centers are there in the internal table then loop the internal table into corresponding work area and if the G/L account matches any costcenter in the table
CLEAR gw_cstctr.
IF NOT gi_cstctr[] IS INITIAL.
LOOP AT gi_cstctr INTO gw_cstctr.
IF gw_cstctr-hkont EQ lv_hkont.
lv_flag = gc_x. "set the flag to x
EXIT.
ENDIF.
CLEAR gw_cstctr.
ENDLOOP.
ENDIF.
IF lv_flag = space. "if the flag is not set
MESSAGE s031(yd01) WITH lv_hkont gw_cstctr-kostl . "display the message
ENDIF.
‎2007 May 21 11:55 AM
hi,
try to hit the table BSEG by primary keys or else secondary indexes..
It will grow up ur rperformance
rewards if useful
regards,
nazeer
‎2007 May 21 12:17 PM
YOur select query seems to be really bad as far as performance is concerned. Firs of all , until and unless required, you should never select data from a DB table without use of primary keys as selection criteria. Make sure your selection criteria is complete and as specific as possible...
You have written in where clause " kostl = bseg-kostl AND prctr = bseg-prctr.
"..what does this mean?? you are comparing 'kostl' value with bseg-kostl value? that doesnt make sense.check your selection criteria again.
Revert if you have any issues.
Pls pls mark helpful answers.
Cheers,
Karan