Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Inclusion of MANDT in the SQL statement

Hi,

My apologies if this is the incorrect forum to post this question in. Please feel free to direct me towards the correct one if needed. I am not an ABAP(er), so please bear with me.

My question is as follows-

What decides the inclusion of Mandt in the Where clause of the SQL Statement even if it is not specified in the ABAP code ? My problem is that MANDT makes the index very unselective.

Here is an example

ABAP Code :

Open cursor with hold wa_dbcur for

SELECT matnr bwkey lbkum salk3 verpr vksal BKLAS

FROM mbew

WHERE matnr in smatnr

AND bwkey in sbwkey

AND LBKUM ne 0.

do.

fetch next cursor wa_dbcur into corresponding fields of table it_collect

package size 10000.

if sy-subrc <> 0.

exit.

endif.

SQL statement :

SELECT

"MATNR" , "BWKEY" , "LBKUM" , "SALK3" , "VERPR" , "VKSAL" , "BKLAS"

FROM

"MBEW"

WHERE

"MANDT" = :A0 AND "MATNR" BETWEEN :A1 AND :A2 AND "BWKEY" BETWEEN :A3 AND :A4 AND "LBKUM" <> :A5

Also, is there a way to avoid this ? If there isn't a way to avoid this, what would be a workaround.

Thank you everyone in advance.

Kunal

Former Member
Not what you were looking for? View more on this topic or Ask a question