Hi there.
I've got a requirement of creating a query, fetching all discounts/rebates and values for customers and material, together with pricing group of customer.
I've created a base of the KNVV-table, where the key customer/sales org is selected, linked with KNA1, to have something to start with (getting pricing group) in SQ01.
Now table A005 is a pool/cluster, and I have to fetch this.
In SQ02, I added a structure ZA005 with this code:
data: l_kunnr type kna1-kunnr,
l_vkorg type knvv-vkorg.
clear l_kunnr.
clear l_vkorg.
select single kunnr vkorg from knvp
into (l_kunnr, l_vkorg)
where kunnr = knvv-kunnr
and vkorg = knvv-vkorg.
IF SY-SUBRC EQ 0.
select * into CORRESPONDING FIELDS OF za005
from a005
where kunnr = l_kunnr
and vkorg = l_vkorg.
endselect.
else. clear za005.
endif.
When I generate this infoset and run the query for a customer and sales org, I only get one result in the output, when I know theres about 10-15 materials and condition records for this key.
This is probably very basic for you guys, but I'm learning by web-searches and forums, and I can't seem to wrap my head around why this fails
Any tip or help would be greatly appreciated!