FM: GUI_UPLOAD AND F4_HELP

i am using parameter to enter file name to be upload.i want to use f4 and gui_upload how can i do this.
regards
nilesh

here is the complete code.
(search the forum, this has been disucussed many times before)
data: wf_filetab type filetable .
data: wf_filerc type i ,
      wf_filename type string .
parameters: p_file like file_table-filename lower case  visible length 80  .
at selection-screen on value-request for p_file .
  perform browse_file changing p_file .
start-of-selection .
move: p_file to wf_filename .
  perform load_file using wf_filename .
form load_file  using    p_wf_filename.
  clear int_tab1 .
  refresh int_tab1 .
  call function 'GUI_UPLOAD'
    exporting
      filename                      = p_wf_filename
      filetype                      = 'ASC'
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
    tables
      data_tab                      = int_tab1
   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 e398(00) with 'File may be open - Error loading' .
  endif.
endform.                    " load_file
form browse_file  changing p_p_file.
  clear wf_filename .
  call method cl_gui_frontend_services=>file_open_dialog
    exporting
      window_title            = 'Select the File'
*    DEFAULT_EXTENSION       = cl_gui_frontend_services=>FILETYPE_TEXT
*    DEFAULT_FILENAME        =
*     FILE_FILTER             = cl_gui_frontend_services=>FILETYPE_EXCEL
*    INITIAL_DIRECTORY       =
*    MULTISELECTION          =
    changing
      file_table              = wf_filetab
      rc                      = wf_filerc
*    USER_ACTION             =
    exceptions
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      others                  = 5
  if sy-subrc <> 0.
    message e398(00) with 'Error Opening File' .
  else .
    read table wf_filetab index 1 into p_file .
  endif.
endform.                    " browse_file
Regards
Raja

