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

Code for Query Report as additional field

Former Member
0 Likes
1,133

I need a field in query report which has a simple join of VBUK & LIKP.

Can't increase join of LIPS as the report changes to item level which I don't want.

My additional field formula will be VBAP-NETPR X LIPS-LFIMG

Where

VBAP-VBELN = LIPS-VBELV   &

VBAP-POSNR = LIPS-POSNV

Again where

LIPS-VBELN = VBUK-VBELN

Simply to say, my query build to generate Delivery Report which billing not complete. And within that report I want to bring Sales Order Rate * Delivery Qty.

1 ACCEPTED SOLUTION
Read only

jogeswararao_kavala
Active Contributor
0 Likes
1,073

Hi Zaiedul Hoque,

See this should work.

Code attached separately.

Jogeswara Rao K

5 REPLIES 5
Read only

jogeswararao_kavala
Active Contributor
0 Likes
1,074

Hi Zaiedul Hoque,

See this should work.

Code attached separately.

Jogeswara Rao K

Read only

0 Likes
1,073

Dear Sir (Mr.J.R.Kavala),



I'm really appreciate your effort and thanks for your reply. The report almost done with your coding, but may be it is my fault that I couldn't clearly elaborate what I exactly I wanted.


According to your code the result brings only 1st lines result ($ 1,500) from LIPS, but the result should be sum up for all the line item instead, that is ($ 25,750). I've tried to make the scenario below for your understand.


So where should I change the coding if you please advice. Many thanks again in advance.



Zaied

====

Read only

0 Likes
1,073

Hi Zaiedul Hoque,

I too could not visualize your multiple record requirement, due to the fact that I did not work with these tables. This requirement complicates the code calling for Internal tables for local variables we declared.

I would rather prefer to connect VBAP and LIPS tables also to the join to achieve this in easier way. And then calculate your additional field with formula conditionally. Then in ALV, if you click on subtotal icon by selecting the VBELN column, the Additional field total will be appearing Sales Order wise.

If due to reason, if you do not prefer that, then as told above you need to declare types and internal tables to select multiple lines and use COLLECT and AT NEW syntax in another internal table to aggregate these values VBELN-wise.

Regards

Jogeswara Rao K

Read only

0 Likes
1,073

Dear Sir (Mr.J.R.Kavala),



Another join connecting VBAP & LIPS will not go with the purpose of my report, so I couldn't do that.

The next advise I've to follow that is using "COLLECT and AT NEW syntax in another internal table to aggregate these values VBELN-wise" but as per my skill I couldn't make it exactly.

Would you please describe in details to do it.

Thanks

Read only

0 Likes
1,073

Hi Zaiedul Hoque,

In fact I was trying, but this is like blind-fold for me for 2 reasons. As I mentioned this was not the area I'm conversant and the other is no test data is available with me. (Neither I can create), So I'm afraid I can be of further help.

In my opinion, in the event of such long coding requirement, SAP Query becomes less relevant. ABAP coding would be proper. However, I wish better help be flowing to you my friend, from experts.


I should appreciate your specification skills.


Best of Luck

Jogeswara Rao K