Skip to Content
author's profile photo Former Member
Former Member

How to get the name of an executing ABAP query in run time

Hi ABAP Gurus,

I need to get the ABAP query name when it's running. For example we can get the current executing ABAP program name from SY-REPID.

My tried logic - every query generates an ABAP program like AQZZUGQUERY. 'UG' stands for user-group name and the length specified for it is 12, if the length of the user-group name is less than 12, then the rest will be filled by '='. Next 'QUERY' stands for ABAP query name and the length specified for it is 14, if less, then the rest will be filled in with '=' in the right. I've tried to extract the query name by using cut and trip (offset) operations.

But somehow this logic is not working - always it's picking up the function name as checked in debug mode.

Guys - Can you please provide me the solution on this.

Thanks & regards,

Jayanta Bej.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2009 at 11:29 AM

    HI,

    Check this QUERYNAME = REP+16(14)

    Check this Fm RSAQ_REPORT_NAME how the Report name for the query is created

    Edited by: Avinash Kodarapu on Mar 20, 2009 4:59 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2009 at 11:36 AM

    Hi Avinash,

    I've checked in the debug mode, it's not collecting the ABAP program name, it's collecting something else - function name. How to get rid of this?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2009 at 03:47 PM

    Guys,

    I've cracked the issue. Instead of retrieving the query name from sy-repid, I've retrieved it from sy-cprog and the problem is resolved.

    Thanks guys for your quick responses.

    Thanks and regards,

    Jayanta Bej.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2009 at 03:48 PM

    The issue is closed.

    Regards,

    Jayanta.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.