Former Member

# small problem

Hi to all,

according to my report...i have compared the <b>prices</b> of SALES and PURCHASES...

So every material have different sales orders...with different prices...

here problem is........purchase price comparing with all the sales orders....means repeating.....(only one purchase order for a particular material...but it is showing with all the sales orders..repeatedly)....finally in the result the total purchase netprice is wrong....

may be my select query is wrong...can u check once...

select VBAP~matnr

VBAK~VTWEG

VBAK~VKORG

VBAK~KUNNR

VBAK~AUART

VBAP~AUDAT

VBAP~NETPR

VBAP~ARKTX

VBAP~VRKME

VBAP~WAERK

VBAP~NETWR

VBAP~vbeln

VBAK~BSTNK

vbap~kwmeng

vbak~bstdk

VBAP~AUFNR

into corresponding fields of table mylist from VBAP

inner join VBAK

on VBAPVBELN = VBAKVBELN

where VBAK~kunnr in s_kunn1

and VBAP~AUDAT in s_AUDAT

and VBAP~MATNR in s_MATNR

and VBAK~AUART in s_AUART

and VBAK~VTWEG in s_VTWEG

and VBAP~AUFNR in s_AUFNR

and VBAK~VKORG in s_VKORG.

loop at mylist.

CLEAR: EINA, EIPA.

select single INFNR from eina into eina-infnr where MATNR =

mylist-matnr.

mylist-matnr1 = eina-matnr.

select single PREIS from eipa into eipa-preis where infnr = eina-infnr.

mylist-PREIS = eipa-preis.

select single EBELN from eipa into eipa-EBELN where infnr = eina-infnr.

mylist-EBELN = eipa-EBELN.

select single BEDAT from eipa into eipa-BEDAT where infnr = eina-infnr.

mylist-BEDAT = eipa-BEDAT.

mylist-PREDI = mylist-NETPR - mylist-PREIS.

modify mylist.

endloop.

raju.

10|10000 characters needed characters exceeded

### Related questions

• Former Member
Posted on Dec 10, 2005 at 12:14 AM

Hi Raju,

I have not thoroughly gone through your code but what i can immediately make out is that you have not cleared your internal table in loop. This might be a possible reason for values getting replicated.

modify mylist.

clear mylist.

******************

endloop.

10|10000 characters needed characters exceeded
• Former Member
Posted on Dec 10, 2005 at 01:19 AM

Hi Raju,

Values are not repaeting in my opinion. Please add VBELN and POSNR to your table then you can recognise they are belongs to different documents.

10|10000 characters needed characters exceeded
• Posted on Dec 10, 2005 at 05:58 AM

I don't think clearing is a problem....

as Murthy said , if you add vbeln posnr then you can see the difference...

though they are looking like duplicates but they are attached to different sales order,item...

vijay

10|10000 characters needed characters exceeded
• Vijay Dudla Former Member

if you really think some problem in code, just take the sales orders and go to VBFA table and find the PO's

if it fails then there is no PO data .

try to find some test data.

regards

vijay