Skip to Content
Author's profile photo Jeevan Sagar

Some tips on ABAP query (SQ01) Part 2

This is the sequel of the previous document I posted earlier.

Here I’m gonna explain some more tips about how to make your ABAP query to look more professional like a ABAP program report.

If you want to remove a table in the table join from infoset, you first need to delete it in the query.

5-10-2012 1-40-20 PM.png

5-10-2012 1-41-14 PM.png

Now on the selection screen if you want to change description of the fields, the order in which they appear, show hide intervals, etc you can do it in the query itself.

5-10-2012 1-42-05 PM.png

Below is an example

5-10-2012 1-45-21 PM.png

The selection screen changes like below:

5-10-2012 1-49-50 PM.png

Now you want to include your own conditions, rescrict the report to run only for certain values, hide fields, for that you just need to create a variant (shown above).

Now I create a variant with following conditions.

5-10-2012 1-59-45 PM.png

If you check the box Only display in catalog, users cannot see the variant, so they cannot change it themselves.

Now after the variant is applied,

5-10-2012 2-00-56 PM.png

Now you may want this report to start with this variant as default. So that users don’t have to input the values every time.

You’d have to assign the default variant in change query mode as shown below.

5-10-2012 2-02-24 PM.png

Your query is ready but it still not as user friendly as a program with transaction code so we assign the tcode to it.

5-10-2012 2-03-12 PM.png

Now click on the In background push button to know the program name of the query.

5-10-2012 2-03-45 PM.png

Go to SE93 and create a transaction of type report, assign the above program to the tcode.

5-10-2012 2-05-30 PM.png

Assigned tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Jeevan,

      Good informative document.

      Author's profile photo Former Member
      Former Member

      very good, especially for function consultant, hope share more in the future

      Author's profile photo Former Member
      Former Member

      Hi Jeevan,

      Valuable reference.

      Appreciating your contributions.

      Author's profile photo Former Member
      Former Member

      Useful contribution

      Author's profile photo Ranjit Simon John
      Ranjit Simon John

      helpful document Thanks Jeevan

      Author's profile photo Neeraj Agrawal
      Neeraj Agrawal

      Dear Jeevan,

      Thank you for sharing this useful information.

      Just wanted to know...

      Is it possible to use an OR command in a query?

      Taking a very basic eg.: If I need a list of materials with MRP controller "X" or MRP Type "Y"

      I can build a query directly for table MARC but can i incorporate this OR condition??

      (without having to write a code of course)

      Author's profile photo Former Member
      Former Member

      Hi Jeevan,

      thats' good one,would pls help me in one more issue,

      i want to split Time field in SQ01, How to do??

      regards

      Shoaib

      Author's profile photo Former Member
      Former Member

      Hello Every one,

      I am getting issues like in SQ01 query chnages

      * Output sequence of lines does not correspond to database structure
        Line 01 (contains fields from table ANLB) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 01 (contains fields from table ANLB) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 02 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 02 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 03 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 03 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 04 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 04 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      any one can help me

      Author's profile photo Former Member
      Former Member

      Hello Every one,

      I am getting issues like in SQ01 query chnages

      * Output sequence of lines does not correspond to database structure
        Line 01 (contains fields from table ANLB) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 01 (contains fields from table ANLB) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 02 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 02 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 03 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 03 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 04 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 04 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      any one can help me

      Author's profile photo Former Member
      Former Member

      Hello Every one,

      I am getting issues like in SQ01 query chnages

      * Output sequence of lines does not correspond to database structure
        Line 01 (contains fields from table ANLB) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 01 (contains fields from table ANLB) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 02 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 02 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 03 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 03 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 04 (contains fields from table ANLCV) cannot appear before
        line 05 (contains fields from table ANLAV)

      * Output sequence of lines does not correspond to database structure
        Line 04 (contains fields from table ANLCV) cannot appear before
        line 06 (contains fields from table ANLAV)

      any one can help me

      Author's profile photo Amit Kumar Kataria
      Amit Kumar Kataria

      Great work Jeevan!!!!!!!!!!!!

      Author's profile photo Al Mahdi BENABDESSELAM
      Al Mahdi BENABDESSELAM

      thanks for the guide

      Author's profile photo Former Member
      Former Member

      Thanks for sharing .

      Author's profile photo Former Member
      Former Member

      Hi Jeevan...

      Thanks for your contribution towards framing such a wonderful document.

      Regards,

      J.Sakthikumar

      Author's profile photo Eduardo Hinojosa
      Eduardo Hinojosa

      Hi

      Good post, but an additional comment. If the program AQ* is linked to a tcode in SE93, when you change something and transport the request from development to production, remember to generate again in SQ01 is you want the tcode trigger the modifications

      Regards

      Eduardo

      Author's profile photo ishani Gupta
      ishani Gupta

      Nice document. It helped me in deleting a field from Field group.

      Thanks!!