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

ABAP Query SQ01 - get the data using SUBMIT.

Former Member
0 Likes
4,044

I'm using ABAP Query SQ01 and try to get the data using function LIST TO MEMORY  and WRITE LIST resulting garbage value.

Try the suggestion give our fellow SCN members in this link   http://scn.sap.com/thread/2122861 but still not resolved. Appreciate if there is any idea and input on this.

submit aqzzzmm_group_01zmm_q01=======  exporting list to memory

             and return.

   call function 'LIST_FROM_MEMORY'

     tables

       listobject = listtab.

call function 'WRITE_LIST'

* EXPORTING

*   WRITE_ONLY       = ' '

   tables

     listobject       = listtab

* EXCEPTIONS

*   EMPTY_LIST       = 1

*   OTHERS           = 2

.

           .

call function 'LIST_FREE_MEMORY'

  tables

    listobject       = listtab

           .

   call function 'GUI_DOWNLOAD'

     exporting

       filename = 'c:\test.csv'

       header   = '00'

     tables

       data_tab = listtab.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,596

In the output format of the query (inSQ01) check if its set to SAP List viewer. set it if not set. then this below query works.

submit aqzzzdmscm======zdm_po======== using selection-set 'V1' EXPORTING

LIST TO MEMORY  AND RETURN.

DATA list_tab TYPE TABLE OF abaplist.


CALL FUNCTION 'LIST_FROM_MEMORY'

                         TABLES     listobject = list_tab  

                        EXCEPTIONS     not_found  = 1

                                                     OTHERS     = 2.

IF sy-subrc = 0.

      CALL FUNCTION 'WRITE_LIST'     TABLES       listobject = list_tab.

ENDIF.

I'm using ABAP Query SQ01 and try to get the data using function LIST TO MEMORY  and WRITE LIST resulting garbage value.

Try the suggestion give our fellow SCN members in this link   http://scn.sap.com/thread/2122861 but still not resolved. Appreciate if there is any idea and input on this.

submit aqzzzmm_group_01zmm_q01=======  exporting list to memory

             and return.

   call function 'LIST_FROM_MEMORY'

     tables

       listobject = listtab.

call function 'WRITE_LIST'

* EXPORTING

*   WRITE_ONLY       = ' '

   tables

     listobject       = listtab

* EXCEPTIONS

*   EMPTY_LIST       = 1

*   OTHERS           = 2

.

           .

call function 'LIST_FREE_MEMORY'

  tables

    listobject       = listtab

           .

   call function 'GUI_DOWNLOAD'

     exporting

       filename = 'c:\test.csv'

       header   = '00'

     tables

       data_tab = listtab.

6 REPLIES 6
Read only

Former Member
0 Likes
2,597

In the output format of the query (inSQ01) check if its set to SAP List viewer. set it if not set. then this below query works.

submit aqzzzdmscm======zdm_po======== using selection-set 'V1' EXPORTING

LIST TO MEMORY  AND RETURN.

DATA list_tab TYPE TABLE OF abaplist.


CALL FUNCTION 'LIST_FROM_MEMORY'

                         TABLES     listobject = list_tab  

                        EXCEPTIONS     not_found  = 1

                                                     OTHERS     = 2.

IF sy-subrc = 0.

      CALL FUNCTION 'WRITE_LIST'     TABLES       listobject = list_tab.

ENDIF.

Read only

0 Likes
2,596

unfortunately this SQ01 is checked as  - SAP List Viewer,

is there any work around to help me on this? Generally I need the data from SQ01, and downloaded it to SAP folder.

Thanks.

Read only

0 Likes
2,596

Try LIST_TO_ASCI instead of write_list.

SUBMIT ztestaks1 WITH s_matnr IN s_matnr EXPORTING LIST TO MEMORY

  AND RETURN.

  CALL FUNCTION 'LIST_FROM_MEMORY'

       TABLES

            listobject = t_listobject

       EXCEPTIONS

            not_found  = 1

            OTHERS     = 2.

  IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ELSE.

    CALL FUNCTION 'LIST_TO_ASCI'

*     EXPORTING

*       LIST_INDEX               = -1

*       WITH_LINE_BREAK          = ' '

      TABLES

        listasci                 = t_ascilist

        listobject               = t_listobject

      EXCEPTIONS

        empty_list               = 1

        list_index_invalid       = 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.

    ELSE.

      WRITE:/ 'Below are the lines from the submitted program.'.

      LOOP AT t_ascilist.

        WRITE:/ t_ascilist-line.

      ENDLOOP.

      SKIP 2.

    ENDIF.

  ENDIF.

 

http://scn.sap.com/thread/39352

Read only

0 Likes
2,596

i think this one is not working also, data downloaded with unreadable value.

Read only

0 Likes
2,596

Don't you get a button "EXPAND" next to SAP List viewer radio button?

Read only

JurijsP
Explorer
0 Likes
2,596

Hi Badz,

Have you solved the issue? Can you please share if yes.

I have same problem (can't get results when submitting to query generated report)

Thank you!