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

Query report field update with code

Former Member
0 Likes
602

I'm working on a report with table join VBRP & VBRK where main table is VBRP.

My goal to build a report to check Sales Order Item Qty compare with that SO/Item's billed Qty.

I can get billed qty from VBRP-FKLMG and also that Sales order's item qty available in VBRP-LMENG field.

Now the problem is, VBRP-FKLMG as increasing more than single line because of multiple billing, VBRP-LMENG also duplicates for what my report getting incorrect.

Now what can I do for not to repeat the Sales Order Item line Qty in VBRP-LMENG.

Please advice. Many thanks in advance.

1 REPLY 1
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
454

I'm assuming you're talking about SQ01 query. This is, unfortunately, kind of a problem with the queries. If you link two tables via JOIN and there is "1 to many" relatonship, then it would cause duplicates and it's not possible to total correctly.

If you just need to get the quantity, instead of joining the tables create a custom field (Extras button), say BILLED_QTY  and add your own code (SELECT ... ). You can use SUM with SELECT to get the total quantity, but please be cognizant of different billing types (e.g. proformas F8 should not be counted) and cancelled invoices.

This solution is not good for performance but, unfortunately, sometimes there is no other way. If this does not work or is performing too poorly then a custom ABAP report would be needed.