on 01-15-2014 5:33 AM
Can one help me how to resolve performance issue for below code
if it_vart04_art[] IS NOT INITIAL.
SELECT DISTINCT * FROM makt INTO TABLE p_it_xmaktx
FOR ALL ENTRIES IN it_vart04_art
WHERE matnr = it_vart04_art-matnr
AND spras = sy-langu.
SORT p_it_xmaktx BY matnr.
ENDIF.
Thanks in advance
Regards
Tabrez
Hi Tabrez,
When you do select distinct, internally it has to sort the entries in the database. Instead you can pull all the record and then sort and delete adjacent duplicated comparing all fields.
But in your case even this is not required. Since you are fetching record from MAKT where the primary key is MATNR and SPRAS and you are passing both the key values, the result will be distinct. Hence it is enough to fetch using select * for all entries in the internal table passing both matnr and spras.
IF it_vart04_art[] IS NOT INITIAL.
SELECT * FROM makt INTO TABLE p_it_xmaktx
FOR ALL ENTRIES IN it_vart04_art
WHERE matnr = it_vart04_art-matnr
AND spras = sy-langu.
SORT p_it_xmaktx BY matnr.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tabrez,
what problem you are facing in the point of performance? Please try this code.
if it_vart04 _art[] IS NOT INITIAL.
loop at it_vart04_art.
SELECT DISTINCT * FROM makt INTO TABLE p_it_xmaktx
FOR ALL ENTRIES IN it_vart04_art
WHERE matnr = it_vart04_art-matnr
AND spras = sy-langu.
endloop.
SORT p_it_xmaktx BY matnr.
ENDIF.
Regards,
Jaheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.