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

Sales Document from billing document

rahul2000
Contributor
0 Likes
843

Dear all,

How can i get the corresponding sales document number form a billing document number?

Plz let me know.

Rahul.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hi,

Pass the Billing document no to the table VBFA -Vbeln using the condition vbtyp_v = 'C'

Get the VBELV value from the VBFA .

This is the sales document number .Pass this value in Vbak/Vbap - vbeln to get the sales details.

Hope this helps you

reward points if helpfull.

Thanks & Regards,

Y.R.Prem Kumar

4 REPLIES 4
Read only

Former Member
0 Likes
593

Hi,

Using the table VBFA (Document flow table) u can get

corresponding sales document number form a billing document number.

Pass the Precending , Subsequent documents and the document type.

Regards,

Jaya Vani

Read only

Former Member
0 Likes
593

check out the table VBRP

there u get billing document no. and

Sales Document aubel

Hope it helps

Regards

Bhanu

Read only

Former Member
0 Likes
593

Please look at the below code.. It will give you the sales document no corresponding to the billing document no:

DATA: wa_comwa TYPE vbco6,

i_vbfa TYPE STANDARD TABLE OF vbfa INITIAL SIZE 0,

wa_vbfa TYPE vbfa,

l_vbeln TYPE vbeln.

*billing document no

l_vbeln = '90000049'.

*Padding leading zeros

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = l_vbeln

IMPORTING

output = wa_comwa-vbeln.

*Get the order info

CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'

EXPORTING

belegtyp = 'M' "Billing docu

comwa = wa_comwa

TABLES

vbfa_tab = i_vbfa

EXCEPTIONS

no_vbfa = 1

no_vbuk_found = 2

OTHERS = 3.

IF sy-subrc = 0.

READ TABLE i_vbfa INTO wa_vbfa

WITH KEY vbtyp_n = 'J' "Shipment

vbtyp_v = 'C'. "Order

IF sy-subrc = 0.

  • Display order

WRITE wa_vbfa-vbelv.

ENDIF.

ENDIF.

Please reward if useful

-Tushar

Read only

Former Member
0 Likes
594

Hi,

Pass the Billing document no to the table VBFA -Vbeln using the condition vbtyp_v = 'C'

Get the VBELV value from the VBFA .

This is the sales document number .Pass this value in Vbak/Vbap - vbeln to get the sales details.

Hope this helps you

reward points if helpfull.

Thanks & Regards,

Y.R.Prem Kumar