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 can I get the correct Ship To (KNVP-KUNNR2) for a Sales Document?

bryan_lanning2
Explorer
0 Kudos

I am trying to generate a report that will (among other things) display the Ship To ID and Name for a given Sales Document. I know the following information:

VBAK-VBELN - Sales Document

VBAK-VKORG - Sales Org

VBAK-VTWEG - Distribution Channel

VBAK-SPART - Division

VBAK-KUNNR - Sold To Party

I know that the table KNVP will return a list of Ship-To Customer numbers (KUNNR2) for a Sold-To Customer (VBAK-KUNNR) if I also filter by VKORG, VTWEG, and SPART (using SE16N). What I don't know is which one of the returned values is being used in a particular Sales Document. The customer in question has 29 Ship-To locations. How do I find out which Partner Counter (KNVP-PARZA) the Sales Document uses? I don't know where that value would come from. Once I can get the correct Ship-To Customer Number, I should be able to search the table KNA1 by WHERE KUNNR = KNVP-KUNNR2 and return KNA1-NAME1 for the Name of the Ship-To location.

1 ACCEPTED SOLUTION

brad_bohn
Active Contributor
0 Kudos

For a sales document? Use VBPA with PARVW = 'WE'. Also, use the ADRDA field to determine whether the address on the document has been manually changed. In any case, you can use one of the many address management functions or just ADRC directly to get the name, address, etc., using the ADRNR field from VBPA or if the address is from the customer master, KNA1.

4 REPLIES 4

Former Member
0 Kudos

check table VTTK and VTTP

you can also check VBFA table

KUMAR

brad_bohn
Active Contributor
0 Kudos

For a sales document? Use VBPA with PARVW = 'WE'. Also, use the ADRDA field to determine whether the address on the document has been manually changed. In any case, you can use one of the many address management functions or just ADRC directly to get the name, address, etc., using the ADRNR field from VBPA or if the address is from the customer master, KNA1.

0 Kudos

Thanks, that's exactly what I was looking for! I think when I query the table, the PARVW field should be = 'SH' instead of = 'WE'... The user interface shows WE, but the table contains SH. And extra thanks for the tidbit about the possibility of the address being manually changed.

brad_bohn
Active Contributor
0 Kudos

No problem. FYI, 'WE' is the internal format. Depending on how you have your conversion exit settings in the table browser made, you may see 'WE' or you may see 'SH'.