Application Development and Automation 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: 
Read only

Document number

Former Member
0 Likes
1,896

Is there any table which links the invoice document number and the accounting document number?I have a accounting document number using that have to update the contents of bseg table.How to do it?

1 ACCEPTED SOLUTION
Read only

RoySayak
Active Participant
0 Likes
1,745

Hello Rajalakshmi,

See the below query, hope its help you to find out the both billing document and accounting document.

*--- Data are fetched from table RSEG
      SELECT belnr            "Accounting Document Number
             gjahr            "Fiscal Year
             buzei            "Document item in invoice document
             ebeln            "Purchasing Document Number
             matnr            "Material Number
             bukrs            "Company Code
             werks            "Plant
             FROM rseg
             INTO TABLE it_rseg
             FOR ALL ENTRIES IN it_mseg <internal table filled from MSEG table>
             WHERE matnr = it_mseg-matnr
             AND bukrs = it_mseg-bukrs
             AND werks = it_mseg-werks
             AND ebeln = it_mseg-ebeln.

*--- Data are fetched from table RBKP
        SELECT belnr         "Document number of an invoice document
               gjahr         "Fiscal Year
               xblnr         "Reference Document Number
               FROM rbkp
               INTO TABLE it_rbkp
               FOR ALL ENTRIES IN it_rseg
               WHERE belnr = it_rseg-belnr
               AND gjahr = it_rseg-gjahr.

Regards,

Sayak

10 REPLIES 10
Read only

GauthamV
Active Contributor
0 Likes
1,745

Plz SEARCH in SCN you have lot of posts.

Read only

RoySayak
Active Participant
0 Likes
1,746

Hello Rajalakshmi,

See the below query, hope its help you to find out the both billing document and accounting document.

*--- Data are fetched from table RSEG
      SELECT belnr            "Accounting Document Number
             gjahr            "Fiscal Year
             buzei            "Document item in invoice document
             ebeln            "Purchasing Document Number
             matnr            "Material Number
             bukrs            "Company Code
             werks            "Plant
             FROM rseg
             INTO TABLE it_rseg
             FOR ALL ENTRIES IN it_mseg <internal table filled from MSEG table>
             WHERE matnr = it_mseg-matnr
             AND bukrs = it_mseg-bukrs
             AND werks = it_mseg-werks
             AND ebeln = it_mseg-ebeln.

*--- Data are fetched from table RBKP
        SELECT belnr         "Document number of an invoice document
               gjahr         "Fiscal Year
               xblnr         "Reference Document Number
               FROM rbkp
               INTO TABLE it_rbkp
               FOR ALL ENTRIES IN it_rseg
               WHERE belnr = it_rseg-belnr
               AND gjahr = it_rseg-gjahr.

Regards,

Sayak

Read only

Former Member
0 Likes
1,745

Sorry am not still clear with this.I have a invoice document number in an internal table using that i want to update the status of bseg table.Plz help to do it.

Read only

Former Member
0 Likes
1,745

Hi

Get billing document number from VBFA ref to invoice number..

Kiran

Read only

Former Member
0 Likes
1,745

Hi

Get billing document number from VBFA ref to invoice number..

Kiran

Read only

Former Member
0 Likes
1,745

Hi Lakshmi,

Table VBRL-VBELN has Invoice Document No. and the same table has VBRL-VBELN_VF as the Billing document No.

take the billing document No. and

VBRL-VBELN_VF = VBRK-VBELN = BSEG-VBELN.

Or go in a reverse way--- BSEG > VBRK-> VBRL

Hope this solves your problem.

Thanks & regards,

Dileep .C

Read only

Former Member
0 Likes
1,745

Hello Rajalakshmi,

You can find this in the table VBFA.

Give the invoice number in Preceeding document field and get the entries.

You will get the subsequent entries of the invoice. i.e. after invoce what ever the document generated for the invoice wil be displayed. Using subsequnet doc. type you can find the required document.

Best Regards,

Sasidhar Reddy Matli.

Read only

Former Member
0 Likes
1,745

hi,

try with table : BKPF OR VBFA

RAHUL

Edited by: RAHUL SHARMA on Apr 9, 2009 3:24 AM

Read only

Former Member
0 Likes
1,745

if u have accounting number. bkpf-xblnr.

if s

then

SELECT * FROM BKPF INTO TABLE GT_BKPF

WHERE AWTYP = 'VBRK' .

u will get gt_bkpf-AWKEY.

'0' + VBRK-VBELN = GT_BKPF-AWKEY.

IN THIS WAY U WILL GET VBRK-VBELN .

that is invoice no.

HOPE THIS HELP.

Read only

Former Member
0 Likes
1,745

hi,

RESG and RBKP are the two table..

RESG contains accounting document number

RBKP conatins invoice document number

hope this helps

Regards

RItesh J