Skip to Content
avatar image
Former Member

Invoice Qty from VBFA

Hello folks!:

I have made a query and created a new field related to the invoice qty. All at item level and referenced to the sales order.

This new field is configured to pull the invoice qty from the document flow:

FACPOS = ' '.

select RFMNG into FACPOS

from vbfa

where vbelv = vbap-vbeln

and posnn = vbap-posnr

and vbtyp_n = 'M'.

endselect.

Then the report shows the sales order qty and the invoice qty per item. Everything looks perfect at this time. The problem starts when the invoice is partially created from partial deliveries (which is very often) and then a partially invoice is made. Due to the fact that the data is generated from the VBFA table, it will always going to bring the latest invoice qty and not the sum of all the invoices.

Example:

Order for 6 pcs of product A

Delivery for 4 pcs and Invoice for 4 pcs

Pending 2 pcs

Report shows: Invoice qty 4 pcs

Then another invoice is created for 2 pcs

Nothing left from the sales order

Report shows: Invoice qty 2 pcs <----


PROBLEM

PROBLEM: The report only shows as a total of the invoice qty just the 2 pcs from the last invoice. I actually want to add up all the invoice qty's generated per line item in the document flow.

1. Any idea on how to configure the code so that I can have the sum of all the invoices in the document flow per item?

2. Is there a special function that can do this?

Pls let me know

Regards

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jul 23, 2009 at 04:24 AM

    Hi,

    Pass the vbap-vbeln to vbfa-vbelv then pick all the unique vbeln when vbtyp_n as m ,then pass it to vbrp:vbeln and pick the values of netwr and fkimg.

    Hope it helps.

    Regards,

    Pasapula

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi ,

      We can not pick the unique values from vbfa while designing a query ,it is only possible while developing the program with the help of abaper.

      Regards,

      Pasapula.

  • avatar image
    Former Member
    Jul 23, 2009 at 07:01 AM

    Hi,

    Pass the sales order number in VBFA for the field "VBELV".

    Execute.

    Here there is a chance of two cases.

    1)If the billing document is created w.r.t. order:In this case,you will get the invoice number from VBELN field.

    Pass the same to VBRP table as VBELN and then fetch "FKIMG".

    This will give you the quantity.

    2)If the billing document is created w.r.t. a delivery:In this case,take VBELN and again pass it to VBELN into VBFA table as VBELV and then fetch VBELN

    Pass the same to VBRP table as VBELN and then fetch "FKIMG".

    Regards,

    Krishna.

    Add comment
    10|10000 characters needed characters exceeded