Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Check if invoice already exists

former_member184588
Active Participant
0 Kudos

Hi,

I want to check if an invoice is already in the system before I can create it with an own dynpro (with reduced fields). The criteria should be vendor, comp_code, ref_doc_no_long. I still need to add the total sum.

Currently I am using the following code (but this will only identify the parked invoices):

select b~belnr into (lv_inv_no) from bkpf as b

   inner join vbsegk as v

    on  v~belnr = b~belnr

    and v~bukrs = b~bukrs

   where

   v~lifnr = lv_vendor_no

   and b~bukrs = ls_documentheader-comp_code

   and b~xblnr eq ls_documentheader-ref_doc_no_long

   and b~blart in ('KD', 'NE')

   .

endselect.


Can someone make a suggestion which tables I need to check for the posted documents and the logistic (parked) invoices?

Is it correct to check also the XREVERSAL field and select only those that are empty (and not 1 or 2)?


Regards,

  Vanessa


5 REPLIES 5

praveenboss
Participant
0 Kudos

Hi Vanessa,

Please Tell me more .

You need to create invoice reference to..?

Thanks.

0 Kudos

Hi Praveen,

I have an own dynpro to enter data for invoices. That means on the left side I have the invoice (displayed as PDF) and on the right side my fields for the data input.

Now I would like to avoid that this invoice is already processed within the system. Therefore I need to check if the invoices is already entered (based upon the fields company code, vendor, ... ).

I need to check:

- If there is already a parked invoice for this (with or without order)

- if there is already a posted invoice for this (with or without order)

Hope that clearifies things.

Regards, Vanessa

0 Kudos

Hi Vanessa,

You can pick the data from RBKP/RSEG tables with the fields mentioned above. If you are able to get the data (SY-SUBRC = 0) then there is an Invoice exist with given criteria otherwise No.

Regards,

Vijay

0 Kudos

Hi Vijay,

thanks a lot. I will give it a try.

Regards, Vanny

0 Kudos

Hi,

when I get it right this table is for the logistic invoices. How can I identify if the record is deleted/reversed?

Regards, Vanessa