sap-erpsap-query

Retreiving ship-to-party country SAP QuickViewer


I've created a QuickView, where I enter Sales Document data as search criteria.

Selection fields are

VBAP-VBELN, VBAP-POSNR, VBAP-MATNR and VBAP-KWMENG

As the Sales Document Item data.

Furthermore I retrieve the Schedule line date from

VBEP-EDATU

From General Data in Customer Header KNA1, I use

KNA1-KUNNR and KNA1-LAND1

Now, all connections and keys works out. My issue is, I wish to list the Country Key for ship-to-part rather than sold-to-party (which is represented by KUNNR). How could this be solved?

Tables are joined as follows:

VBAK-VBELN -> (VBAP-VBELN,-POSNR) -> (VBEP-VBELN, -POSNR)
VBAK-KUNNR -> KNA1-KUNNR

I do know I would probably need a new table in here to retrieve what I'm looking for, but I'm completely blank. Any help would be greatly appreciated.


Solution

  • Ship-To-Party is stored in table VPBA (Sales Document Partners) in field KUNNR1 for partner function SH, so to select it you should join KNA1 not with VBAK but with VBPA-KUNNR restricting function to SH.

    However, SQVI is a very primitive tool which doesn't allow setting complex (neither trivial) conditions so you should switch to ABAP queries tool (SQ01).

    But just in case you wanna do this in SQVI here is the workaround:

    1. Join necessary tables in SQVI builder

    enter image description here

    1. Add necessary KNA1 fields to layout: KUNNR and LANDX

    2. Go to layout mode and enable selection by partner function PARVW

    enter image description here

    1. Run your query by SH partner function

    enter image description here

    1. and voilá! You will be shown only the orders with ship-to-party specified with their countries

    enter image description here