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: 

How to get master sales order number from delivery number

Former Member
0 Kudos

Hi All,

I need logic for getting master sales order number from available Delivery number.

Note: There can be many SO's in diffrent levels.

Finally i need to pick up master sales order no.

Thanks in advance.

Thanks,

Deep.

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello

The document flow can be read using function module RV_ORDER_FLOW_INFORMATION. Set:

COMWA-VBELN = <delivery number>

Use all default values except NACHFOLGER = ' ' because you want to read the "upstream" document flow, i.e. the sales order.

Regards

Uwe

8 REPLIES 8

santhosh_patil
Contributor
0 Kudos

Hi,

U can get the sales order number from the VBFA table .

In the VBFA u give

vbfa-VbelV = delviery no.

vbfa-posnv = delivery item no.

vbfa-vbtyp_N = 'C'.

then u will get the order no. in the vbfa-vbeln field.

---Patil

0 Kudos

Hi,

If there are multiple sales orders how can we go about it, which one will be final/master sales order no!

Also is there any function module which will find master sales order number based on given delivery no!

Thanks,

Deep.

0 Kudos

Hi,

I dont think one delivery will have multiple sales order. but one sales order will have multiple deliveries. check it!!!!

You can try the following FM

SD_VBFA_READ_WITH_VBELV

SHP_VBFA_GET_SINGLE_SD_ORDER

WB2_READ_VBFA_BACK_TO_START

SHP_VBFA_GET_GNERIC_SD_ORDER

0 Kudos

Hi,

I have a outbound delivery[VL03N] 'X' in my system .

Then for getting sales order no i am writing below code:

SELECT single vbelv vbeln

from vbfa

INTO (vbelv, vbeln)

where vbeln EQ p_vbeln AND

vbtyp_n EQ 'J'.

Then vbelv i need to pick up master sales order no.

SELECT vbelv vbeln

from vbfa

INTO TABLE i_so

where vbeln EQ l_vbelv AND

vbtyp_n EQ 'C'.

If i write code as above it is giving four sales orders which one of them is master sales order no!

Thanks,

Deep.

uwe_schieferstein
Active Contributor
0 Kudos

Hello

The document flow can be read using function module RV_ORDER_FLOW_INFORMATION. Set:

COMWA-VBELN = <delivery number>

Use all default values except NACHFOLGER = ' ' because you want to read the "upstream" document flow, i.e. the sales order.

Regards

Uwe

0 Kudos

Hi Schieferstein,

I have used above F.M with delivery no.

I have got all sales orders. Now i need to find master sales order how to find!

Thanks,

Deep.

0 Kudos

Hi,

I got the answer.

We have to pick up record(VBELN) where VBELV is initial.

Thanks a lot Schieferstein.

Thanks,

Deep.

0 Kudos

Hi All,

From Above F.M RV_ORDER_FLOW_INFORMATION if we get multiple sales orders whose VBELV value is initial.

Then how can we know which one is Master Sales Order/Base Sales Order!

Can anybody have the solution for the same!

Is ther any other way/F.M!

Thanks in advance.

Thanks,

Deep.