Skip to Content
avatar image
Former Member

Catch the invoice no

Dear experts

In one section of my ABAP Program,i use the DN no to get the invoice such as:

SELECT SINGLE vbeln INTO itab-invoice

FROM vbfa

WHERE vbelv = sitab-dn

AND vbtyp_n = 'M'

AND vbtyp_v = 'J' .

But if the invoice is be canceled,there are will be more than one record exist,my ABAP program aboved will catch the first invoice.

Actually i want to catch the latest record.

How can i get it?

TKS!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 27, 2008 at 09:02 AM

    Hi Stephen

    Ask your ABAP guy to write a condition to exclude the VBRK-VBELN where VBRK-FKSTO = X.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 21, 2008 at 08:17 AM

    ABAP would have been the correct forum to post....

    Instead of Select Single.... do a Select * from VBFA.... into internal table. Loop on this internal table to check whether FKSTO eq X (billing document is cancelled or not) in VBRK table for each VBELN. Delete the record from internal table if the billing document is cancelled. After the loop is completed the internal table will have only the billing documents which are not cancelled.

    Regards,

    GSL.

    Add comment
    10|10000 characters needed characters exceeded