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

SAP Query Big Problem

Former Member
0 Likes
451

Dear Experts,

This is a very tough one

I have created a Query using SAP Query .. This query is for displaying the PO quantity from table : EKPO and the delivered quantity from table : EKBE

Then I have created a "Local Field" to calcualate the Still to be delivered quantity Local Field = PO quantity - Delivered Quantity

The problem is if the item has been recived more than one time with different quantities .. for example :

PO quant = 12

1. Delivered Quantity = 3 Local Field = 12 - 3

2. Delivered Quantity = 4 Local Field = 12 - 4

3. Delivered Quantity = 5 Local Field = 12 - 5

As you can see the local field is 9 in the first delivery and 8 in the second and 7 in the third , It should be 9 in the first and 5 in the second and 0 in the third .

When i run the report then try to sum the quantites you can imagine that the total sum of local field will be = 24 although the PO quantity is just 12

Note : If you could help me to know how to write a SELECT statement in the sap query or manipulating the Local Field using ABAP

Please Advice and don't till me to use ABAP program from scratch

Best Rgards

1 ACCEPTED SOLUTION
Read only

Sm1tje
Active Contributor
0 Likes
419

So why not create another local field for storing the current quantity, instead of using 12 all the time? For example.

lv_quant_po = PO quantity (= 12 in your case).

First time:

lv_local_field = lv_quant_po - 3.

lv_quant = lv_local_field (=9).

Next.

lv_local_field = lv_quant_po - 4. (=5).

Last time.

lv_local_field = lv_quant_po - 5 (=0).

Just a suggestion, since I don't really know your exact coding, situation etc.

2 REPLIES 2
Read only

Sm1tje
Active Contributor
0 Likes
420

So why not create another local field for storing the current quantity, instead of using 12 all the time? For example.

lv_quant_po = PO quantity (= 12 in your case).

First time:

lv_local_field = lv_quant_po - 3.

lv_quant = lv_local_field (=9).

Next.

lv_local_field = lv_quant_po - 4. (=5).

Last time.

lv_local_field = lv_quant_po - 5 (=0).

Just a suggestion, since I don't really know your exact coding, situation etc.

Read only

Former Member
0 Likes
419

I had to use table EKBE

now solved