cancel
Showing results for 
Search instead for 
Did you mean: 

Catch the invoice no

Former Member
0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Stephen

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Dear GSL

Can you explain it more clearly?

Sorry for my poor ABAP.

TKS!