Application Development and Automation 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: 
Read only

Regarding SAP Queries

praveen_hannu
Contributor
0 Likes
693

HI Friends

I have got a bunch of requirements, related to SAP Queries.

I was serching for that, in that regards I am seeking your kind help.

1) I have to write a function module to retrive what are the tables and fields are using in a query.

2) I need execute a SAP Query through a function module and retrive the result into a table and export that to the function module.

One more thing which I need where these all SAP Queries will save, are there any tables where the information store and what are the fields, tables and join conditions for that queries.

Can you please help me with your suggestions.

Points will be rewarded.

Awaiting for your reply.

Thanks in advance

Praveen

1 ACCEPTED SOLUTION
Read only

GauthamV
Active Contributor
0 Likes
665

hi,

check these tables.

AQGQDOC

AQLQDOC.

when ever a query is generated a program will be created internally ,u can get that program name from system - status.

now give that program name in function module GET_TABLES,it will give u all structures and tables used in program.

4 REPLIES 4
Read only

GauthamV
Active Contributor
0 Likes
666

hi,

check these tables.

AQGQDOC

AQLQDOC.

when ever a query is generated a program will be created internally ,u can get that program name from system - status.

now give that program name in function module GET_TABLES,it will give u all structures and tables used in program.

Read only

0 Likes
665

Hi Gautham

But both of these tables are not having the information about the query which I have created.

I would like to ask you one thing, what will be the prefix name for the program which has been generated from the sap query.

I have created the query with the name of ZTEST1, but the program name is AQTGSYSTQV000024ZTEST1========. Can you please tell me what all those infront of ZTEST1.

Regards

Praveen

Read only

GauthamV
Active Contributor
0 Likes
665

hi,

there will be some default naming convention followed for the programs that r created in ternally whenever we generate any query.

u can get query names from TADIR table.

give object type as AQBG

object name as <ur PROGRAM NAME>.

u will get the details.

Read only

Former Member
0 Likes
665

Hi,

when you start a query (F8) you get the query´s name as a program (a query is at the end nothing else but a program). If you then go to transaction SE38 and enter the query´s name, you can then explore the core in order to get the objects that you need:

        • Search for tables

SELECT tabname FROM d010tab

WHERE master = program

AND tabname =

        • Search for function modules

SELECT NAME FROM cross

WHERE include =

AND type = 'F'

AND name =

  • Search for data elements

SELECT rollname FROM dd03vv

WHERE tabname = myline-objekt

AND rollname =

Something specific and quick for you to get should not exist. This is going to be a difficult task.