Skip to Content
0
Former Member
Dec 03, 2009 at 04:45 AM

Query in fetching invoice amount from table EKBE

263 Views

Hi all,

In my custom report the invoice amount is taken from the field ekbe-dmbtr and is displayed wrongly.

For a particular Purchase order the account assignment table EKKN has only one entry and for the same Purchase order the Purchase order history table EKBE has two entries.

For eg :

Table EKKN

Purchase order Item Seq Access number

20900753 000001 01

Table EKBE

Purchase order Item Seq Access number Material Doc Number Amount(DMBTR)

20900753 000001 01 5105606685 500

20900753 000001 99 5105606685 500

There is a loop at EKBE within the loop there is a IF condition which checks if

IF EKBE-PO number EQ EKKN-PO number and

EKBE-Item = EKKO-Item and

EKBE-Seq Access Number = EKKN-Seq Access number.

When the above condition is satisfied then the EKBE-DMBTR is added to the o/p field.

ENdloop.

In this case(several account exists for one mat doc,accounting dept use occasionally such cases) since EKKN does not hv seq access number 99 it does not take the second line into consideration so the amount displayed in the output has the value 500 instead of expected value 1000(sum of both the lines 01 and 99)

Can you please offer suggestion on how to solve this issue.I want to know if i can ommit the Seq access number check in the IF condition.In that case i would get the expected result 1000,but will it affect some other functionality.Or is there any other way to solve this.