the query that is present in the custom program is
SELECT a~vbeln posnr matnr werks INTO TABLE gi_vbrp
FROM vbrk AS a INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln
FOR ALL ENTRIES IN gi_valuetab
WHERE a~fkdat BETWEEN p_vdat AND p_bdat
AND a~fkart IN li_fkart
AND b~matnr EQ gi_valuetab-matnr
AND b~werks = p_werks.
all the selected data is from vbrp table but the conditons are on vbrk table.
i have tried to use VRPMA table but that does not contain the field WERKS.
Please suggest any alternatives. For all entiries is fetching huge amount of data so that is even slower than the innerjoin.