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: 

Report in background using cl_gui_frontend_services=>gui_download Method

Former Member
0 Kudos

Hello all,

I'm trying to run a report that uses the method cl_gui_frontend_services=>gui_download in background mode, to export data from an internal table to a xml file.

In foreground everything works fine, but when I try to run the report in background the execution stops when the method is called. Does anyone know how to avoid this problem and run the report in background mode?

Thanks in advance,

Nuno A.

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

HI Nuno,

Youcannot communicate with the presentation server in Background. The method cl_gui_frontend_services=>gui_download is one such method, which tries to download the data to the Presentation server.

If you still want to run your program in background, better download the data to Application server as aRs suggested and then move the file from application server to Presentation server using the Transaction CG3Y.

Regards,

Ravi

7 REPLIES 7

former_member194669
Active Contributor
0 Kudos

Hi,

For background processing you need to use syntax

OPEN DATASET


ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
  DO.
    CLEAR: wa_string, wa_uploadtxt.
    READ DATASET ld_file INTO wa_string.
    IF sy-subrc NE 0.
      EXIT.
    ELSE.
      SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                      wa_uploadtxt-name2
                                      wa_uploadtxt-age.
      MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
      APPEND wa_upload TO it_record.
    ENDIF.
  ENDDO.
  CLOSE DATASET ld_file.
ENDIF.

aRs

0 Kudos

The instruction OPEN DATASET doesn't allow me to read files from my local machine. I would like to read a write the xml from a folder in my local machine.

0 Kudos

IN order to make your program use OPEN dataset, the file must be on application server.

So, you can use the transaction CG3Z to move the file from your pc to application server and then use OPEN dataset and read dataset statements, so that you can run that program in background.

Regards,

Ravi

Pawan_Kesari
Active Contributor
0 Kudos

Method cl_gui_frontend_services=>gui_download is used to download data from Application server to Presentation Server... So it will work fine when you use it in foreground mode..

However in background execution presentation server is not in picture... so any method which work with presentation server will not execute correctly in background mode..

Former Member
0 Kudos

hi

good

check what kind of data you r calling in the background before calling that particular statement,and check the length of the report .

Thanks

mrutyun^

former_member181962
Active Contributor
0 Kudos

HI Nuno,

Youcannot communicate with the presentation server in Background. The method cl_gui_frontend_services=>gui_download is one such method, which tries to download the data to the Presentation server.

If you still want to run your program in background, better download the data to Application server as aRs suggested and then move the file from application server to Presentation server using the Transaction CG3Y.

Regards,

Ravi

former_member235056
Active Contributor
0 Kudos

Hi,

There's no way to use WS_DOWNLOAD / WS_UPLOAD / GUI_DOWNLOAD / GUI_UPLOAD nor any method of class CL_GUI_FRONTEND_SERVICES. Only "open dataset" & related can work.

Pls reward all helpful points.

Regards,

Ameet