Application Development 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: 

ABAP Query SQ01 - get the data using SUBMIT.

Former Member
0 Kudos

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

former_member184569
Active Contributor
0 Kudos

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.

6 REPLIES 6

former_member184569
Active Contributor
0 Kudos

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.

0 Kudos

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.

0 Kudos

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

0 Kudos

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

0 Kudos

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

JurijsP
Explorer
0 Kudos

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!