Wednesday 5 November 2014

Making selection screen field's value as header of the output in SAP Query

SAP Query: SAP Query is basically a tool for functional people to generate a simple report without taking help of technical person. This report looks basically like an ALV report. However we do have different options as output format like SAP list viewer, ABAP List and many more. Please note that one should not expect a more customized report through SAP Query.

   In spite of the core purpose of facilitating the functional consultant with a tool to generate a simple report of their own, SAP query comes with functionality of doing slight changes, like we do have coding option at different events of classical report, to meet some basic need.

   One such need comes to me in recent past. The title of the SAP Query (which one gives when query was created first time) comes as header of it's output. User was wanting a field in selection screen and further this field's value in the selection screen must come as the header of the output. I have created a demo SAP query to demonstrate this. Here is the process to achieve this. Kindly note that this functionality only works with the output format "ABAP List".

1. Go to SQ01. Give your query name and press change. Make the first screen of SAP Query like below screen shot. Make sure the check box "With standard title" under block Print list, must not be checked. Otherwise the header of the output will always come as your query's standard title.

2. Go to select field screen using the right navigation arrow beside execute button on tool bar.

3. At first you will not be able to see this column of short name. You have to switch it on like below and then you will be able to see this short name column in edit mode.

4. Here the fields which are checked are the ones which are going to come as selection screen field. Create a short name of the field whose value you want in the output header. Like below.

5. Go to the “Basic list” option and give “&<short name>" (which you have created in previous step) in the header field.







6. Save it. Execute the query and make sure in selection screen you select the ABAP List as the output format.




Output:

              
                                                          
                                                                                                             By: Reetika Patel