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

Similar Messages

  • What is difference between GUI_download and Open dataset

    Dear All,
    I know there are 2 options for downloading SAP data.
    1)  GUI_DOWNLOAD Functional Module.
    2)  OPEN DATASET DSET FOR OUTPUT IN TEXT MODE.
    What is the difference ??
    When I should use ?? What are the deciding factors ??
    Regards
    venkat

    Hi All,
    Thank You very Much for quick replies.
    1) GUI_DOWNLOAD is used to download data into your local PC. can be run only in frontend.
    2) OPEN DATASET is used for downloading into Application Server
    Thank You one and all.
    Closing Thread, Alloting Points.

  • Ole objects,background and open dataset

    Hi,
    I want to read ms access files on background using ole objects. Is it possible to apply open dataset operation for mdb files? As known, text files can be get into application server using open dataset. But I need to get mdb file to application server.
    On the other way I can simulate my problem as, is it possible to read excel files(for example) using <b>ole object</b> in background? If I can get an aswer, maybe I can simulate it as reading mdb files.
    Thanks.

    OPEN DATASET is meant for the flat text files, you won't be able to open an mdb file with it. Once I've tried using OLE objects to obtain the file modification date and, even though it worked great in foreground, it didn't work in the background mode.
    This thread on reading MS Access files in SAP might be helpful:
    Re: download table from ms-access

  • 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

  • Open dataset close dataset

    Hi
    in AL11 let's say i have a flat file which i am processing .
    after processing i want to rename it xxx_completed.
    I there a way to rename a flat file or do we have to use open dataset read it and then delete the actual file and open dataset to d.w the flat file with another name

    hi,
    SEARCH in SCN you will get so many posts like these.
    [https://forums.sdn.sap.com/click.jspa?searchID=20139763&messageID=553168]

  • Open and Close Dataset problem

    Hi All,
    I am facing a weird problem in transferring data to application server.
    I have used Open dataset to write my file in text format to the application server.
    Now everything works fine when small amount of data is there.When the number of records increases and when it takes lot of time , the format of the text file is completely distorted.
    I have used tab as the delimiter. Please suggest me some solution for this.
    Is this due to the time taken?
    Regards.

    Hi
    in the above program , when i had created 1st i had same problem
    then i had worte the logic likethis
    parameter: file_nm type localfile.
    types : begin of it_tab1,
            f1(20),
            f2(40),
            f3(20),
           end of it_tab1.
    data : it_tab type table of ALSMEX_TABLINE with header line,
           file type rlgrap-filename.
    data : it_tab2 type it_tab1 occurs 1,
           wa_tab2 type it_tab1,
           w_message(100)  TYPE c.
    at selection-screen on value-request for file_nm.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      PROGRAM_NAME        = SYST-REPID
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       STATIC              = 'X'
      MASK                = ' '
      CHANGING
       file_name           = file_nm
    EXCEPTIONS
       MASK_TOO_LONG       = 1
       OTHERS              = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    start-of-selection.
    refresh it_tab2[].clear wa_tab2.
    file = file_nm.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file
        i_begin_col                   = '1'
        i_begin_row                   =  '1'
        i_end_col                     = '10'
        i_end_row                     = '35'
      tables
        intern                        = it_tab
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 2
       OTHERS                        = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    <b>loop at it_tab.
      case it_tab-col.
       when '002'.
        wa_tab2-f1 = it_tab-value.
       when '004'.
        wa_tab2-f2 = it_tab-value.
      when '008'.
        wa_tab2-f3 = it_tab-value.
    endcase.
    at end of row.
      append wa_tab2 to it_tab2.
    clear wa_tab2.
      endat.
    endloop.</b>
    data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        MESSAGE e001(zsd_mes).
        EXIT.
      ELSE.
    *---Data is downloaded to the application server file path
        LOOP AT it_tab2 INTO wa_tab2.
          TRANSFER wa_tab2 TO p_file.
        ENDLOOP.
      ENDIF.
    *--Close the Application server file (Mandatory).
      CLOSE DATASET p_file.
    loop at it_tab2 into wa_tab2.
      write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
    endloop.
    with the bold letters above
    i had wrote that logic for that
    reward if usefull

  • Open data and close dataset

    code required for  how to upload to application server and download it from application server using open dataset and closedataset.

    Hello bharath,
    Check out this code:
    EPORT Z_CRM_REP_SCORE100 no standard page heading message-id zmsgap.
    *&     Type Declaration
    Types: Begin of t_file,
           BPEXT type BU_BPEXT,               "External Number of Business Partner
           NAME_FIRST type BU_NAMEP_F,        "First Name
           NAME_LAST type BU_NAMEP_L,         "Last Name
           CITY1 type AD_CITY1,               "City
           COUNTRY type AD_COMCTRY,           "Country
           TEL_NUMBER type AD_TLNMBR1,        "Telephone Number
           End of t_file.
    Types: Begin of t_but000,                "External Number of Business Partner
           PARTNER type BU_PARTNER,
           BPEXT type BU_BPEXT,
           NAME_FIRST type BU_NAMEP_F,       "First Name
           NAME_LAST type BU_NAMEP_L,        "Last Name
           PERSNUMBER type AD_PERSNUM,       "Person Number
           ADDRCOMM type BU_ADDRCOMM,        "Address Number
           end of t_but000.
    Types: Begin of t_adr2,
           ADDRNUMBER type AD_ADDRNUM,       "Address Number
           PERSNUMBER type AD_PERSNUM,       "Person Number
           COUNTRY type AD_COMCTRY,          "Country
           TEL_NUMBER type AD_TLNMBR,        "Telephone Number
           End of t_adr2.
    Types: Begin of t_adrc,
           ADDRNUMBER type AD_ADDRNUM,       "Address Number
           CITY1 type AD_CITY1,              "City
           End of t_adrc.
    *&      Internal tables and Work Areas Declaration
    Data: it_file type standard table of t_file,
          wa_file type t_file,
          it_sapdata type standard table of t_file,
          wa_sapdata type t_file,
          it_output type standard table of t_file,
          wa_output type t_file,
          it_but000 type standard table of t_but000,
          wa_but000 type t_but000,
          it_adr2 type standard table of t_adr2,
          wa_adr2 type t_adr2,
          it_adrc type standard table of t_adrc,
          wa_adrc type t_adrc.
    *Variable Declaration for file path
    Data:gv_path type SAPB-SAPPFAD value 'C:\FILE.TXT',
         gv_path1 type string value 'file1.txt'.
    *Variable Declaration for index.
    Data: gv_tabix type sy-tabix.
    *Variable Declaration for Line selection.
    Data: v_fieldname type BUT000-BPEXT,
           v_fieldvalue type BU_BPEXT.
    *Calling subroutine to create flat file in application server.
    Perform f_file_to_server.
    *Calling subroutine to fetch values from flat file into an internal table.
    Perform f_dataset.
    *&      Event Start-of-Selection.
    Start-of-Selection.
    *Calling subroutine to fetch values from table BUT000 into an internal table.
      Perform f_select_but000.
    *Calling subroutine to fetch values from table ADR2 into an internal table.
      Perform f_select_adr2.
    *Calling subroutine to fetch values from table ADRC into an internal table.
      Perform f_select_adrc.
    *&      Event End-of-Selection.
    End-of-Selection.
    *Calling subroutine to fill an internal table with SAP data.
      Perform f_fill_sapdata.
    *Calling subroutine to compare the values between I_SAPDATA and I_FILE.
      Perform f_compare.
    *&      Event At Line Selection.
    At Line-Selection.
    *Checking for list index.
      Case sy-lsind.
    *When list index is 1.
        When '1'.
    *Get the value of external number and apss it to the field value..
          Get Cursor Field v_fieldname value v_fieldvalue.
    *Passing field value to field name.
          wa_sapdata-BPEXT = v_fieldvalue.
          If v_fieldname = 'WA_SAPDATA-BPEXT'.
    *Taking only that value whose External Number exist in the internal table IT_BUT000.
            Read Table it_but000 into wa_but000 with key BPEXT = v_fieldvalue binary search.
    *Checking if value exist.
            If sy-subrc eq 0.
    *If it exists then call BP transaction to change the values for that particualr BP according to Aries data.
              Set Parameter id 'BPA' FIELD WA_BUT000-partner.
              Call Transaction 'BP' and skip first screen..
            Endif.                                                        "End of Sy-subrc check.
          Endif.
        Endcase.
    *&      Form  f_file_to_server
    *       This module is used to create flat file in application server
    *       by using function module ARCHIVFILE_CLIENT_TO_SERVER .
    FORM f_file_to_server .
    *Calling function module to create flat file in application server.
      CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
        EXPORTING
          PATH       = GV_PATH
          TARGETPATH = 'FILE1.TXT '
        EXCEPTIONS
          ERROR_FILE = 1
          OTHERS     = 2.
    *checking if file is created successfully
      IF SY-SUBRC <> 0.
    *If file is not created then display a message.
        Message E009.
      ENDIF.                 "End of Sy-subrc check.
    ENDFORM.                    " f_file_to_server
    *&      Form  f_dataset
    *       This module is used to fetch values from flat file,stored in
    *       application server, into an internal table it_file.
    FORM f_dataset .
    *Opening file from application server.
      Open dataset gv_path1 for input in text mode encoding default.
    *Reading the file.
      While sy-subrc eq 0.
        Read dataset gv_path1 into wa_file.
        Append wa_file to it_file.
        Clear wa_file.
      Endwhile.
    *closing the file in application server.
      Close dataset gv_path1.
    ENDFORM.                    " f_dataset
    *&      Form  f_select_but000
    *       This module is used to select values from table BUT000 into an
    *       internal table i_but000.
    FORM f_select_but000 .
    *Selecting values from table BUT000.
      Select PARTNER
             BPEXT
             NAME_FIRST
             NAME_LAST
             PERSNUMBER
             ADDRCOMM
             From but000 into table it_but000
             where TYPE = '1'
             and BPEXT ne ''
             and ADDRCOMM ne ''.
    *Checking if values are fetched in the internal table.
      If sy-subrc eq 0.
        sort it_but000 by BPEXT PERSNUMBER .
      Endif.                           " End of Sy-subrc check.
    ENDFORM.                    " f_select_but000
    *&      Form  f_select_adr2
    *       This module is used to select values from table ADR2 into an
    *       internal table i_adr2 corresponding to the values in i_but000.
    FORM f_select_adr2 .
    *Checking if internal table i_but000 is not empty.
      If not it_but000[] is initial.
    *Selecting values from table ADR2.
        Select ADDRNUMBER
               PERSNUMBER
               COUNTRY
               TEL_NUMBER
               into table it_adr2
               from adr2
               for all entries in it_but000
               where PERSNUMBER = it_but000-PERSNUMBER.
    *Checking if values are fetched in the internal table.
        If sy-subrc eq 0.
          sort it_adr2 by ADDRNUMBER.         " End of Sy-subrc check.
        Endif.
      Endif.                                  "End of internal table check.
    ENDFORM.                    " f_select_adr2
    *&      Form  f_select_adrc
    *      This module is used to select values from table ADRC into an
    *      internal table i_adrc on the basis of values in i_adr2.
    FORM f_select_adrc .
    *Checking if internal table i_but000 is not empty.
      If not it_adr2[] is initial.
    *Selecting values from table ADRC.
        Select ADDRNUMBER
               CITY1
               from adrc
               into table it_adrc
               for all entries in it_adr2
               where ADDRNUMBER = it_adr2-ADDRNUMBER.
    *Checking if values are fetched in the internal table.
        If sy-subrc eq 0.
          sort it_adrc by ADDRNUMBER.         " End of Sy-subrc check.
        Endif.
      Endif.                                  "End of internal table check.
    ENDFORM.                    " f_select_adrc
    *&      Form  f_fill_sapdata
    *       This module is used to fill values in internal table i_sapdata
    *       with the values selected from BUT000,ADRC and ADR2.
    FORM f_fill_sapdata .
    *Checking if internal table it_but000 is not empty.
      If not it_but000[] is initial.
        Loop at it_but000 into wa_but000.
    *Filling the values of internal table IT_BUT000 into workarea of IT_SAPDATA.
          wa_sapdata-BPEXT = wa_but000-BPEXT.
          wa_sapdata-NAME_FIRST = wa_but000-NAME_FIRST.
          wa_sapdata-NAME_LAST = wa_but000-NAME_LAST.
    *Taking only those values whose Person Number exist in the internal table IT_ADR2.
          Read  table it_adr2 into wa_adr2 with key PERSNUMBER = wa_but000-PERSNUMBER Binary Search.
    *If value exists then populate those values in work area of IT_SAPDATA.
          If sy-subrc eq 0.
            wa_sapdata-COUNTRY = wa_adr2-COUNTRY.
            wa_sapdata-TEL_NUMBER  = wa_adr2-TEL_NUMBER .
    *Taking only those values whose Address Number exist in the internal table I_ADRC.
            Read table it_adrc into wa_adrc with key ADDRNUMBER = wa_adr2-ADDRNUMBER Binary Search.
    *If value exists then populate that value in work area of I_SAPDATA.
            If sy-subrc eq 0.
              wa_sapdata-CITY1 = wa_adrc-CITY1.
            Endif.                              "End of Sy-subrc Check.
          Endif.                                "End of Sy-subrc Check.
    *Inserting workarea of sapdata into its internal table.
          Append wa_sapdata to it_sapdata.
    *Clearing all workareas.
          Clear: wa_adrc,wa_adr2,wa_sapdata.
        Endloop.
      Endif.                                      "End of internal table check.
    *Clearing workarea.
      Clear wa_but000.
    ENDFORM.                    " f_fill_sapdata
    *&      Form  f_compare
    *       This module is used to compare values between the Aries data
    *       and SAP data and display those values which are different.
    FORM f_compare .
    *Checking if internal table it_sapdata is not empty.
      If not it_sapdata[] is initial.
        Loop at it_sapdata into wa_sapdata.
    *Taking only those values whose External Number exist in the internal table IT_FILE.
          Read table it_file into wa_file with key BPEXT = wa_sapdata-BPEXT.
    *Comparing the workareas of two internal tables
          If wa_sapdata ne wa_file.
    *Checking if values of work area donot match then write the header.
            Write: / sy-uline(120).
            Format color 1.
            Write: /1 'External Number' Centered.
            Format Hotspot on.
            Write: 17 wa_sapdata-BPEXT.
            Format Hotspot off.
            Write: 47 sy-vline,
               48 'Aries data' Centered,
               80 sy-vline,
               81 'SAP data' Centered,
               120 sy-vline.
            WRITE: / sy-uline(120).
    *Checking if first name in the aries data and SAP data does not match.
            If wa_sapdata-NAME_FIRST ne wa_file-NAME_FIRST.
    *If it doesnt match then display it using subroutine.
              Perform f_write using 'First Name' wa_file-NAME_FIRST  wa_sapdata-NAME_FIRST.
            Endif.                                                                              " End of Sy-subrc check.
    *Checking if last name in the aries data and SAP data does not match.
            If wa_sapdata-NAME_LAST ne wa_file-NAME_LAST.
    *If it doesnt match then display it using subroutine.
              Perform f_write using 'Last Name' wa_file-NAME_LAST  wa_sapdata-NAME_LAST.
            Endif.                                                                              " End of Sy-subrc check.
    *Checking if city in the aries data and SAP data does not match.
            If wa_sapdata-CITY1 ne wa_file-CITY1.
    *If it doesnt match then display it using subroutine.
              Perform f_write using 'City' wa_file-CITY1  wa_sapdata-CITY1.
            Endif.                                                                             " End of Sy-subrc check.
    *Checking if country in the aries data and SAP data does not match.
            If wa_sapdata-COUNTRY ne wa_file-COUNTRY.
    *If it doesnt match then display it using subroutine.
              Perform f_write using 'Country' wa_file-COUNTRY  wa_sapdata-COUNTRY.
            Endif.                                                                             " End of Sy-subrc check.
    *Checking if phone number in the aries data and SAP data does not match.
            If wa_sapdata-TEL_NUMBER ne wa_file-TEL_NUMBER.
    *If it doesnt match then display it using subroutine.
              Perform f_write using 'Phone Number' wa_file-TEL_NUMBER  wa_sapdata-TEL_NUMBER.
            Endif.                                                                            " End of Sy-subrc check.
          Endif.                                                                               "End of Equality check.
        Endloop.
    *Clearing workareas.
        Clear: wa_sapdata, wa_file.
      Endif.                                                                                "End of internal table check.
    ENDFORM.                    " f_compare
    *&      Form  f_write
    *       This module is used to display the field names which has been
    *       changed in SAP from Aries data.
    *      -->P_field_name   text
    *      -->P_Aries_data   text
    *      -->P_SAP_data     text
    FORM f_write  USING    VALUE(P_field_name)
                           VALUE(P_Aries_data)
                           VALUE(P_SAP_data).
      Format color 2.
      Write : /1 P_field_name,
              47 sy-vline.
      Format color off.
      Write: 48 P_Aries_data,
             80 sy-vline,
             81 P_SAP_data,
             120 sy-vline.
      WRITE: / sy-uline(120).
    ENDFORM.                    " f_write
    Please reward points if helpful.
    Regards,
    Aditi

  • Open dataset and close dataset

    Hi
    I need to write log file in fileshare.
    I am using the following FM to create the file.
    Z_FILE_OPEN_OUT_UNICODE'
    I have following qns
    1. do i need to use open dataset and close dataset stmts, even I create the files with the FM?

    Hi,
    you can fill in the name of the FM in transaction SE37, then click 'Display' and look at the source code and the 'Tables' tab.
    It's a custom build FM, so you might have to look at the import parameters it needs... ( Tab 'Import' and 'Tables' ).
    To answer your question, as the name of the FM suggests it will write the file for you, so no open/close dataset. Please doublecheck tab 'Source code' and you might find these statements there...
    hope that helps,
    Rolf

  • Open dataset in UTF8. Problems between Unicode and non Unicode

    Hello,
    I am currently testing the file transfer between unicode an non unicode systems.
    I transfered some japanese KNA1 data from non unicode system (Mandt,Name1, Name2,City) to a file with this option:
    set local language pi_langu.
      open dataset pe_file in text mode encoding utf-8 for output with byte-order mark.
    Now I want to read the file from a unicode system. The code looks like this:
    open dataset file in text mode encoding utf-8 for input skipping byte-order mark.
    The characters look fine but they are shifted. name1 is correct but now parts of the city characters are in name2....
    If I open the file in a non unicode system with the same coding the data is ok again!
    Is there a problem with spaces between unicode an non-unicode?!

    Hello again,
    after implementing and testing this method, we saw that the conversion is always taken place in the unicode system.
    For examble: we have a char(35) field in mdmp with several japanese signs..as soon as we transfer the data into the file and have a look at it the binary data the field is only 28 chars long. several spaces are missing...now if we open the file in our unicode system using the mentioned class the size is gaining to 35 characters
    on the other hand if we export data from unicode system using this method the size is shrinking from 35 chars to 28 so the mdmp system can interprete the data.
    as soon as all systems are on unicode this method is obselete/wrong because we don't want to cut off/add the spaces..it's not needed anymore..
    the better way would be to create a "real" UTF-8 file in our MDMP system. The question is, is there a method to add somehow the missing spaces in the mdmp system?
    so it works something like thtat:
          OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING UTF-8 WITH BYTE-ORDER MARK.
    "MDMP (with ECC 6.0 by the way)
    if charsize = 1.
    *add missing spaces to the structure
    *transfer strucutre to file
    *UNICODE
    else.
    *just transfer struc to file -> no conversion needed anymore
    endif.
    I thought mybe somehow this could work with the class CL_ABAP_CONV_OUT_CE. But until now I had no luck...
    Normally I would think that if I'am creating a UTF-8 file this work is done automatically on the transfer command

  • Open dataset twice once for input and once for output in unicode system

    Hi All,
    In a program
    I used a open dataset to read the data from the file.
    OPEN DATASET cmp_file FOR INPUT IN TEXT MODE
          ENCODING NON-UNICODE.
    Then i closed the file.
    Again later in the program,
    I used a open dataset to transfer the data.
    OPEN DATASET cmp_file FOR OUTPUT IN TEXT MODE
          ENCODING NON-UNICODE.
    But this time I get sy-subrc = 8.
    Unable to open the file and subsequent TRANSFER is leading to the runtime error.
    Note : I am using a unicode system
    I could run the same program well in non-unicode system..
    ->
    Is it that if a file contains data already
    1.I need to delete the data and open it
    or
    2.I need to open in APPENDING mode manadatorily...
    in case of UNICODE system..
    Kindly suggest..

    Hi,
    IF you have write permission al S.O. Level you need to check your DATASET rigths using AUTHORITY_CHECK_DATASET, this validate your rigths with S_DATASET object.
    Example
    TYPE-POOLS SABC.
    CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
    EXPORTING PROGRAM = 'ZDATASET'
    ACTIVITY = SABC_ACT_READ
    FILENAME = '/tmp/sapv01'
    EXCEPTIONS NO_AUTHORITY = 1
    ACTIVITY_UNKNOWN = 2.
    See SABC type pool to know wich activities are aviable.
    Hope this help.
    Regards

  • OPEN DATASET and TRANSFER

    Hi all,
    I open Dataset in Text Mode with default encoding and trying to transfer data from an internal table to TEXT file in application server.
    But my internal table has 1 numeric field, so while transfering i am getting error stating: "cannot write Non-chracter field".
    So, is there any way to write Non-character fields also using same OPEN Dataset and TRANSFER Statements.
    Help will be rewarded.
    Sachin

    Hi  Saching..
    As per UNICODE We cannot transfer Numeric fields to file .
    So We must convert the Record to Character format.
    This is the Modified code. Changes are in BOLD.
    TABLES: ZSACHIN_STUDENT.
    PARAMETERS:
    OUTFILE(20) DEFAULT 'sachin_test.txt'
    LOWER CASE.
    TYPES: BEGIN OF st_student,
    ID TYPE ZSACHIN_STUDENT-ID,
    NAME TYPE ZSACHIN_STUDENT-NAME,
    ADDRESS TYPE ZSACHIN_STUDENT-ADDRESS,
    STATE TYPE ZSACHIN_STUDENT-STATE,
    CITY TYPE ZSACHIN_STUDENT-CITY,
    STATUS TYPE ZSACHIN_STUDENT-STATUS,
    END OF st_student.
    DATA : it_student TYPE STANDARD TABLE OF st_student,
    it_student_wa TYPE st_student.
    <b>DATA: V_RECORD(200) TYPE C.</b>
    OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE encoding default.
    IF sy-subrc <> 0.
    message e001(z_error).
    endif.
    SELECT * FROM ZSACHIN_STUDENT INTO
    CORRESPONDING FIELDS OF TABLE it_student.
    <b>LOOP AT it_student INTO it_student_wa.
    <b>CONCATENATE IT_student_wa-name
                             IT_student_wa-address
                             IT_student_wa-state
                             IT_student_wa-city
                             IT_student_wa-status
                             INTO V_RECORD
       SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    TRANSFER V_RECORD TO OUTFILE.</b>
    ENDLOOP.</b>
    CLOSE DATASET OUTFILE.
    Here SEPARATED BY is for generating  TAB delimiter .
    <b>Reward if Helpful</b>

  • Open Dataset for XML not reading the XML file, Returning Code 8.

    Dear all,
    Im trying to open an XML file using Open Dataset, since i have to execute this report in background and GUI_upload doesnt work in background.
    The XML file is available in my C:\, say, C:\xmlfile.xml.
    But  the open dataset is not reading any value into the g_xml_line . it is returning sy-subrc = 8.
    Below is my code for that, can anybody help me out to resolve.
    DATA : lv_filename LIKE rlgrap-filename.
      CLEAR: lv_filename.
      lv_filename = p_input.
      OPEN DATASET lv_filename FOR INPUT IN BINARY MODE.
      IF sy-subrc ne 0.
        WRITE:/ 'invalid file'.
      else.
      DO.
        READ DATASET lv_filename INTO  g_xml_line.
        IF sy-subrc EQ 0.
          APPEND g_xml_line TO g_xml_table.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET lv_filename.
       ENDIF.
    TYPES: BEGIN OF t_xml_line,
            data(256) TYPE x,
          END OF t_xml_line.
    DATA: g_xml_table       TYPE TABLE OF t_xml_line,
          g_xml_line        TYPE t_xml_line,
          g_xml_table_size  TYPE i.
    GET REFERENCE OF gt_person INTO gs_result_xml-value.
      gs_result_xml-name = 'IPIX'.
      APPEND gs_result_xml TO gt_result_xml.
    Perform the XSLT stylesheet
      TRY.
          CALL TRANSFORMATION zaum_manh_sync_rpt
          SOURCE XML g_xml_table
          RESULT (gt_result_xml).
        CATCH cx_root INTO gs_rif_ex.
          gs_var_text = gs_rif_ex->get_text( ).
          MESSAGE gs_var_text TYPE 'E'.
      ENDTRY.
    Kindly suggest me a solution. Points assured
    regs,
    raja

    After saving the file , below is the code i wrote, but it gives a runtime error with message
    No roll storage space of length 3788808 available for internal storage.
    ***Coding****
    PARAMETERS: p_file TYPE pathintern LOWER CASE DEFAULT '/usr/sap/DEV/SYS/global/XMLABAP2.XML'.
    DATA : lv_filename LIKE rlgrap-filename.
      CLEAR: lv_filename.
      lv_filename = p_file.
      DATA: l_fname TYPE filename-fileintern. " File name
    *GET THE FILENAME FROM THE APPLICATION SERVER
      CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
        EXPORTING
          directory        = p_file
          filemask         = '*'
        IMPORTING
          serverfile       = l_fname
        EXCEPTIONS
          canceled_by_user = 1
          OTHERS           = 2.
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    */usr/sap/DEV/SYS/global/substanc
      lv_filename = l_fname.
      OPEN DATASET lv_filename FOR INPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        WRITE:/ 'invalid file'.
      ELSE.
        DO.
          READ DATASET lv_filename INTO  g_xml_line.
       IF sy-subrc EQ 0.
          APPEND g_xml_line TO g_xml_table.
       ELSE.
         EXIT.
       ENDIF.
        ENDDO.
        CLOSE DATASET lv_filename.
      ENDIF.

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

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

  • Open dataset fails...says "error opening input file"

    Hi,
    I am trying to open a file in my BDC program and get the following error "error opening input file". Its a text file with continuous data. No delimiters and hence character count will be used to parse the data.
    I am using the following statement to open it..
    OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    but sy-subrc is set to 8 !!
    what could be the problem ??
    thanks

    This is pretty confusing !!I would explain to you my exact issue !!
    I have a program in which there is no GUI_UPLOAD call but just a direct open dataset statement !!
    This program runs fine for my collegue who has the file in a server (not the application server). She gives the full path name as
    servername\foldername\filename.
    I tried doing the same but as I did not have access to that server, it failed. So I received that file from her and stored it in my local system. So on program execution, i gave the path as c:\filename and I got the error message "Error opening the file"
    Find below some code extracts..
    PARAMETERS : p_sname TYPE d0100_mapn ,
                 p_file(136) TYPE c ,
    FORM open_file .
    *open file in textmode
      OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF  sy-subrc = 0.
        DO.
        Read the file data and tranfer to workarea to internal table
          READ DATASET p_file  INTO  x_legacy_rec.
    Please help in debugging this issue !!
    thanks

Maybe you are looking for

  • How can I see Bangla in Firefox for Android?

    I am from Bangladesh. I have to frequently visit Bangla websites. Although chrome and opera mini supports Bangla Firefox for Android does not( What is the problem with Firefox). At least I could not find a way. Can anyone help me to see Bangla in Fir

  • Feel free to use these Snow Leopard images for your desktop - a Snow Leoard

    Feel free to use any of the images of a Snow Leopard on my .Mac page below. I took them at Marwell Zoo in the UK on Saturday 19th Sept. http://gallery.me.com/idparkinson#100351 All the best, Ian

  • Information on Userexits, Functional Specs, workflow & scrtipts

    Hi, I recently got certified by SAP as Functional mySAP solution consultant in SCM (Order fulfillment I) . During my last interview i was asked questions about userexits, functional specs, workflow and scripts. Would be glad if you can tell me the fr

  • Steps to create Numer range buffering

    Hi Gurus, Can any b'dy explain the concept of number range buffering and also i need steps to create number range buffering for transactional data. here we have a full load it has to load 50L of records daily . it is taking 1.5 hr to 2 hr to load thi

  • Significance of Planning profile

    Hi PP Gurus, Can anybody pl tell me what is the significance of planning profile? I am getting an error saying maintain planning profile for the material during creation of PIR. regards, Pramod.