cancel
Showing results for 
Search instead for 
Did you mean: 

cl_wd_runtime_services=>attach_file_to_response

PankajVPatil
Participant
0 Kudos

Hi,

I am using cl_wd_runtime_services=>attach_file_to_response method to download a tab delimited text file. Whenever a call to the method occurs, it runs into 'NULL' object reference error and points to the first statement within the method i.e. wdr_task=>client_window->client->attach_file_to_response.

The code snippet is as follows:


data: itstring TYPE string,
      itxstring TYPE xstring.
itstring = 'test run'.

  CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
     text           = itstring
   IMPORTING
     BUFFER         = itxstring.

CALL METHOD cl_wd_runtime_services=>attach_file_to_response
  EXPORTING
    i_filename      = 'C:\temp\FILE01.txt'
    i_content       = itxstring
    i_mime_type     = 'text/xml'.

What do I do to rectify the code and get the file downloaded?

Best Regards,

Pankaj

Accepted Solutions (0)

Answers (1)

Answers (1)

nabheetscn
Active Contributor
0 Kudos

I think you need topass MIME type correctly in CAPS.

Nabheet

PankajVPatil
Participant
0 Kudos

Hi Nabheet,

I changed case of MIME type and get the same error. I guess the problem is with the reference semantics of data objects.

Thanks,

Pankaj

PankajVPatil
Participant
0 Kudos

Hello,

Any idea on why the "NULL object reference" run time error should occur.

Open to all possible suggestions.

Best Regards,

Pankaj.

Former Member
0 Kudos

Hi SAP EXPERTS,

                              I am using the following code to download a file. Its downloading file to downloads folder by default.My requirement is to download a file to a specified folder without prompting a popup that is directly to a folder. can u tell me is there any other approach other than the below code,Its urgent please help me.Thanks in advance.

data: itstring TYPE string,

        itxstring TYPE xstring.

        itstring = 'test run'.

   CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

     EXPORTING

      text           = itstring

    IMPORTING

      BUFFER         = itxstring.

CALL METHOD cl_wd_runtime_services=>attach_file_to_response

   EXPORTING

     i_filename      = 'C:\Shipping\FILE01.txt'

     i_content       = itxstring

     i_mime_type     = 'text/xml'.

Thanks,

Manoj

Message was edited by: manojramkumar d