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

Calling SQ00 from my report program

Former Member
0 Likes
2,216

Hi,

My requirement is to place a radiobutton on the selection screen. when user selects this radio button and execute, he should be shown the selection screen of a query defined in SQ00. So I went to SQ00 and gave the query and executed. I was show a selection screen then I went to system > status and looked at the program name. It is AQL4Z_PURCHASELUMBERPOHT==. What is the ending '=='s? I think this program is auto generated. Can I use Submit with this report program? If I use this and if the selection screen is chaged then will this program name also changes? Please suggest me or any better way to achieve this requirement. Let me know if you need more information.

thank you,

surya.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,005

Hi Surya,

Try this eventhough it is not pretty (is Friday).


...
CALL FUNCTION 'RSAQ_REPORT_NAME'
  EXPORTING
    WORKSPACE = l_wsid
    USERGROUP = l_bgrup
    QUERY = l_quold
  IMPORTING
    REPORTNAME = l_reptname.

l_reptname+2(2) = '%'.
CONDENSE l_reptname NO-GAPS.

data: l_name like trdir-name.
                      
clear l_name.        
SELECT SINGLE NAME
INTO L_NAME
FROM TRDIR
WHERE NAME LIKE l_reptname.

IF SY-SUBRC <> 0.
  STOP.
ELSE.
  MOVE L_NAME TO l_reptname.
ENDIF.

CALL FUNCTION 'RSAQ_SUBMIT_QUERY_REPORT'
  EXPORTING
    QUERYREPORT = l_reptname
    VARIANTE = ''
  EXCEPTIONS
    ONLY_WITH_VARIANT = 1
    VARIANT_NOT_EXIST = 2
    OTHERS = 3.
 
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Hope this will help.

Regards,

Ferry Lianto

Hi,

My requirement is to place a radiobutton on the selection screen. when user selects this radio button and execute, he should be shown the selection screen of a query defined in SQ00. So I went to SQ00 and gave the query and executed. I was show a selection screen then I went to system > status and looked at the program name. It is AQL4Z_PURCHASELUMBERPOHT==. What is the ending '=='s? I think this program is auto generated. Can I use Submit with this report program? If I use this and if the selection screen is chaged then will this program name also changes? Please suggest me or any better way to achieve this requirement. Let me know if you need more information.

thank you,

surya.

13 REPLIES 13
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,005

AQL4Z_PURCHASELUMBERPOHT== is the naming convention for querys, for example, in the following program name, BASIS is the user group and USER_LOGIN is the query name. As long as these two things do not change, then the program name will always be the same and you can call it using the SUBMIT statement in your program.

AQFKBASIS=======USER_LOGIN====

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,005

Hi Surya,

You can use FM RSAQ_REPORT_NAME to find out the query/report name based on user group and query name.

Then you can submit the query/report name.

Hope this will help.

Regards,

Ferry Lianto

Read only

0 Likes
2,005

Hi Ferry,

I just saw this function module, what value I should be passing to the 'workspace' parameter?

Thank you,

Surya.

Read only

Former Member
0 Likes
2,005

Hi Surya,

You can leave it blank.

Regards,

Ferry Lianto

Read only

0 Likes
2,005

Hi Ferry,

It worked and getting report name but when call that report using submit it is giving a dump saying Program '......' not found. Any clue ?

Thank you,

Surya.

Read only

Former Member
0 Likes
2,005

Hi Surya,

Please use this FM RSAQ_SUBMIT_QUERY_REPORT to run the query/report name. You can leave parameter VARIANTE blank.

Hope this will help.

Regards,

Ferry Lianto

Please reward points if helpful.

Read only

0 Likes
2,005

Hi Ferry,

I used it and giving me the same dump. Following is my code.

FORM open_query using l_wsid

l_bgrup

l_quold

changing l_reptname .

CALL FUNCTION 'RSAQ_REPORT_NAME'

EXPORTING

WORKSPACE = l_wsid

USERGROUP = l_bgrup

QUERY = l_quold

IMPORTING

REPORTNAME = l_reptname

.

CALL FUNCTION 'RSAQ_SUBMIT_QUERY_REPORT'

EXPORTING

QUERYREPORT = l_reptname

VARIANTE = ''

EXCEPTIONS

ONLY_WITH_VARIANT = 1

VARIANT_NOT_EXIST = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • submit (l_reptname). "ZFI_AGING_REPORT.

ENDFORM.

Read only

Former Member
0 Likes
2,005

Hi Surya,

Please try to add this.


...
move 'ZZ' to  l_wsid.

CALL FUNCTION 'RSAQ_REPORT_NAME'
  EXPORTING
    WORKSPACE = l_wsid
    USERGROUP = l_bgrup
    QUERY = l_quold
  IMPORTING
    REPORTNAME = l_reptname.

...

Regards,

Ferry Lianto

Read only

0 Likes
2,005

Hi Ferry,

I tried this too. No luck! Only difference is report names, earlier it is AQFJZ_PURCHASINGLUMBERPOHIST==

and after passing 'ZZ' worspace the report name is

AQZZZ_PURCHASINGLUMBERPOHIST==

-Thank you,

Surya

Read only

Former Member
0 Likes
2,005

Hi Surya,

Sorry ... try this.

move 'G' to l_wsid.

Regards.

Ferry Lianto

Read only

0 Likes
2,005

Hi Ferry,

I tried passing G. Same dump. But I observed that any thing other than space I pass it is giving the report name as AQZZZ_PURCHASINGLUMBERPOHIST==

Also the report names in dev and test are different i.e 3 and 4 characters. I am guessing if could able to find and pass right workspace, then this problem will be solved. Please let me know your comments.

Thank you,

Surya

Read only

Former Member
0 Likes
2,006

Hi Surya,

Try this eventhough it is not pretty (is Friday).


...
CALL FUNCTION 'RSAQ_REPORT_NAME'
  EXPORTING
    WORKSPACE = l_wsid
    USERGROUP = l_bgrup
    QUERY = l_quold
  IMPORTING
    REPORTNAME = l_reptname.

l_reptname+2(2) = '%'.
CONDENSE l_reptname NO-GAPS.

data: l_name like trdir-name.
                      
clear l_name.        
SELECT SINGLE NAME
INTO L_NAME
FROM TRDIR
WHERE NAME LIKE l_reptname.

IF SY-SUBRC <> 0.
  STOP.
ELSE.
  MOVE L_NAME TO l_reptname.
ENDIF.

CALL FUNCTION 'RSAQ_SUBMIT_QUERY_REPORT'
  EXPORTING
    QUERYREPORT = l_reptname
    VARIANTE = ''
  EXCEPTIONS
    ONLY_WITH_VARIANT = 1
    VARIANT_NOT_EXIST = 2
    OTHERS = 3.
 
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Hope this will help.

Regards,

Ferry Lianto

Read only

0 Likes
2,005

Hi Ferry,

This worked. Your help is appriciated and you scored full points. Have a nice weekend.

Thank you,

Surya.