Similar Messages

  • Difference between GUI_UPLOAD and WS_UPLOAD

    Hi,
    Please make me clear about the difference between GUI_UPLOAD and WS_UPLOAD. In which cases we need to use these modules...??
    Thanks,
    Satish

    I would suggest to always use the GUI_UPLOAD.  I say this because this is the function module which is used in the GUI_UPLOAD method of the class CL_GUI_FRONTEND_SERVICES.   Really, you should probably use the class/method instead of the function module.
      data: filename type string.
      filename = p_file.
      call method cl_gui_frontend_services=>gui_upload
             exporting
                  filename                = filename
                  filetype                = 'ASC'
             changing
                  data_tab                = iflatf
             exceptions
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  no_authority            = 6
                  unknown_error           = 7
                  bad_data_format         = 8
                  unknown_dp_error        = 12
                  access_denied           = 13
                  others                  = 17.
    Regards,
    Rich Heilman

  • About UPLOAD, GUI_UPLOAD and WS_UPLOAD

    Hello Experts,
             What is the difference between UPLOAD, GUI_UPLOAD and WS_UPLOAD function modules. Please send me brief answer about this on following mail id
    "[email protected]"
    Reward for useful answer
    Thanx and regards,
    Rahul Talele

    I would suggest to always use the GUI_UPLOAD.  I say this because this is the function module which is used in the GUI_UPLOAD method of the class CL_GUI_FRONTEND_SERVICES.   Really, you should probably use the class/method instead of the function module.
      data: filename type string.
      filename = p_file.
      call method cl_gui_frontend_services=>gui_upload
             exporting
                  filename                = filename
                  filetype                = 'ASC'
             changing
                  data_tab                = iflatf
             exceptions
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  no_authority            = 6
                  unknown_error           = 7
                  bad_data_format         = 8
                  unknown_dp_error        = 12
                  access_denied           = 13
                  others                  = 17.
    Regards,
    Rich Heilman

  • Gui_upload and  ws_upload

    hi friends,
    i have a small doubt i just want to know the difference betweeen
    GUI_UPLOAD and WS_UPLOAD which one i have to use.
    which function module is useful and  most preferred.
    regards
    srinivas

    WS_UPLOAD and WS_DOWNLOAD, the function modules used until now are not part of the standard set of ABAP commands. They are used to display the file interface on the presentation server. WS_UPLOAD and WS_DOWNLOAD are not compatible with USs and have been replaced by GUI_UPLOAD and GUI_DOWNLOAD.
    The new function modules, GUI_UPLOAD and GUI_DOWNLOAD, have an interface that also allows you to write Unicode format to the local hard drive. For a description of these interfaces, refer to the documentation for each function module, available under SAP Easy Access " Development " Function Builder " Goto " Documentation.

  • Difference of gui_upload and upload

    difference of <b>gui_upload</b> and <b>upload</b> and <b>ws_upload</b>

    hi
    good
    There is no difference from functionality point of view.
    But when the new versions of SAP comes into picture certain objects(fun modules,tables,fields etc) will become Obsolete and the new Objects will come into picture in the place of Obsolete Fun modules and other objects
    So GUI_Upload and GUI_DOWNLOAD are the newversion of function modules which are the replacement for the UPLOAD and DOWNLOAD fun modules
    So we should use the New one.
    So it depends on the SAP Version on which you are working
    If you are still working in the Older versions of SAP like 4.0 like thing then you can use the DOWNLOAD and UPLOAD.
    But if you are working on the latest versions like ECC5.0 and ECC6.0 you have to use GUI_download and GUI_UPLOAD fun modules only
    reward point if helpful.
    thanks
    mrutyun^

  • Purpose each of these is: Gui_upload and upload

    Hi Friends,
    Kindly let me know what the Exact Purpose each of these is: Gui_upload and upload
    What is the difference between those two?
    Akshitha.

    Hi,
    UPLOAD fm is the old function module which is now obsolete. From 4.6C onwards SAP has delivered new FM's for uploading and that is GUI_UPLOAD.
    the diff is  UPLOAD pops up a box during runtime to accept the file path the GUI_UPLOAD does not pop up any box during runtime instead takes the path as a paramter.
    This is what SAP HELP SAYS
    Files on the Presentation Server
    WS_UPLOAD and WS_DOWNLOAD, the function modules used until now are not part of the standard set of ABAP commands. They are used to display the file interface on the presentation server. WS_UPLOAD and WS_DOWNLOAD are not compatible with USs and have been replaced by GUI_UPLOAD and GUI_DOWNLOAD.
    The new function modules, GUI_UPLOAD and GUI_DOWNLOAD, have an interface that also allows you to write Unicode format to the local hard drive. For a description of these interfaces, refer to the documentation for each function module, available under SAP Easy Access " Development " Function Builder " Goto " Documentation.
    Instead of using the function modules, you can use the static methods GUI_UPLOAD and GUI_DOWNLOAD of the global class CL_GUI_FRONTEND_SERVICES.
    Cheers
    VJ
    Message was edited by:
            Vijayendra  Rao

  • FM GUI_UPLOAD and GUI_DOWNLOAD.

    Hi,
        I am new to ABAP world.I hve been given a task to use FM GUI_UPLOAD and GUI_DOWNLOAD.Plz tell me what these functions do , i mean what's there purpose and how to use them in abap code.Plz provide some easy code so that i can understand them properly.
    Points will be rewarded for useful answeres.
    Thanks.

    Hi Amardeep,
    FM GUI_UPLOAD is used for uploading the file and GUI_DOWNLOAD is used fot downloading the file. For using these FM you need to first create internal table of all fields with character type. While downloading the file, file will be created in exact format of that of internal table and while uploading the file, you need to created the internal table with same structure as that of the original file.
    eg:
    DATA: BEGIN OF T_DATA OCCURS 0,
            SERIAL_NO(18)     TYPE C,
            COMP1(18)         TYPE C,
            COMP2(18)         TYPE C,
            MOTOR1(18)        TYPE C,
            MOTOR2(18)        TYPE C,
            CONTROLLER_NO(18) TYPE C,
            REF_NO(18)        TYPE C,
            BODY_NO(18)       TYPE C,
            PLANT(4)          TYPE C,
            PROD_VERSION(4)   TYPE C,
            PROD_DATE(8)      TYPE C,
          END   OF T_DATA.
    DATA: BEGIN OF T_ERR_DOWNLOAD OCCURS 0.
            INCLUDE STRUCTURE T_DATA.
    DATA:   MSG(60) TYPE C.
    DATA: END   OF T_ERR_DOWNLOAD.
    SELECTION-SCREEN BEGIN OF BLOCK BK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS: P_FLNM   LIKE RLGRAP-FILENAME OBLIGATORY MEMORY ID M1.
    SELECTION-SCREEN END   OF BLOCK BK1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FLNM.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
        IMPORTING
          FILE_NAME     = P_FLNM.
    START-OF-SELECTION.
      PERFORM UPLOAD_FILE.
    PERFORM PREPARE_ITAB.
      PERFORM DISP_ERROR.
    *&      Form  UPLOAD_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM UPLOAD_FILE .
      L_FLNM = P_FLNM.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = L_FLNM
          FILETYPE                = 'ASC'
          HAS_FIELD_SEPARATOR     = 'X'
          HEADER_LENGTH           = 0
          READ_BY_LINE            = 'X'
        TABLES
          DATA_TAB                = T_DATA
        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.
    ENDFORM.                    " UPLOAD_FILE
    *&      Form  DISP_ERROR
          text
    -->  p1        text
    <--  p2        text
    FORM DISP_ERROR .
      DATA: L_CNT     TYPE N.
      CLEAR: L_FLNM, L_CNT.
      IF NOT T_ERROR[] IS INITIAL.
        CONCATENATE 'C:\Barcode\' SY-DATUM '_' SY-UZEIT '.xls' INTO L_FLNM.
        DESCRIBE TABLE T_ERROR LINES L_CNT.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
          EXPORTING
            INPUT         = L_CNT
          IMPORTING
            OUTPUT        = L_CNT.
        WRITE:/ 'Error occured in ', L_CNT, ' Records'.
        SKIP.
        WRITE:/ 'Error file:', L_FLNM.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
          BIN_FILESIZE                    =
            FILENAME                        = L_FLNM
           FILETYPE                        = 'ASC'
          APPEND                          = ' '
           WRITE_FIELD_SEPARATOR           = 'X'
          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                      = ' '
        IMPORTING
          FILELENGTH                      =
          TABLES
            DATA_TAB                        = T_ERR_DOWNLOAD
          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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
        MESSAGE S000 WITH TEXT-008.
      ENDIF.
    ENDFORM.                    " DISP_ERROR
    **Reward points if useful
    Regards,
    Archana

  • Diff between GUI_UPLOAD and CL_GUI_FRONTEND_SERVICES= GUI_UPLOAD

    i want to upload some records from the flat file to internal table. when i use GUI_UPLOAD function module in tables parameter i have given the work area. but when i use CL_GUI_FRONTEND_SERVICES-=>FILE_OPEN_DIALOG and then CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD i have given the internal table body in the changing parameters. my doubt is we have used GUI_UPLOAD in both occassions but when we use GUI_UPLOAD alone we are giving the internal table workarea but when we use it along with class CL_GUI_FRONTEND_SERVICES we are giving the internal table body. whats is the reason or logic behind this?.

    Hi guys -- the answers you've given are correct but an example IMO is 100% better
    go_guiobj type ref to cl_gui_frontend_services.,  "For Windows file dialog
    form load_data using    e_file type string
                            e_table.
      field-symbols <int_table> type standard table.
      assign e_table to <int_table>.
      if go_guiobj is initial.
        create object go_guiobj.
      endif.
      call method go_guiobj->gui_download
        exporting
          filename              = e_file
          filetype              = 'ASC'
          write_field_separator = 'X'
        changing
          data_tab              = <int_table>.
    endform
    * For Directory look up service (Windows)
    at selection-screen
      on  value-request for p_direct.
        search_path = p_direct.
        perform directory_lookup using search_path.
        if not gv_folder is initial.
          p_direct = gv_folder.
        endif.
    form directory_lookup using directory type string.
      if go_guiobj is initial.
        create object go_guiobj.
      endif.
      call method go_guiobj->directory_browse
        exporting
          window_title    = 'Select Directory'
          initial_folder  = directory
        changing
          selected_folder = gv_folder.
    endform.                    "directory_lookup
    Cheers
    jimbo

  • GUI_UPLOAD and UNICODE or UTF-8

    Hello,
    I wanted to convert some files in SAP, i.e. :
    - data is processed in MS Excell and saved as Unicode file
    - I read the file into SAP, process the strings and write it back
    The problem is that there are some special polish characters in the file. I read the file using GUI_UPLOAD FM, but I didn't manage not to have these special characters replaced (by # by default).
    Anyone came across this problem before?
    Regards,
    Michal

    Hello Satya,
    Actually I forgot to write that I used the CODEPAGE parameter... I tried two cases:
    1. Save as Unicode (in Excel or Notepad) and than use CODEPAGE = "4103"
    2. Save as UTF-8 in Notepad and use CODEPAGE = "4110"
    In both cases the polish caracters are replaced by '#'.
    In fact I tried many other code pages (all from tcp00a), but all other combinations return an error.
    Regards,
    Michal

  • GUI_UPLOAD and OPEN DATASET

    Hi,
    My code takes data from a file.
    I want to have an option of loading file from presentation server as well as application server (in case of background).
    For this I am using a checkbox and depending on its value I call the FM GUI_UPLOAD (presentation server) or OPEN DATASET (for app server).
    Is this the right approach or there is a single FM available which can be used to upload file in both the scenarios.
    Thank you,
    CD

    Hi
    You're right, I don't believe there's a std fm to do that.
    Anyway try to check the function group like C13Z
    Max

  • GUI_UPLOAD and Unicode

    Hi,
    I want to use GUI_UPLOAD to load an ASCII file with Czech Characters. I try to save my file in .txt format UTF-8. If i read the file with notepad then i have all my characters but when i load in SAP I lost some characters - Who have a solution - I'm in 4.6C - I put in SAPlogon page code 1404 and language CS .
    DATA: BEGIN OF f1  OCCURS 0,            
          altkn(10)    TYPE c,
          bldat(10)     TYPE c,               "tt.mm.jj
          rart(15)     TYPE c,
    insert michel
          zuonr(18),
          xblnr(20)    TYPE c,
        name1(40)    TYPE c,
          waers(5)     TYPE c,
          brutt(13)    TYPE c,
          fwbtr(13)    TYPE c,
          faedt(10)    TYPE c,
          zterm(4)     TYPE c,
          kunnr(10)    TYPE c,
          sgtxt(49)    TYPE c, => i can find VAN&#282;K
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = pcfil
       FILETYPE                      = 'BIN'
          has_field_separator           = fsepa
        HEADER_LENGTH                 = 0
        READ_BY_LINE                  = 'X'
        DAT_MODE                      = ' '
         CODEPAGE                      =  'UTF8'
        IGNORE_CERR                   = ABAP_TRUE
        REPLACEMENT                   = '#'
          CHECK_BOM                     = 'X'
        IMPORTING
           filelength                    = rc
         HEADER                        =
        TABLES
          data_tab                      = f1
         EXCEPTIONS
          file_open_error               = 1
    Thanks

    Same problem - To keep all the accents, i must save in UTF-8 and i have the same problem with gui_upload.I've just seen that my function GUI_UPLOAD in this system (4.6C) is not the same than in 4.7 - Only these parameters for export -
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      =
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
    I don't have the possibility to choose the codepage. Perhaps it's the reason ?

  • GUI_UPLOAD and OS

    hi all
          i am using the function module GUI_UPLOAD in my code , i want to know as this FM takes file from presentation server and uploads  it to application server, so on presentation server is thr any relation between OS or any files from OS are related for this FM?
    Regards
    Martin

    hi martin,
    just try this code which can save ur presentation server file to the application server,
    REPORT  zbdc_test_open_data_set.
    PARAMETERS: file(200) TYPE c.
    DATA: BEGIN OF g_itab OCCURS 0,
          kunnr TYPE kunnr,
          land1 TYPE land1_gp,
          name1 TYPE name1_gp.
    DATA: END OF g_itab.
    SELECT kunnr
           land1
           name1
           FROM kna1
           INTO TABLE g_itab.
    OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP AT g_itab FROM 1 TO 3.
      TRANSFER g_itab TO file.
    ENDLOOP.
    CLOSE DATASET file.
    save and excute..
    then go to t.code. al11 ->,
    select home in that ->,
    find ur file name(which u have given in the parameter input of the report) and double click on that, u can see details of the file..
    regards.
    seshu...

  • GUI_UPLOAD and SOX

    Hi,
    I wrote a program which used GUI_UPLOAD functionality.  Now the security guy says that this is not allowed as per SOX and we need to find a alternate way for uploading data.
    Can you please suggest me what options do I have.
    Regards
    Vijay

    Hi,
    you can use ws_upload and upload functional modules.anyways ws_upload became obsolete.so you can try using upload.
    regards,
    deepthi reddy

  • 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.

  • Answer the following question regarding GUI_UPLOAD and Open Data Set

    1. what’s the connection or relationship of S_GUI to GUI_UPLOAD?
    2. GUI_UPLOAD saves files to local directory of a use while OPEN DATA SET saves/archives files in the server directory.  Where is the risk directed towards consuming disk space?  Server disk or workstation disk space?
    3. how will this work for multiple files?
    4. Regarding Open Data Set - How the files will be put in AL11?

    The GUI_DOWNLOAD only download the file to local PC...so any abap code running in other pc will not able to use the file.
    BUt if you use open dataset to load the file APPLICATION server any ABAP pogram can access the file.
    Following code explains how you load file using open data setto appl server,
    you can check in t-code <b>AL11</b> for files/dir in applicatin server.
    you to change the value of <b>myfile</b> variable in my code..
    you have to give the full path of the dirctory.
    <b><b>plz reward  points if it hlps you.</b></b>
    Report ZANID_TEST2 message-id ZM.
    data begin of itab occurs 0. "your internal table
    include structure MARA.
    data end of itab.
    *--file upload purpose--
    DATA: BEGIN OF it_file OCCURS 0,
    buffer(200),
    END OF it_file.
    DATA: myfile(128) type c value 'E:\usr\sap\put\sample1xx.txt',
    start-of-selection.
    *--populating itab--
    select * from mara into corresponding fields of table itab
    up to 100 rows.
    perform UPLOAD_FILE_TO_APPL.
    *--form definitin--
    form UPLOAD_FILE_TO_APPL.
    OPEN DATASET myfile FOR OUTPUT IN TEXT MODE.
    IF sy-subrc NE 0.
    MESSAGE e999(zm) WITH 'File could not be opened'.
    ENDIF.
    *-- creating the file data table
    loop at itab.
    *-- i am only taking two fields
    concatenate itab-matnr itab-matkl into it_file-buffer
    separated by space.
    append it_file.
    endloop.
    LOOP AT it_file.
    TRANSFER it_file-buffer TO myfile.
    CLEAR IT_FILE-BUFFER.
    ENDLOOP.
    CLOSE DATASET myfile.
    IF sy-subrc NE 0.
    MESSAGE e999(zm) WITH 'File could not be closed'.
    ENDIF.
    endform. " DUPLOAD_FILE_TO_APPL

Maybe you are looking for

  • Report for issuance of raw material

    Hi!!!! Kindly suggest me the t-code where i can look for the issuance of raw material against production orders on a month basis or quarterly basis. Thanks

  • Itunes error message - the itunes library.itl file cannot be found or created

    My itunes was working yesterday but today when i open it i get an error message saying "the itunes library.itl file cannot be found or created. the default location for this file in in the itunes folder in the music folder." I have tried to reinstall

  • MY QUERY IS TAKING TIME WHILE EXECUTING IN WAD

    HI BW GURUS If i execute the report(using query with variables) which contains 8,50,000 records in WAD then its taking more than 900 seconds and say Connection timed out at the end. If i execute the same query in Query designer using Web browser then

  • Ownership of folders in file server

    Hi Guys, I am facing a problem with my file server. I have a file server installed windows server 2008 R2 Standard SP1 in it. There are 4 drives and almost 99% folders are created by 1st domain user account having domain admin rights. Because I was f

  • I am facing problem in my Iphone

    Hi, I am facing problem in my Iphone5. When ever I am trying to install free application it will ask me for payment. I don't know why this is happening, if the application is free then why it ll ask me for payment. Please resolve this problem as soon