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: 

Using GUI_DOWNLOAD Function module in Batch

Former Member
0 Kudos

Hi All,

I use the subject function module to load the data into a .xls file. I find no error while I run my program directly. But when I run it in Background it throws an unknown_error. Tried to debug, while in background (by introducing a infinite loop and releasing from the loop with the exit condition). I couldn't get into the function module to debug.

Needed information on how else can I find what the error is and is there any other function module (other than ws_download and gui_download) which I could use and find no errors while running in background.

Thanks,

Aaron.

-


This is what I am doing:

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

if sy-subrc = 0.

Loop at te070 into se070.

Transfer se070 to p_file.

Endloop.

endif.

close dataset p_file.

This creates a file in the app server in Batch and I will have to run a program online to dowload the contents from the server. My requirement is that I need to download the contents in Batch to my local file. Is this possible by any means? (Can we create a windows executable file (.EXE) and use it in a windows batch file (.BAT)?)

Message was edited by: Aaron Anthony

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

That fm can't work in background

Max

10 REPLIES 10

Former Member
0 Kudos

Hi

That fm can't work in background

Max

Former Member
0 Kudos

GUI_DOWNLOAD Function module can't be used in Background. When the program is executed in background, store all the data in Application server, write a sample program to take that data from application server and writes to presentation server and execute that program online.

Regards,

Prakash.

former_member181962
Active Contributor
0 Kudos

gui_download cannot work in background.

There is a tedious workaround which may help you.

But just think if it is worth the effort.

This link has the workaround:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c...

Regards,

Ravi

Former Member
0 Kudos

Hi Max/Prakash,

Is there not a way where I could realize this in background process (move data to a .xls file)?

Thanks,

Aaron.

0 Kudos

Hi

U can only download the file in a path of application server and then move that file from application to your pc or other destination of presentation server.

If your file has a simple structure, you can download a file in CSV format.

Max

Former Member
0 Kudos

GUI_DOWNLOAD doesnt work in background mode.

If you want to do transfer in background mode, u need to transfer that file to application server and then read from there by transfering it to presentation server.

ABAP/4 provides following statements for handling files on application server:

OPEN DATASET

CLOSE DATASET

DELETE DATASET

READ DATASET

TRANSFER

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

0 Kudos

Hi Vibha,

OPEN DATASET

CLOSE DATASET

DELETE DATASET

READ DATASET

TRANSFER

Helps me write in the application server. I will have to write an online program to download its contents locally. Is there any way where I can download locally using Batch? (Is it possible for me to create an (windows) .exe file for my ABAP program? and then run this using the .BAT file?)

Thanks for your help.

0 Kudos
  • Open Dataset

catch system-exceptions DATASET_CANT_OPEN = 8.

open dataset UNIX_FILE for output in text mode encoding default.

endcatch.

  • Write to Dataset

loop at IT_STR into IS_STR.

catch system-exceptions DATASET_NOT_OPEN = 0 .

transfer IS_STR-STR to UNIX_FILE.

endcatch.

endloop.

if SY-SUBRC eq 0.

message S138(ZSM) with 'Data Downloaded to Unix File'.

endif.

  • Close Dataset

close dataset UNIX_FILE.

Regards

- Gopi

0 Kudos

Hi Gopi,

This is what I am doing:

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

if sy-subrc = 0.

Loop at te070 into se070.

Transfer se070 to p_file.

Endloop.

endif.

close dataset p_file.

This creates a file in the app server in Batch and I will have to run a program online to dowload the contents from the server. My requirement is that I need to download the contents in Batch to my local file. Is this possible by any means? (Can we create a windows executable file?)

Thanks for your help.

0 Kudos

I think it can be done, but shud be a part of the BASIS team. Talk to ur basis people, might help u or give in some inputs.

Regards

- Gopi