Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

SAP Query Difficulties

$
0
0

I have a requirement which I'm not quite sure how to get around.

 

I'm writing a query based on Sales Documents and Delivery Documents.

 

I am using table joins between VBAK, VBAP, VBFA, LIKP, LIPS, and VBUP.

 

 

The output I want is to display the shortage on deliveries compared to sales orders where applicable. I calculate this by Sales Order Quantity - Delivery Quantity.

 

I have nearly been able to get the output I want, however consider this scenario:

 

A customer orders 20 of a particular item.

10 of these are packed and delivered. Then, in the same night, the rest of the items are packed and delivered.

 

This means there is one item on the Sales Order with quantity 20, and two items on the delivery notes of 10 and 10.

 

 

The output I receive in this instance is as such:

 

  Depot        MaterialDescription                          Short or OverSales Order QtyDelivery QtySales Order NoSales order Item
  FAVERSHAM    111111Material 11333244301160
  FAVERSHAM    111111Material 13233144301160
  CREWE        111112Material 2110944302050
  CREWE        111112Material 34151144302010

 

Material 1 hasn't had a shortage...it's just been delivered in two separate packs of 1 and 32 to add up to the order quantity of 33, so it shouldn't be displayed at all.

 

Materials 2 and 3 are displaying fine because there's only one delivery note assigned to them thus far.

 

How can I get around this issue?

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>