Local file in background mode

Hi experts,
Is it possible to upload data from local drive(presentation server) to sap in background mode.
As I know ,in the background mode we can upload files from application server only.
but here my functional consultant saying they did  upload data from local drive to sap in background mode.
please suggest.
thanks in advance.
sastry.

hey,
Yes it can be made possible,
The only way to access files in a background job is to have them on the application server and opened via OPEN DATASET or similar.
*--Local Variables
DATA : l_file TYPE string,
l_line TYPE string,
l_index TYPE sy-tabix.
*--Clear
CLEAR : l_file.
l_file = p_ipfile.
*--Read the data from application server file.
OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
*--Error in opening file
MESSAGE i368(00) WITH text-005.
ENDIF.
*--Get all the records from the specified location.
DO.
READ DATASET l_file INTO l_line.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
INTO st_ipfile-vbeln
st_ipfile-posnr
st_ipfile-edatu
st_ipfile-wmeng.
APPEND st_ipfile TO it_ipfile.
ENDIF.
ENDDO.
Regards,
Midhun Abraham
Edited by: Midhun Abraham on Oct 8, 2008 4:36 AM

Similar Messages

  • Download an excel file in background mode

    Hi All,
    I need to download a file from a ABAP  report to the local workstation in background mode. I tried GUI_DOWNLOAD but it is failing in the background.
    Is there any way to download the excel file in the background. I am thinking of generating the spool.
    Please let me know if anybody has worked on the same requirement. Any help would be highly appreciated.
    Thanks a lot.
    Regards,
    Priti

    You be able to use the function "WS_DONLOAD" ?
    parameters: p_fnam like  rlgrap-filename memory id fnam obligatory.
    data: begin of t_registro occurs 0,
            registro(1000),
          end of t_registro.
          describe table t_registro lines sy-tfill.
          if sy-tfill gt 0.
            l_tam = strlen( p_fnam ).
            call function 'WS_DOWNLOAD'
                 exporting
                      filename                = p_fnam
                 tables
                      data_tab                = t_registro
                 exceptions
                      file_open_error
                      file_write_error
                      invalid_filesize
                      invalid_type
                      no_batch
                      unknown_error
                      invalid_table_width
                      gui_refuse_filetransfer
                      customer_error.
            if sy-subrc <> 0.
              open dataset p_fnam for output in text mode.
              if sy-subrc = 0.
                loop at t_registro.
                  transfer t_registro to p_fnam.
                endloop.
                close dataset p_fnam.
                write:/ 'Se genero el archivo:', p_fnam(l_tam).
              else.
                write:/ 'No se pudo generar el archivo:', p_fnam(l_tam).
              endif.
              close dataset p_fnam.
            else.
              write:/ 'Se genero el archivo:', p_fnam(l_tam).
            endif.
       endif.
    I hope this works for you.
    See ya.
    Ar@

  • Read local file in background

    hi everyone,
    i need to read local file in background,
    wich function do i need to use?
    thanks,
    dana.

    if you are reading in background file needs to be on application server.
    you can use following function modules.
    CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                          MESSAGE MSG_TXT.
    IF SY-SUBRC NE 0.
      WRITE: 'Err', MSG_TXT.
      EXIT.
    ENDIF.
    LOOP AT INT_TAB
    *your code
    ENDLOOP.
    Closing the File
    CLOSE DATASET FILENAME.

  • Exporting Local File in background

    Hi,
      I want to export a flat file in background mode. I am currently using WS_DOWNLOAD but this doesn't work in background. What I think is that I will save it in UNIX directory. Can you please give some sample codes for this? or if there's still a way using WS_DOWNLOAD to do this in background?
    I appreciate your response.
    Thanks!

    Use the transaction CG3Z to upload your file into application server.
    Then you can use
    open dataset.
    transfer dataset.
    close dataset.
    commands to access that file from application server.

  • Downloading file in Background mode?

    Hi gurus,
    When I run the program in Fore ground and Back ground (Immediately when press F9, without schedule) I am getting same result, I can able to download file in a local file. Please I like to know whether it is correct or not?
    If it is not correct, How to download the file into presentation server (Local file) when program run in back ground mode (Immediately when press F9, without schedule)?
    Please give your valuable suggestions. Please send the code if you have.
    Thanks and Regards,
    Pavan.

    Hi,
    you can not download file in a presentation server using your Background job. That is a limitation from SAP. Instead you can download file to presentation server. Or you can add mailing the file to user id functionality.
    Hope this helps.
    ashish

  • Update table form local file as background Job

    Hi Expert,
         I have a requirement to update a database table through Text file in a background. I am trying to do through OPEN Database to upload the file to Application server and then triggerind a event for background job. please provide method to update the table in background job.
    Regards,
    Kapil.

    hi,
    if i have understood you can try this:
    1) create a custom event with transaction SM62.
    2) schedule the update job ( with the update program in its step )  trigging the event set in (1) .
    3) execute the program that upload the local file from presentation server to application server  .  The last istruction of this program has to be the call ot the custom event using BP_event raise fn module in the uplaoad is ok..
    4) if the event has been raised, the background job has been executed.
    Regards, luigi.

  • Download  File in  Background mode

    Hi SAP Gurus,
    I want to download file in Background using fn mod GUI_DOWNLOAD , it raises an  execption 'CONTROL_FLUSH_ERROR'.
    Is there any other way to do so.?
    Thanks in advance.
    Gaurav

    Hello Gaurav,
    GUI/WS_DOWNLOAD require an active GUI and are therefore not useable in batch mode. OPEN DATASET is the statement of choice.
    There is a related thread which might be of interest to you.
    WS_DOWNLOAD in background?
    Kind Regards
    Klaus

  • How to download the application file to local file by back ground job?

    hi:
      can any one tell me how to download the application file to local file by back ground job? thanks in advance..
    Monson

    Hi,
    In order to download a file from application layer to a local file in background,
    first write a report(ZREPORT1) in which do the following steps:
    OPEN DATASET g_file_1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    loop the g_file and append all the data into another internal table.
    end of this report you shd have all the data in the application layer file into your internal table.
    Now create another report(ZREPORT2) and submit this report in background.
    that is,
    JOB_OPEN
    JOB_SUBMIT and
    JOB_CLOSE
    and in job_submit submit ZREPORT1 which downloads the file in application layer.
    Please reward points if helpful.
    Regards,
    Arul.

  • Accessing presentation server file in background

    Hi gurus,
    my requirement is to access presentation server file in background mode.
    I got the below documentation regarding this ,but i'm not able to complete the setup as mentioned in this document.
    please help .
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/communication%20to%20presentation%20server%20in%20background%20mode.doc]
    As per documentation i need rfc.car and car.exe file in my system. I cant see any rfcsdk folder in my system. Please help.
    any other solutions ,please suggest.
    sastry.
    Edited by: prssastry on Oct 15, 2008 7:13 AM

    Hi,
    In general practice we don't access a file from presentation server in background because at that point of time i might not logon to SAP server, so it is always preferable to access the file from Application layer incase of background processing.
    Unless it is a client requirement, don't access files from the presentation layer in background./
    thanks,
    Mahesh.

  • Create an Excel format file in background w/DATASET Cmds?

    I have heard that you can create a file into an excel format file in background mode using dataset commands - anyone know how to do this?  Thanks!

    Hi Stephen,
    Use Open dataset, Transfer, Close dataset to create file on Application server.
    Use FM Z_CONV_ITAB_TO_TAB_DELIMITED to convert your lines in TAB delimited format. you can download file from your application server to presentation server using T Code CG3Y and give extension as .xls ...
    As you data is Tab delimited it will automatically get formatted in columns in your EXCEL file.
    Regards,
    Mohaiyuddin

  • Is it possible  upload local file to internal table in background mode?

    Hi, all,
    Is it possbile to  upload local file(not server file) to internal table in background mode.
    If possbile ,please tell me detail . Thanks in advance.
    Regards,
    Lily

    Hello,
    This is possible.
    If you report has to be executed in background using schedule Job. Then the file path should be constant and it can be hard coded in the report itself while populationg the internal table.
    Then create a variant for your report and use that variant in the job.
    This will solve your problem I guess.
    Regards
    Arindam

  • How to store files in shared-folder in background mode

    Hello All,
    My requirement seems to be simple but I have tried many ways in achieving this, but failed. So require the help in accomplishing this task.
    Requirement
    I have to create a program in SE38 which will create a internal table with data in it in .XML format(which I can achieve).
    My requirement is this .XML file needs to be placed in a shared-folder in "BACKGROUND MODE".
    I have tried using GUI_DOWNLOAD function module, but this FM only runs in Foreground mode and fails in Background mode. I have tried convincing my client that I will keep the file in Application Server as it is achievable using OPEN DATASET statements, but they are not willing to accept this.
    So can you please help me in achieving this task as I am not getting any solution how to keep the file in Shared-folder in BACKGROUND mode itself(not Foreground).
    Best Regards,
    Tousif

    Hi Sanjeev,
    I have just used normal GUI_DOWNLOAD FM. Please find my sample code below
    CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
    *       BIN_FILESIZE                    =
           filename                        = 'D:\Users\baigtomx\Desktop\TOUSIF.XML'
    *       FILETYPE                        = 'ASC'
    *       APPEND                          = ' '
    *       WRITE_FIELD_SEPARATOR           = ' '
    *       HEADER                          = '00'
    *       TRUNC_TRAILING_BLANKS           = ' '
    *       WRITE_LF                        = 'X'
    *       COL_SELECT                      = ' '
    *       COL_SELECT_MASK                 = ' '
    *       DAT_MODE                        = ' '
    *       CONFIRM_OVERWRITE               = ' '
    *       NO_AUTH_CHECK                   = ' '
    *       CODEPAGE                        = ' '
    *       IGNORE_CERR                     = ABAP_TRUE
    *       REPLACEMENT                     = '#'
    *       WRITE_BOM                       = ' '
    *       TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *       WK1_N_FORMAT                    = ' '
    *       WK1_N_SIZE                      = ' '
    *       WK1_T_FORMAT                    = ' '
    *       WK1_T_SIZE                      = ' '
    *       WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *       SHOW_TRANSFER_STATUS            = ABAP_TRUE
    *       VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'
    *     IMPORTING
    *       FILELENGTH                      =
         TABLES
           data_tab                        = lt_wo
    *       FIELDNAMES                      =
    *     EXCEPTIONS
    *       FILE_WRITE_ERROR                = 1
    *       NO_BATCH                        = 2
    *       GUI_REFUSE_FILETRANSFER         = 3
    *       INVALID_TYPE                    = 4
    *       NO_AUTHORITY                    = 5
    *       UNKNOWN_ERROR                   = 6
    *       HEADER_NOT_ALLOWED              = 7
    *       SEPARATOR_NOT_ALLOWED           = 8
    *       FILESIZE_NOT_ALLOWED            = 9
    *       HEADER_TOO_LONG                 = 10
    *       DP_ERROR_CREATE                 = 11
    *       DP_ERROR_SEND                   = 12
    *       DP_ERROR_WRITE                  = 13
    *       UNKNOWN_DP_ERROR                = 14
    *       ACCESS_DENIED                   = 15
    *       DP_OUT_OF_MEMORY                = 16
    *       DISK_FULL                       = 17
    *       DP_TIMEOUT                      = 18
    *       FILE_NOT_FOUND                  = 19
    *       DATAPROVIDER_EXCEPTION          = 20
    *       CONTROL_FLUSH_ERROR             = 21
    *       OTHERS                          = 22
       IF sy-subrc <> 0.
    * Implement suitable error handling here
       ENDIF.
    When I run this program in foreground mode, the file gets saved(here in the above example I have just used my desktop path. but the actual requirement is to store file in shared-folder i-e Network Drive).
    But when i run the same program in background mode, No file is getting stored.
    Regards,

  • Read flat file form other than sapserver(not in sapser) in background mode

    Dear Friends,
    I want to upload data from flat file to sap in background mode.
    I know how to read file for application server in background mode, but my requirement is , i need to read the flat file data from other than sap server in backgound mode.
    please help me,
    Regards,
    prabhu

    hi
    you can do like this way.
    fist should get de directory file name.
      CALL FUNCTION 'RZL_READ_DIR_LOCAL'
        EXPORTING
          NAME           = FILE_PATH
        TABLES
          FILE_TBL       = I_FILES
        EXCEPTIONS
          ARGUMENT_ERROR = 1
          NOT_FOUND      = 2
          OTHERS         = 3.
      IF SY-SUBRC EQ 0.
        FILES_TAG = 1.
      ENDIF.
    second
       LOOP AT I_FILES.
    open datafilenaem.
    close datafilename.
    endloop.

  • File download in Background mode

    Hi All,
    A file need to be downloaded to the folder
    dc20\nt71data\jsox\" while execution in background mode.
    It is also mentioned that the file need not be sent to the application server.
    I am sure in background mode file couldn't be downloaded to the presentation server.
    Can you please predict where would be this folder and how to proceed?
    Thanks & Regards,
    Lakshmanan

    hi,
    Please check in AL11 transaction.Where you will find the list of folders in Application server.
    Regards,
    Shan

  • Uploading Excel File in SAP In Background Mode

    Dear All,
    We require to upload Excel File in SAP in Background Mode.
    Could anyone suggest me the Function Module for this?
    Or any other method..........please.
    Thanks in advance for ur kind help.
    Best Regards,
    Prasad

    hi check this..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2
    Download in Background
    http://sapabap.iespana.es/sap/info/rfcexec/rfcexec_e.htm
    Reward if find useful

Maybe you are looking for