Upload a text file

Hi guys,
I need to upload a ".txt "  file in the internal table ITAB1 & ITAB2 having structure as below.
If u see the 6 fields in both the table are same.I need to use the same text file to upload data in two different internal table.Please guide.
itab1:  CUSTOMER(10),      "Customer
        PART_CODE(18),     "Parts Code
        REF_NO(35),        "Ref No.
        REF_DATE(10),      "Ref Date
        QTY(12),           "Parts Qty
        TEXT(100),         "Remark
itba2: CUSTOMER(10),      "Customer
        PART_CODE(18),     "Parts Code
        REF_NO(35),        "Ref No.
        REF_DATE(10),      "Ref Date
        QTY(12),           "Parts Qty
        PRICE(15),         "Parts Price
        WAERK(5),          "Parts Currency
        TEXT(100),         "Remark

Data : begin of itab occurs 0,
       CUSTOMER(10), "Customer
      PART_CODE(18),
      REF_NO(35), "Ref No.
      REF_DATE(10), "Ref Date
      QTY(12), "Parts Qty
      TEXT(100), "Remark
       end of itab.
Data : begin of itab1 occurs 0,
CUSTOMER(10), "Customer
PART_CODE(18), "Parts Code
REF_NO(35), "Ref No.
REF_DATE(10), "Ref Date
QTY(12), "Parts Qty
PRICE(15), "Parts Price
WAERK(5), "Parts Currency
TEXT(100), "Remark
end of itab1.
selection-screen begin of block b3 with frame title text-007.
SELECTION-SCREEN  BEGIN OF BLOCK b1 WITH FRAME TITLE text-006.
PARAMETERS:p_file(90)  modif id bbb.
SELECTION-SCREEN  END   OF BLOCK b1.
selection-screen end of block b3.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      def_filename     = space
      def_path         = space
      mask             = ',.,..'
      mode             = space
      title            = space
    IMPORTING
      filename         = p_file
    EXCEPTIONS
      inv_winsys       = 1
      no_batch         = 2
      selection_cancel = 3
      selection_error  = 4
      OTHERS           = 5.
  IF sy-subrc <> 0 AND sy-subrc <> 3.
    MESSAGE e102(yb) WITH 'Error Selecting File'(007).
  ENDIF.
DATA: filename TYPE string.
    filename = p_file.
  CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                = filename
        filetype                = 'ASC'
        has_field_separator     = 'X'
      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 ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
Loop at itab.
move-corresponding itab to itab1.
append itab1.
clear: itab1,itab.
endloop.

