Associate SAP Query to a Transaction Code

So many times I saw Transaction Code for SAP Query defined in a strange way; many ABAP developers uses to create a TCode for SAP Query as they do for common reports.

This is dangerous because the report is auto-generated and sometimes this report changes (especially after a system upgrade) or it does not contains new implementations (you have to force regeneration).

The right way to create a Transaction Code is to refers directly to the SAP Query (AQQU object type).

From transaction SE93 create a new Object as shown in the image below

Abap query

in the next screen complete the fields

Transaction START_REPORT

Skip initial screen X

Box “Classification” (as you want)

Box “Default value” add the following parameters:

D_SREPOVARI-REPORTTYPE AQ
D_SREPOVARI-EXTDREPORT <sap query name in SQ01>
D_SREPOVARI-REPORT <user groups belonging to the query>

If user group is in global area you ave to add “<space>G”.

For example if you want to use the query ZQUERY in global user group area ZUSERGR you have to set:

D_SREPOVARI-REPORTTYPE AQ
D_SREPOVARI-EXTDREPORT ZQUERY
D_SREPOVARI-REPORT ZUSERGR G

Further informations on SAP Query could be found on OSS note “393160 – SAP Query Using queries.pdf”.

Published by Ivan Femia

I have more than 10 yrs of experience in IT; born as Windows Basis Administrator I moved rapidly to my real passion: web programming and R&D. I have been at Techedge since 2007 and I'm head of development of Techedge Labs Team. I focused my researches in emerging technologies, mobile, WebDynpro ABAP, Flash Island, Adobe Interactive Form and ABAP. My colleagues consider me one of the top reference for ABAP, ABAP OO, WebDynpro ABAP and high tech topic. I'm owner of the SCN Community Projects on SAP Code Exchange: abap2xlsx, augmentedSAP, abap2GApps, abap2docx and Clone Hunter. Follow me on Twitter @IvanFemia

Join the Conversation

9 Comments

  1. Hi,

    I have tried your solution but it doesn’t work. The problem is that D_SREPOVARI-REPORT should be: first 12 chars name of the user group and than the “G” flag; more exactly:
    “ZUSERGR G” -> total of 13 chars

    BR,

  2. This is not a solution, it is the standard behavior. Btw I don’t understand your comment

    ZUSERGR -> 7 chars
    space -> 1 char
    G -> 1 char

    Total 9 chars

    Indeed in table SREPOVARI (ECC)
    Field Data element
    REPORT PROGNAME CHAR 40 0 ABAP Program Name

    Regards,
    Ivan

  3. Hi,
    I’m trying associate a transaction to a view.
    I have build a view, ZMATPRICE, with se11, the view includes camps of MARA, MAKT and MBEW, and i want call him from a transaction.

    What transaction can i use?

  4. Hi,

    you have to create your own Custom transaction code from SE93 calling a table maintenance.
    1 – Create a new Transaction with parameters
    2 – Associate transaction SM30 with skip initial screen
    3 – add the following parameters: VIEWNAME and SHOW ‘X’

    Regards
    Ivan

  5. In our system I found that the username was 12 characters so the ‘G’ for global area had to be in position 14, that is, 12 + space + ‘G’.

    Hopefully this is useful to someone else who finds this post. Also there is a forth parameter “D_SREPOVARI-VARIANT” if yoiu want to pre-select a query variant.

    cheers
    S.

  6. If i understand correct there should be enough spaces after D_SREPOVARI-REPORT so G to be on 13 position ? Is this correct or this is system dependent behaviour

  7. For example, if you have a user group named ZUSERGR, you would need to leave five spaces before assigning the G character. The field value would therefore be “ZUSERGR G”.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: