ABAP – SELECT vs. SELECT INTO CORRESPONDING FIELDS OF TABLE

Home / SAP / ABAP Coding / ABAP – SELECT vs. SELECT INTO CORRESPONDING FIELDS OF TABLE

Well, it turns out my new system is teaching me all sorts of things lately.  Today, I learned the value of how to code the select statement.  In my old ERP 6.0 SR3 system, I built a small program to make notifications in my system.  I use it to generate master data to test my dashboard.  Well, the statement worked just fine so I didn’t think anything of it.

Select equnr from VIQMEL into lv_equnrfor all entries in lt_equip
where equnr = lt_equip-equnr and

kzloesch = ” and
owner = ‘4’.
… do something here.
Endselect.

The statement seemed harmless enough…  until I went to load this into my new EHP4 system.  It has the upgraded kernel, latest support packs, blah blah blah.  It suddenly when a minute, to hours to execute this same piece of code.  I still don’t know exactly what changed…  but sure as hell, my code changed 🙂

I moved to:

select equnr from viqmel into corresponding fields of table lt_qmelwhere equnr = lt_equip-equnr and
kzloesch = ” and
owner = ‘4’.
loop at lt_equip into wa_equip.
read table lt_qmel into wa_qmel with key equnr = wa_equip-equnr.
if sy-subrc = 0.
… do something…
endif.
endloop.

this dropped it make into the less than a minute to read the new code.  wow.  I don’t know what caused the issue, maybe it was 7.01 vs. 7.00, but the same table read in a slightly different way made a huge difference in this program.
Thanks for reading,

As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,
Mike

Leave a Reply

Your email address will not be published. Required fields are marked *