Similar Messages

  • How to upload a text file from a shared folder and provide an o/p

    how to upload a text file from a shared folder and provide an o/p  containing the details in each order in the text file

    Hi,
    Use <b>GUI_UPLOAD</b> to upload a text file from a shared folder.
    Use <b>GUI_DOWNLOAD</b> to download data in a file on the presentation server or use <b>OPEN DATASET, TRANSFER</b> and <b>CLOSE DATASET</b> statements to download data to the application server.
    Now, I hope the code for data fetching, if required, is already present in the report.
    Reward points if the answer is helpful.
    Regards,
    Mukul

  • 'No Upload Authorization' While Uploading a Text File from Multiple Select

    Hi all,
       The User is trying to upload a text file from Multiple Selection screen of a Query in BEx and it gives the error message of 'No Upload Authorization' (Error DB886).
       In 'Logon data' tab of Tcode SU01, it has 'User' for 'User Group for Authorization check' for this User.
       I could upload a text file from Multiple Selection screen with my User Id.
       An idea about this error, PLEASE ?
    Thanks,
    Venkat.

    Hi Ron,
       This User does not have the access to Tcode ST01.
       The user executed Tcode SU53 immediately following the authorization failure to see the authorization objects. The 'Authorization obj' is blank and under the Description it has 'The last Authorization check was successful' with green tick mark.
      Any further suggestions, PLEASE.
    Thanks.

  • Uploading a text file to FTP Loc

    Hi,
    Please guide me in the following query:
    While uploading a text file to FTP Loc by using FM 'FTP_R3_TO_CLIENT', all the data is coming in one line. Please guide me how can i insert the new line character after the end of each line.
    Please guide.
    Thanks and Regards

    Hi,
    When i make the character_mode = 'X', then no data is getting uploaded to FTP Loc, only a blank file is being created. Please guide.
    Thanks and Regards
    Edited by: MP Vashishth on Jan 12, 2010 10:34 AM

  • Upload a text file of values when run a query

    In SAP BW 3.x BEx Analyzer, we can import a text file with list of values for each variable.
    For example, you want to run a report for certain product numbers, but say the prod no list is of 3000 no's long, it'll take the user forever to select and enter them in the report entry variable, so instead you upload a text file, with all this list of 3000 prod no's and run the report.
    Does this option still exist anywhere for version 7.0? BI Analyzer is different than Bex Analyzer. Can anyone explain it? Thanks!

    Hi Qingbo,
    Not using any standard solution (i don't know any in 3.5) you can use an variable of type exit. Inside the variable value calculation, you can use a flat file stored in the application server to read the values of the variable.
    Another option is to store those values in a cube (mantained using flat file upload or a BPS layout) and use a replacement path variable using a query over this cube to run the query you need.
    Hope this helps.
    Regards,
    Diego

  • How to upload a text file to a webpage and process it using a Java app?

    Apologies if the question is off topic.
    I would like a user to upload a text file to a webpage and have a pre-existing Java application I created process the text file and return the results to the user. The Java application is fairly memory intensive. It is expected that multiple clients will be uploading at the same time. What is the simplest or most efficient method to achieve this?
    Thank you

    This might help you to get started: http://www.roseindia.net/jsp/file_upload/Sinle_upload.xhtml.shtml
    As done in this example, processing the uploaded file in the JSP itself may not be a good idea though. You're better off handling it in your controller servlet or action class.

  • Uploading a text file from webi filter area as part of the query condition

    Post Author: balasura
    CA Forum: Publishing
    Requirement : Uploading a text file from webi filter area as part of the query condition Hi, I am in a serious requirement which I am not sure available in BO XI. Can some one help me plz. I am using BO XI R2, webi I am generating a ad-hoc report, when I want to give a filter condition for a report, the condition should be uploaded from a .txt file. In the current scenario we have LOV, but LOV could hold only a small number of value, my requirement is just like a lov but the list of values will be available in a text file ( which could number to 2000 or 2500 rows). I would like to upload this 2500 values in the form of a flat text file to make a query and genrate report. Is it possible in BO XI? For Eg:- Select * from Shipment Where u201CShipment id = u2018SC4539u2019 or Shipment id = u2018SC4598u2019u201D The u201Cwhereu201D condition (filter) which has shipment id will be available in a text file and it needs to be loaded in the form of .txt file so that it will be part of the filter condition. Content of a .txt file could be this shipment.txt =============== SC4539 sc2034 SC2343 SC3892 . . . . etc upto 2500 shipment Ids I will be very glad if some could provide me a solution. Thanks in advance. - Bala

    Hi Ron,
       This User does not have the access to Tcode ST01.
       The user executed Tcode SU53 immediately following the authorization failure to see the authorization objects. The 'Authorization obj' is blank and under the Description it has 'The last Authorization check was successful' with green tick mark.
      Any further suggestions, PLEASE.
    Thanks.

  • How to upload the text file into smart forms

    Hi Experts,
    can any one tell me that how to upload  the text file or html file to SAP Script form or smart forms
    i have download the form info from SAPscript form.to text file.
    now i want to upload the text file to smartforms.
    is it possible ? if it is possible, then how can i do that ?
    Thanks in Advance.
    Regards,
    Mani

    <b>For Scripts</b>
    Go to SE38. Put in the program name RSTXSCRP. Execute it.
    Mode(Export/Import) : Import.
    Give the file name from which you want to upload and execute it.
    <b>For Smartforms</b>
    TCode : smartforms.
    Give the form name.
    Utilities-->Upload form.
    Reward points if helpful.
    Thanks
    Aneesh.

  • Uploading a text file to a server using gprs connection and http method

    Hi,
    I want to upload a text file from my windows mobile device( WM 6.1 version) to a server using the gprs connection and the http method. The application runs on IBM weme j9 VM.
    Anybody having done anything similar to this,please post a code snippet or provide helpful resources..
    Thanks in advance.
    Edited by: 803691 on Oct 20, 2010 3:50 AM

    Please give a response..
    I want to know whether there is a feasible solution for this in java..
    PLease provide code snippets for establishing gprs connection in java..

  • How to upload a text file...

    here iam developing a web application in that i need to upload a text file and that text file should converted in to binary file...
    i have done the above things...by using just files concept...
    for that i used file reader and writer objects and buffer reader and writer objects...and string tokenizer...now what i need is to upload a text file before converting it into binary fle....
    iam using tomcat...
    plz any one help me....

    You would use a FileReader for reading streams of characters from a text file, so you could open the file through a FileInputStream instead for a byte array. Look at the Java API for the read method.
    Why do you need it in byte array format?

  • Error while uploading standard text files for the Global rule set

    Hi all,
    As part of Post Installation Activities we have uploaded standard text files for business process, functions, risks and rule set obtained with the installable Software.
    While uploading the text files we have uploaded the Basis Functions Authorizations first and then R/3 text files.
    When we checked no actions are appearing in the rule architect under respective functions except for the BASIS Module.
    Is this because we have uploaded the Basis functions before the R/3 text files?If yes, how to replace the Basis with the R/3 ones.
    We tried to replace the Basis function authorizations by re-uploading the R/3 text files again but we got the below error message u201CORA-00001:unique constraint (SAPSR3DB.SYS_C004479) violatedu201D
    Can somebody please help in this regard how to get the standard rule set in our system?
    Thanks and Best Regards,
    Srihari.K

    Hi Sri,
    you should upload first the static text files and the authorization objects first and then the GRC standard rule set files following the instructions of the SAP Configuration Guide available in Service Market Place under http://service.sap.com/instguides .
    The GRC standard rule set contains files named Basis_functions_action.txt and R3_function_action.txt. The first one contains ONLY function definitions in terms of transcation codes for basis only, whereas the second one contains functions definition for basis AND ERP modules. The same holds for the *_function_permission.txt files. There are also function definition files for other SAP solutions such as APO, CRM, HR  etc.
    You can open a customer message and request a deletion script for the rule sets files you have uploaded already. After their application of this script all rule set data will be deleted from your database. If you have uploaded static text and authorization files correctly, you can then upload the GRC standard rule set files as needed again.
    best regards,
    Frank

  • Uploading Importing text file & crosstab display

    <p> I want to upload a text tab delimited file into our db, currently we
    are uploading it to a temp table in the db, do some validation checks and write
    to a table when done. I have two questions:</P>
    <p> 1) Is there a more efficient way of upload/importing flat files into
    the db via forms, like loading data into a non db data block and working on the
    data via loops rather than sql in a temp table.</P>
    <P> 2) I want to present the data to the user(for verification) via a form
    screen as they have read it in, the only way I can think of doing this, is
    populating a temp table and then using a data block based on a stored procedure
    that contains a dynamic pivot query package since I don't know the
    number of columns that the file will contain. Data blocks can do either
    vertical or horizontal alignment but not grid.</P>
    <P> File will take the format of: </P>
               col1           col2            col3
    row1    data_r1c1   data_r1c2   data_r1c3
    row2    data_r2c1   data_r2c2   data_r2c3
    row3    data_r3c1   data_r3c2   data_r3c3
    row4    data_r4c1   data_r4c2   data_r4c3
    <BR>
         <P>Thank you in advance </P>

    Thank you for your reply
    1) It's a utility for users and so it has to be through forms
    Presently I think it is better to read it in to a temp table then I can use sql for validation which would be faster than looping through blocks. But with this approach I'm just a little worried about Lost Updates e.g. what if someone is changing scores in the regular update screen while another person is trying to import them via the import utility.
    2) I have to use a stored procedure because I don't know how many columns a user will want to load in, sometimes it could be 2,3 or 5 etc. So basically I am looking at a way of presenting the data from it's stored format in it's read in format i.e. file format
    File format =
             col1           col2            col3           coln
    row1  data_r1c1   data_r1c2   data_r1c3   data_r1cn
    row2  data_r2c1   data_r2c2   data_r2c3   data_r2cn
    row3  data_r3c1   data_r3c2   data_r3c3   data_r3cn
    rown  data_rnc1   data_rnc2   data_rnc3   data_rncn
    It is stored in the temp table as
    row1    col1   data_r1c1
    row2    col1   data_r2c1
    row1    col2   data_r1c2
    row2    col2   data_r2c2
    Example
             Test1    Test2    Test3    Test4
    John   54        45         70         65
    Jane   38        55         72         70
    Stored in the temp and subsequently written to Student Score table as
    Student    Test      Score
    John        Test1    54
    John      Test2      45
    John      Test3      70
    John      Test4      65
    Jane      Test1      38
    Jane      Test2      55
    Jane      Test3      72
    Jane      Test4      70

  • Problems uploading a text file with line feed characters from Windows

    Hi,
    I am using the FM GUI_UPLOAD to load a text file in which at the end of each line there is a line feed character. When I upload the file, the FM interprets the entire file as ONE record; it does not recognize the line feed character at the end of each file line. I am using the parameter in the FM "HAS_FIELD_SEPARATOR" and it does not do anything to remidiate this issue.
    The funny thing is that  WS_upload works like a charm and it separates every line in the text file according to the line feed character at the end of each file line.
    Why a FM that is obsolete would work better and with  less effort than the new one? We are on 4.6c and will go to ECC6.0 May 2009.
    Can anybody recommenced a way to process this type of file using GUI_upload?
    The file to process is downloaded from a bank Website into a Windows PC. Sending the file to Unix first is not an option.
    Thanks,
    Pierre Martinez
    Edited by: Pierre Martinez on Aug 15, 2008 1:09 AM

    Hi,
    I have done that and Notepad does NOT interpret the line feed character. The file looks all messed up. Notepad does NOT split the data into records. The Hex character at the end of each file line is 0A.
    The user will download the file into a Windows desktop from the bank's website and from there an ABAP  program needs to read it and parse it. But the ABAP  program can not even catch the entire file with gui_upload. WS_upload can catch it with no issues.
    I tried catching the file into an internal table of data type string using GUI_upload, but it only catches two bytes of the file and nothing else.
    I will try catching the file in some other type of data type for the internal table in gui_upload.
    Once I catch it, I can split the file by the line feed character. I need to catch it  first, but "my glove" is not big enough. Defining the internal table for the gui_upload as character is a guessing game since I really do not know how big the text file is since GUI_upload will put it in a one record.
    Thanks.

  • BDC : Function Module to Upload Unicode text file

    Hi Friends,
               Can anyone tell me how to upload data to internal table by taking it from unicode text file ?
    at present i'm using FM - GUI_UPLOAD which do not support Unicode text file.
    Sonal

    Hi,
    U Have to use CodePage Parameter to upload the data.
    Check the Description
    Character Representation for Output
    Description
    Use parameter CODEPAGE to specify the desired source codepage. If this parameter is not set, the codepage of the SAP GUI is used as the source codepage.
    Value range
    4-digit number of the SAP codepage. The function module SCP_CODEPAGE_BY_EXTERNAL_NAME provides the SAP codepage number for an external character set name, for example, "iso-8859-1". The function module NLS_GET_FRONTEND_CP provides the respective non-Unicode frontend codepage for a language.
    The desired codepage can be determined interactively, if the parameter with_encoding of method file_open_dialog is set by cl_gui_frontend_services.
    If the specified codepage is not suited for the Byte Order Mark of the file, an exception is triggered.
    SPACE: Codepage of the frontend operating system
    Default
    SPACE

  • Uploading many text file into many table

    hi there,
    my problem is that i have lots of text files (about 360 files), what i need is to upload them to many tables already created in oracle, as far as i know, i can upload only one file per command using the SQL loader, any help would be appreciated.
    thanks in advance.
    i am using oracle 10G and Windows XP SP3
    Edited by: user5724824 on Nov 20, 2009 4:36 AM

    Hello user5724824.
    Besides what drop.any and Toni Lazarin have provided, the only thing I could add would be the option to load one file to multiple tables, reading the file only once. Using Toni's example from another thread and a slight revision
    LOAD DATA
      INFILE mon200601.dat
      INFILE mon200602.dat
      INFILE mon200603.dat
      APPEND
      INTO TABLE emp1
      ( empno  POSITION(1:4)   INTEGER EXTERNAL,
        ename  POSITION(6:15)  CHAR,
        deptno POSITION(17:18) CHAR,
        mgr    POSITION(20:23) INTEGER EXTERNAL
      INTO TABLE emp2
      ( empno  POSITION(1:4)   INTEGER EXTERNAL,
        ename  POSITION(6:15)  CHAR,
        deptno POSITION(17:18) CHAR,
        mgr    POSITION(20:23) INTEGER EXTERNAL
      )If you want specific code to dynamically create all of your control files and execution of sqlldr for each created control file, a small example of table names and file names and their relationships that you'd like to be used would get me started. Include a three line sample example control file, that way we know whether you are using fixed or delimited data (this is significant).
    Hope this helps,
    Luke

Maybe you are looking for

  • Need help! Windows won't boot in partition.

    Loner T, Here is where I have gotten to so far: The partition for GPT4 are 777385984 - 976773119 (199387136) which is very close to what is showing for MS Data below. TestDisk 7.0-WIP, Data Recovery Utility, January 2015 Christophe GRENIER <[email pr

  • BAPI_PO_CREATE1 - Message ME 887

    Hi, I searched forums about this message but i couldnt get a proper answer. I have customer fields in header lvl all character type Z001     ZZ0001     CHAR     20 Z002     ZZ0002     CHAR     20 Z003     ZZ0003     CHAR     1 Z004     ZZ0004     CHA

  • CUCM using Vmware harware version 9 on UCS

    Hi Does anyone knows  if CUCM is compatible with VMware Hardware version 9 on UCS? Regards,          - Alex

  • Deploy WAR file to HANA XS

    Hi Experts, I have one WAR file created ( it is a static web project ). Can I deploy the war file to HANA XS engine ? Sreehari

  • Desperate Help needed with the 4Hi 8x16x48x

    Hi all, that my first post. I was wondering if any of you guys could help.I've got a 48*16*48*. I've used it for a couple of times but now it doesn't seem to work, it takes ages to read and sometimes it doesn't detect the Cd.Is something wrong with t