Here is the Main concept of eliminating the high percentage of identical selects by local buffer.
types: begin of s_bseg,
bukrs like bseg-bukrs,
gjahr like bseg-gjahr,
belnr like bseg-belnr,
buzei like bseg-buzei,
wskto like bseg-wskto,
shkzg like bseg-shkzg,
end of s_bseg.
data: itb_bseg_found type sorted table of s_bseg with non-unique key bukrs gjahr belnr buzei,
itb_bseg_notfound type sorted table of s_bseg with non-unique key bukrs gjahr belnr buzeiwa_bseg s_bseg.
Read table itb_bseg_found into wa_bseg with key
bukrs = bsas-bukrs
gjahr = bsas-gjahr
belnr = bsas-belnr
buzei = bsas-buzei.
if sy-subrc = 0.
bseg-wskto = wa_bseg-wskto.
bseg-shkzg = wa_bseg-shkzg.
else.
Read table itb_bseg_notfound transporting no fields with key
bukrs = bsas-bukrs
gjahr = bsas-gjahr
belnr = bsas-belnr
buzei = bsas-buzei.
if sy-subrc <> 0.
SELECT SINGLE wskto shkzg
FROM bseg
INTO (bseg-wskto, bseg-shkzg)
WHERE bukrs = bsas-bukrs AND
gjahr = bsas-gjahr AND
belnr = bsas-belnr AND
buzei = bsas-buzei.
wa_bseg-bukrs = bsas-bukrs.
wa_bseg-gjahr = bsas-gjahr.
wa_bseg-belnr = bsas-belnr.
wa_bseg-buzei = bsas-buzei.
wa_bseg-wskto = bseg-wskto.
wa_bseg-shkzg = bseg-shkzg.
if sy-subrc = 0.
insert wa_bseg into table itb_bseg_found.
else.
insert wa_bseg into table itb_bseg_notfound.
endif.
endif.
endif.
Note: Change the data type of internal tables itb_bseg_found and itb_bseg_notfound to statistics if this is
called in the funcational module or form.
Welcome to comment on this topic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 |