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

How to download local variable data into a flat file(in to our desktop)from a program?

Former Member
0 Kudos
1,007

I have generated a random number and stored in a local variable LV_RAND. I have to download that local variable data (random number stored in LV_RAND) using GUI_DOWNLOAD in to a text file in to desktop. Pls help me.

Thanks in advance.

2 REPLIES 2
Read only

Astashonok
Participant
0 Kudos
564

Put any variable into internal table lt_datatab and use cl_gui_frontend_services for saving.

And read this.

DATA : l_fullpath TYPE string VALUE 'C:\file.txt',     
       l_path TYPE string.

APPEND VALUE ty_itab ( col = lv_rand ) TO lt_datatab.

CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING    
      filename          = l_fullpath     
    filetype             = 'ASC'   
   append                = 'X'
TABLES     
    data_tab             = lt_datatab
EXCEPTIONS       
    OTHERS               = 1.
Read only

Matt_Fraser
Active Contributor
564

Hi Sravana,

Please note that I have changed the tags on your question. The tags you chose, SAP Cloud Platform, ABAP environment and SAP NetWeaver Application Server for ABAP, are not related to development; they are about the application server platform (or cloud platform).

Regards,
Matt Fraser
SAP Community Moderator