2010 Dec 09 1:49 PM
Hi All,
I have a requirement in which we have BELNR(accounting document number) and we need to get the corresponding XBLNR(SD reference doucment number). Is there any standard table or transaction which returns XBLNR value if BELNR value is given.
Please help me on this.
Regards,
Pranjali
2010 Dec 09 2:23 PM
Usually FI document contain a link to the application which created the document,
This information is stored
- BKPF-AWTYP Reference procedure
- BKPF-AWKEY Object key
Those field are more "technical" than XBLNR.
e.g. for a SD invoice, AWTYP = 'VBRK' and AWKEY is invoice number
For your "exact" question, answer could be READ_DOCUMENT_HEADER or FI_DOCUMENT_READ_SINGLE. Also remember you will also need BUKRS company and GJAHR year to get an unique identification of account document. (A single SELECT statement is usually enough)
Regards,
Raymond
2010 Dec 10 5:56 AM
Hi Raymond,
Thanks for your reply. You have mentioned that we need BUKRS and GJAHR to get unique identification of account document. Can you please tell me how can I get the unique BUKRS and GJAHR values if I know BELNR only, because as per my understanding, FI customer invoice number is company code and fiscal year specific. Please help me on this.
Regards,
Pranjali
2010 Dec 10 7:22 AM
You cannot, those fields are mandatory. One document number BELNR may give many documents in the system, many of those can be related to SD invoice, From where do you get this number, if it a user input, add company BUKRS and year GJAHR input, if it comes from a database read, those fields are also in the table read or in an header table. Check also with functionals for FI number range Customizing.
SELECT * FROM bkpf WHERE belnr = p_belnr. " 0-n records (multiple company and/or year)
CASE bkpf-awtyp. " check table TTYP for structure awkey and FM for display
WHEN 'VBRK'. " no structure, FM AC_DOCUMENT_SENDER_VBRK
l_VBELN = bkpf-awkey+0(10).
SELECT SINGLE * FROM vbrk WHERE vbeln = l_vbeln.
ENDCASE.
ENDSELECT.
Regards,
Raymond
2010 Dec 10 10:35 AM
Hi Raymond,
I am working on lockbox functionality where I have invoice number(BELNR) in lockbox file. Now I want to find out that the invoice number in that file is valid or not(present in table BSID). But when I checked in table BSID, for some invoice numbers, there are more than one entry with different company codes and fiscal years. So I need to find the correct entry for that invoice number(with correct comapny code and fiscal year). When I asked functional consultant, he told me that SD invoice number is unique among company codes and does not repeat in different company codes or fiscal years , but FI customer invoice number is company code and fiscal year specific. So I am thinking to get the SD invoice number(XBLNR) for that FI invoice number(BELNR), so that I will get a unique entry in table BSID. Please guide me on this.
Regards,
Pranjali
2010 Dec 10 1:38 PM
Then use
l_awkey+0(10) = <lockbox-invoice_number>.
SELECT * FROM BKPF
WHERE belnr EQ <lockbox-acounting_document_number>
AND awtyp = 'VBRK' and awkey = l_awkey.
if found (sy-subrc EQ 0) then the invoice number is correct. (Check that index BKPF~4 is active on your system, for performance)
Regards,
Raymond
2010 Dec 13 6:50 AM
Hi Raymond,
Thanks for your reply. My program has accounting document number(BELNR) only. It does not have the lockbox file data, so we don't have the lockbox invoice number. Can we get the XBLNR without the lockbox invoice number?
Regards,
Pranjali
2010 Dec 13 8:55 AM
No, you actually need more data. For one BELNR, you may (and will) get multiple XBLNR values in BKPF (one per year, company code) to get only one a SD invoice is a matter of luck, and not adviseable. Check if you have other data to choice the correct "unique" invoice (customer code or reference, date, bank reference ?)
Regards,
Raymond
2010 Dec 09 2:27 PM
2010 Dec 09 3:00 PM
Nicole is right...
...or do you mean another reference like BSEG-XREF1, 2 or 3 ?
...or BSEG-VBELN or VBEL2 ?
grx
A.
2010 Dec 16 6:52 AM
2012 Jan 13 2:51 AM