GUI_UPLOAD in Background

Hello,
I am trying to upload data from the Presentation Server to the SAP System using the FM 'GUI_UPLOAD'. But the program that calls this is to run in the background, so it fails in this case, therefore could you kindly suggest me an alternative for this FM or any other method!
Quick Reply Much Appreciated
Points will be rewarded for correct answers.
Regards,
Bharath

Hello Bharath,
Let me first explain to you the concept. When u call the program in background mode then the program is getting executed on the server and the connection to your presentation server/desktop is not available so the program doesn't understand where to dump the file or on which presentation server the file needs to be downloaded. When u are executing the program in foreground then the connection to the desktop is avaialble and the program even though running on the server can still download the file. So coming to you problem either u have to use GUI_DOWNLOAD with foreground execution or if you need to execute it in background you have to use OPEN dataset.

Similar Messages

  • GUI_UPLOAD in Background jobs

    Hi,
    I have a requirement where in the a text file is received from an external application at the end of each day. This text file has to be picked up by the SAP system and SAP transaction MFBF has to be updated. The customer wants this entire process to be done without any user intervention. A background job needs to be scheduled at the end of the day. However the problem is GUI_UPLOAD cannot be used to pick up the text file, because of the Background job. Any suggestions are welcome.

    You cant use GUI UPLOAD or DOWNLOAD function in backgroun jıb.
    U can use DATASETS
    DATA:
      dsn(20) VALUE '/usr/test.dat',
      rec(80).
    OPEN DATASET dsn.
    IF sy-subrc = 0.
      DO.
        READ DATASET dsn INTO rec.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
          WRITE / rec.
        ENDIF.
      ENDDO.
    ENDIF.
    CLOSE DATASET dsn.
    ibrahim

  • Control_flush_error with GUI_DOWNLOAD in Background mode

    Hi Friends
    When I have executed the FM: GUI_DOWNLOAD in Background mode,
    I am getting the error: Control_flush_error .
    Can anyone please let me know Is we can use the FM: GUI_DOWNLOAD & GUI_UPLOAD in Background mode?
    If not can anyone please provide me the relevant SAP(OSS) Note.
    Points are assured for useful answers.
    Thanks
    Regards,
    Sree

    Hi,
      No you can't do that, the GUI_DOWNLOAD method of the class CL_GUI_FRONTEND_SERVICES, and the function module GUI_DOWNLOAD are dependent on the gui. You can not use these in the background. You must download to the application server, using the dataset statements.
    OPEN DATASET
    TRANSFER
    CLOSE DATASET
    Regards
    Kiran Sure

  • Hi.Background Job

    Hi Guru's,
    I having problem while uploading pricing conditions data.i want to upload more than 10000 thousand records.
    in selection screen,we are provinding file path (Presentation server) and using  fm "gui_upload" updating the content into internal table and updating pricing document using fm "RV_CONDITION_COPY".
    My question is.
    while upadting more than 10000 round records im getting time out dump error so im trying to execute this program using background job but im getting error like "Cannot perform frontend function in batch input mode".
    Anybody help me on this issue.
    Regards
    P.Senthil Kumar

    Hi,
    Its not possible to use GUI_UPLOAD in background mode as the SAP system is completely independent and wont allow any GUI based operations. You can try transfering the file to application server and then try running the report as a background job.
    Regards,
    Vik

  • Hi bulk order background job

    Hi,
    Can u tell me what the issues can i rise to client while i prepare the functional spec.
    Issue:
    In SAP Standard the bulk process orders must be confirmed before the goods issue posting.
    The XXXXX process requires that at first the goods issue posting will be done and after that the bulk process order will be confirmed with the correct dispatch quantity.
    Now we need a job/program that selects the bulk deliveries with goods issue and confirm the adapted process orders.
    At deliveries with reference to a sales order one can find the process order number in the sales order.
    At deliveries with reference to a stock transfer purchase order there is no link to a bulk process order in the system.
    Now the job on the P42 finds the right process order on the basis of material and batch number.
    Pl help as early as u can
    Thanks in advance
    Message was edited by:
            satish satish
    Message was edited by:
            satish satish

    Hi,
    Its not possible to use GUI_UPLOAD in background mode as the SAP system is completely independent and wont allow any GUI based operations. You can try transfering the file to application server and then try running the report as a background job.
    Regards,
    Vik

  • GUI_UPLOAD to upload flat file to internal table

    Hi Experts,
    I have to upload a flat file which has multiple records ,from a local server.The fields in records are ~ saperated.
    Presently i am only looking into uploading the flat file into internal table.
    I have done the following coding;
    TYPES: BEGIN OF gt_frmgt ,
           tablety  type c length 10 ,
           tablenm  type c length 30,
           numin  type  c length 2,
           END OF gt_frmgt.
    TYPES: begin of gt_frmgto,
             rec(1000) type c,
            end of gt_frmgto.
    DATA: Itgt_frmgt type table of gt_frmgt with header line.
    DATA: itgt_frmgto type table of gt_frmgto with header line.
    DATA: lfile_path type string.
    PARAMETERS: f_path type localfile.
    at selection-screen on value-request for f_path.
      call function 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static    = 'X'
        CHANGING
          file_name = f_path.
    start-of-selection.
      lfile_path = f_path.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = lfile_path
          FILETYPE                      = 'ASC'
         HAS_FIELD_SEPARATOR           = 'X'
        HEADER_LENGTH                 = 0
        READ_BY_LINE                  = 'X'
        DAT_MODE                      = ' '
        CODEPAGE                      = ' '
        IGNORE_CERR                   = ABAP_TRUE
        REPLACEMENT                   = '#'
        CHECK_BOM                     = ' '
        VIRUS_SCAN_PROFILE            =
        NO_AUTH_CHECK                 = ' '
      IMPORTING
        FILELENGTH                    =
        HEADER                        =
        TABLES
          DATA_TAB                      =  itgt_frmgto
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_READ_ERROR               = 2
        NO_BATCH                      = 3
        GUI_REFUSE_FILETRANSFER       = 4
        INVALID_TYPE                  = 5
        NO_AUTHORITY                  = 6
        UNKNOWN_ERROR                 = 7
        BAD_DATA_FORMAT               = 8
        HEADER_NOT_ALLOWED            = 9
        SEPARATOR_NOT_ALLOWED         = 10
        HEADER_TOO_LONG               = 11
        UNKNOWN_DP_ERROR              = 12
        ACCESS_DENIED                 = 13
        DP_OUT_OF_MEMORY              = 14
        DISK_FULL                     = 15
        DP_TIMEOUT                    = 16
        OTHERS                        = 17
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      delete itgt_frmgto index 1.
      loop at itgt_frmgto.
        clear Itgt_frmgt.
        split itgt_frmgto-rec at cl_abap_char_utilities=>vertical_tab
        into Itgt_frmgt-tablety
        Itgt_frmgt-tablenm
        Itgt_frmgt-numin.
        append Itgt_frmgt.
      endloop.
      loop at Itgt_frmgt.
        write:/ Itgt_frmgt-tablety, Itgt_frmgt-tablenm, Itgt_frmgt-numin.
    The input file in Local path is ;
    XXXXXXX~~Export the invoice
    2~19980501~19980531
    // The first invoice:
    0~00130698114000010004119980512059611000276233.350.1711076.66????321000789010005???????????????????130601000000000??????????18? 3352051????532611-3357211???~~~
    0~????????176233.350.1711076.6676233.350~1510
    // The second invoice:
    0~00130698114000010007219980512059611000440482.000.175882.00????110108078901007?????????61? 68744479?????????????462088-07?????130601000000000??????????18? 3352051????532611-3357211???????????~~~
    0~????????139780.000.175780.0039780.000~1510
    0~????3.5"10702.000.17102.0070.20~1510
    and the output is :
    XXXXXXX~~
    2~~1998050
    // The fir
    0~00~1
    0~????~?
    // The sec
    0~00~1
    0~????~?
    0~????
    I am unable to understand why this split is happening .According to me the first 3 fields should be displayed without field saperater.
    It would be very much appreciated if any body has little idea about this.
    Thankx,
    Priya
    Message was edited by:
            Priya Parmeshwar Shiggaon
    Message was edited by:
            Priya Parmeshwar Shiggaon

    if it is one time upload then u can use transaction CG3Z n upload file on application server.
    u can tno use Gui_upload in background.
    Program to upload file via gui_upload in foreground  -(open fiel in Excel format and then make changes and save it as text tab file and upload tht file) -
    REPORT  Z_AMIT_BAPI
    no standard page heading line-size 255.
    parameters: p_file like rlgrap-filename default 'C:\temp\emp.txt'.
    data :begin of itab occurs 0,
             pernr(8),
             bdate(10),
             edate(10),
             mail(30) ,
            end of itab.
    Start-of-selection.
    Perform read_file.
    *&      Form  read_file
          text
    -->  p1        text
    <--  p2        text
    FORM read_file .
    DATA: full_file_name    TYPE string.
    full_file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = full_file_name
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = ','
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = itab
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
      MESSAGE e000(000) WITH 'Upload-Error; RC:' sy-subrc.
    ENDIF.
    ENDFORM.                    " read_file
    reward points if helpfull
    amit

  • Function like GUI_UPLOAD/GUI_DOWNLOAD for background

    Is there a function or functions that work the same way as GUI_UPLOAD and GUI_DOWNLOAD but can be run both in the foreground and background?

    GUI_UPLOAD and GUI_DOWNLOAD can only work in the foreground.  The reason for this is that they use some code which reside on the frontend PC.  A background process knows nothing of the PC connected thru SAPgui. In order to "download" data to files, you must write the files to the application layer using OPEN DATASET, TRANSFER DATASET, CLOSE DATASET.
    Regards,
    Rich Heilman

  • Error in background on GUI_UPLOAD.

    Hi,
    If i run a report in background which contains the function module : GUI_UPLOAD it is getting the error message as 'Error uploading C:\Documents and Settings\...' .
    do the gui_upload wont execute in background?.
    Please suggest.
    Usefull anwers will be rewarded.
    Neslin.

    Hi
      The GUI Upload and GUI download FMs are used only when the program is executed in the foreground only.
       If we have to use the GUI download in the background u have to first create a program such that the file from the presentation server is trannsferred to the application server through the help of the dataset statements.
      Then on onwards your program would be executed in the background succesfully.
    Regards
    Rajesh.

  • Can't we use GUI_UPLOAD and scshedule in background

    Hi,
    I have a program which uploads a comma delimted text file and updates custom table.
    .It works fine in when I run online but when I schedule it background it fails.
    I used GUI_UPLOAD to upload the text file.
    FORM file_upload.
      CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
      filename = file
    * FILETYPE = 'ASC
    * has_field_separator = ','   <-- Comment this
    * HEADER_LENGTH = 1
    * READ_BY_LINE = 'X'
    * IMPORTING
    * FILELENGTH =
    * HEADER = 'X'
      TABLES
      data_tab = i_datatab
      EXCEPTIONS
      file_open_error = 1
      file_read_error = 2
      no_batch = 3
      gui_refuse_filetransfer = 4
      invalid_type = 5
      no_authority = 6
      unknown_error = 7
      bad_data_format = 8
      header_not_allowed = 9
      separator_not_allowed = 10
      header_too_long = 11
      unknown_dp_error = 12
      access_denied = 13
      dp_out_of_memory = 14
      disk_full = 15
      dp_timeout = 16.
      LOOP AT i_datatab INTO x_datatab .
        IF sy-tabix GT '1'.
          SPLIT x_datatab-line AT ',' INTO wa_tab-zdate
        wa_tab-empid wa_tab-lname wa_tab-fname wa_tab-cycle wa_tab-branch
        wa_tab-job wa_tab-phase wa_tab-pdept wa_tab-ptype wa_tab-zhour .
          APPEND wa_tab TO i_tab.
        ENDIF.
      ENDLOOP.

    fm GUI_UPLOAD will not work in background
    you need to use
    lv_filename = <input file path> " app server path
    open dataset lv_filename for input in text mode encoding default.
        if sy-subrc = 0.
          do.
            read dataset lv_filename into gs_input-wa_string.
            if sy-subrc eq 0.
              append gs_input to gt_input.
            else.
              exit.
            endif.
          enddo.
          close dataset lv_filename.
        endif.

  • How to schedule BDC program in background when we use GUI_UPLOAD

    Hi,
    I need to run the BDC program in the back ground. But my flat file is in presentation server and i am using GUI_UPLOAD F.M to upload data into I.T. How to schedule BDC program in background.
    Will anybody help me in this regards.
    Thanks in advance,
    Mythily

    You will either have to put your data file on the application server or make the directory of the presentation server available as part of the file system so that the background job will have access to it via OPEN DATASET... TRANSFER... CLOSE DATASET.

  • Problem in Submiting Background Job

    Hi,
    I am submitting a Program in Background  by using JOB_OPEN and SUBMIT Program and JOB_CLOSE.
    After submiting Job was terminated with following log.
    04/07/2009 11:34:05 Job started                                                                                00           516          S
    04/07/2009 11:34:05 Step 001 started (program YSDU_CUSTOMER_DUP_CHECK, variant &0000000000002, user ID JAGASEK)      00           550          S
    04/07/2009 11:34:05 Cannot perform frontend function in batch input mode                                             FES          002          E
    04/07/2009 11:34:05 Job cancelled after system exception ERROR_MESSAGE                                               00           564          A
    Please help me.
    Thanks,
    Sekhar.J

    Hi sekhar J,
    It looks to me like you may be calling a function from SFES (SAP FrontEnd Services) e.g. FM GUI_UPLOAD, these cannot be used in background mode for obvious reasons.  If the program is reading/writing a local file you will need to use a dataset on the application server instead.  If ths is the case there are plenty of posts cocerning datasets on sdn.
    Regards,
    Simon

  • How to avoid use of function module in case of background jobs?

    Hi ,
           I am working a file tranfer interface .Functionality is to extract file either apllication or presentation server , and process the file  through bapi , send the  result in their respective server. This program should run through batch jobs in background mode.
    I am using following function module :
      SUBST_GET_FILE_LIS : Get the file list from application server
    TMP_GUI_DIRECTORY_LIST_FILES : Get the file list from presentation server
    GUI_UPLOad : to extract file data   from presentation server
    GUI_downLOAD : to download data  to presentation server
    in case of background job these function modules will not work.... so how to resolve this issue...
    what are the methods we can apply?
    Thanks & Regards
    Sandeep

    Hi,
    This FM is used to get list of files from Application server (will work in Background). This cannot be used to list files from presentation server.  There is no way , by which you can process presentation server files in background mode.
    Regards
    Vinod

  • Issue in Foreground Report executing as background

    I have developed a Report in ABAP which has a selection screen and 2 radiobuttons
    Foreground
    Background
    The report basically reads a TXT file from Desktop and calls a standard BAPI.
    In foreground, I have no issues i.e. I browse the call from desktop and call GUI_UPLOAD and so on
    However, in background, I am confused how to proceed??
    Please note: Report is still running in foreground mode i.e. i am browsing the file. Its just that i have selected background Radiobutton
    Can anyone tell me how to proceed i.e. to execute in background.
    Do I need to submit the same program via JOB_OPEN JOB_CLOSE in background and then exit??
    Please advice

    Hi Razdan,
    If want to schedule the background job through the program, then you can try method explained in below links. Here you might have to create a separate program to submit.
       https://help.sap.com/abapdocu_70/en/ABAPSUBMIT_VIA_JOB.htm
       http://scn.sap.com/thread/590077
      Another approach would be like below
    Add an additional field apart from the radio button, say “ip_file” in the selection screen. This you can show while selecting the radio button “background”
    Suppose if you have updated the file in app. Server(AL11 ) , in a location , say ( “home/myfile/test.txt” ) .
    Save a variant with the radio button “background” selected and input field ip_file value as   “home/myfile/test.txt”.
    Now from the SM36 you can schedule the background job to run the report with the same variant.
    Please note that , here you need to upload the file separately to app. Server using , tcode - CG3Z or any other FM. And in the program you can use open dataset to access the file in the app. Server.

  • Can we run in Background job which can pick a file from front end ?

    Hi All,
    I would like to run a report in Background job , for this i need to pick a file from front end services(Local drive or share folder)
    Is there any alternate FM=>GUI_UPLOAD  to upload data from front end services or any other solution for this?
    I am getting error=> "No batch" and " Cannot perform frontend function in batch input mode"
    Could you please help on this ?
    Thanks for your help in advance.
    Regards,
    Prasad.

    Hello Prasad,
    IF you keep your file on a shared folder on your front end, you can access it via OPEN DATASET if your application server has access to that path.
    You can test it out by asking Basis to try and access your front end file from the app server itself.

  • Dump when run in background

    Hi All,
    I have a z-report which displays a ALV report. when I run this in background it gets canceled. when i see the log , it has dump and dump is as shown below.
    A RAISE statement in the program "CL_GUI_CONTROL================CP" raised the exception condition "CNTL_ERROR".
    Since the exception was not intercepted by a superior
    program, processing was terminated.
    What could be the problem, suggest me a solution if i have to add some code into my program or is it an application error which can be solved by SAP Notes.
    Regards
    Divakar Goud,

    Are you using GUI_UPLOAD or GUI_DOWNLOAD in the report then they will not work there.
    Use OPEN DATASET instead to read or write.
    Also, check weather there is a Container for OO ALV on the Report then use Docking Containe when SY_BATCH = 'X'.
    If its an normal ALV then Change the GRID to LIST layout for Backgroud. Its not that we cannot display grid in background we can do that but we require some layout handling there.
    ALV Grid in background job?
    Regards,
    Amit
    Reward all helpful replies.

Maybe you are looking for