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: 

Get accounting doc number through invoice number

Former Member
0 Kudos

hello Experts,

How can get the accounting document number (bkpf-belnr) through invoice number(vbrk-vbeln).

which is reference number for billing?

thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Just use:

SELECT SINGLE * FROM bkpf

WHERE ( awkey = vbrk-vbeln )

AND ( awtyp = 'VBRK' )

*

I hope this helps,

Regards

Raju Chitale

3 REPLIES 3

Former Member
0 Kudos

Hi,

Just use:

SELECT SINGLE * FROM bkpf

WHERE ( awkey = vbrk-vbeln )

AND ( awtyp = 'VBRK' )

*

I hope this helps,

Regards

Raju Chitale

0 Kudos

Thanks for ur reply raju,

i want to pull all records in oe time.not selet single.

but if i am using these method..the length of the vbrk vbeln is changd.

i am using this vbrk-vbeln for lot of selection.any other way for these...

0 Kudos

HI, TRY THIS

SELECT * FROM BKPF INTO TABLE IT_BKPF

WHERE AWTYP = 'VBRK' AND AWTYP = 'VBRR'

or try this


data : WA_AWKEY LIKE BKPF-AWKEY.
data :  WA_BELNR LIKE BKPF-BELNR.
data : LENGTH TYPE I.
*BREAK MTABAP.
LENGTH = STRLEN( IT_VBRK-VBELN ).

if  LENGTH = '10' .
MOVE it_vbrk-VBELN TO WA_AWKEY.
SELECT SINGLE BELNR FROM BKPF INTO WA_BELNR
  WHERE AWKEY = WA_AWKEY
  AND AWTYP = 'VBRK'
  and blart = 'RV'.

it_final-acc_doc = WA_BELNR.
  CLEAR WA_BELNR .
  CLEAR WA_AWKEY .
else.
CONCATENATE '0' it_vbrk-vbeln INTO wa_awkey.
SELECT SINGLE BELNR FROM BKPF INTO WA_BELNR
  WHERE AWKEY = WA_AWKEY
  AND AWTYP = 'VBRK'
  and blart = 'RV'.

it_final-acc_doc = WA_BELNR .
  CLEAR WA_BELNR .
  CLEAR WA_AWKEY.
endif.

use blart as per ur requirement

RV Billing Doc.Transfer

RS Invoice - Services

RN Invoice - Net

RM Invoice - Materials

RE Invoice - Gross