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

FUNCTION MODULE that downloads list report

Is there a Function Module that downloads list report to a '.txt' file to its server? I would like to run it in background so it would download the list report on the server. thanx in advance guys..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Nov 21, 2005 at 09:09 AM

    Hi Ferdino,

    You can do it this way :

    You call the report whose list you want, in another program, exporting list to memory.

    Then get that list and write it to file.

    *****************************************************

    DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.

    DATA : BEGIN OF list_asc OCCURS 0,

    msg(300) TYPE c,

    END OF list_asc.

    DATA : wa_c_filename(30) TYPE c.

    wa_c_filename = '/data/ftp/out/rep.txt'.

    SUBMIT pgm_xyz EXPORTING LIST TO MEMORY

    AND RETURN.

    CALL FUNCTION 'LIST_FROM_MEMORY'

    TABLES

    listobject = list

    EXCEPTIONS

    not_found = 1.

    CALL FUNCTION 'LIST_TO_ASCI'

    • EXPORTING

    • LIST_INDEX = -1 "LIST_INDEX SY-LSIND.

    TABLES

    listasci = list_asc

    listobject = list.

    OPEN DATASET wa_c_filename FOR OUTPUT in text mode.

    IF sy-subrc NE 0.

    WRITE : / 'The file could not be created'.

    ELSE.

    LOOP AT list_asc.

    TRANSFER list_asc TO wa_c_filename.

    ENDLOOP.

    CLOSE DATASET wa_c_filename.

    ENDIF.

    ***************************************************

    The list contents will be in the file in the server, filename and file path as specified in wa_c_filename.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      A <b>very informative</b> code Susmitha Thomas.!

      My problem is that I can't 'SUBMIT' my report program because it also has a download functionality. I already have my spool request, my only problem is how to get it and download it to a text file.

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2005 at 09:26 AM

    Hi,

    To schedule the program in background job, write the data in application sever file.

    OPEN DATASET l_ofile FOR OUTPUT IN TEXT MODE MESSAGE l_msg.

    LOOP AT i_data

    TRANSFER i_dataTO l_ofile.

    ENDLOOP.

    CLOSE DATASET l_ofile

    Check these links for more infor on file download.

    http://www.sapdevelopment.co.uk/file/file_updown.htm

    Best Regards,

    Anjali

    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.