Application Development 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: 

Subtotal in Query SQ01

former_member231942
Participant
0 Kudos

Salam,

i have created SAP query presenting three columns.storage location, consumption & Rejection.

i want to show storage location wise consumption's subtotal as well as rejections 's subtotal. i tried for sort and total checks in basic list. these options show subtotal with expanded view. i need the by default subtotal in line item with respect to storage location where i'll be able to calculate a third column presenting rejection %age of consumption.

is there any way to call storage location wise subtotaled amount in line item rather than layout subtotal.

any suggestions will be highly appriciated.

Regards,

Uzma Farooq.

1.jpg

2 REPLIES 2

raymond_giuseppi
Active Contributor
0 Kudos

With a tool like OO class CL_GUI_ALV_GRID, you can manage yourself calculation of subtotals handling event AFTER_REFRESH. using method GET_SUBTOTALS to adapt subtotals and REFRESH_TABLE_DISPLAY to display the updated values.

Using this kind of tool in a SQ01 Query is counter-intuitive because the purpose of such query is to prevent coding as much as possible. If you actually want to use SQ01/SQ02, you could try to add some code in the dataset. To get a reference to the ALV class behind full screen ALV display and handle the events, use FM GET_GLOBALS_FROM_SLVC_FULLSCR...

Hint: Better build a new report using OO.

Jelena
Active Contributor
0 Kudos

In Queries, we have only limited options. From what I see, essentially you'd have to set the subtotals in the layout yourself and then just don't allow for the layout to be changed. I'm not aware of any code elements in the infoset that would allow to force the subtotals.

For more flexibility you'd need to go with a new ABAP report, as Raymond suggested.