Doubt in GUI_UPLOAD function

Hi friends,
CALL FUNCTION 'GUI_UPLOAD '
EXPORTING
FILENAME = FILE
FILETYPE = 'ASC'
*HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = ITAB.
In the GUI_UPLOAD function what the filetype should be and has_field_separator should be given what value? What does it mean.How should i prepare the file for example for VA01 transaction if i have a file like this it is not working. What is the problem. I am new to BDC so i need your help on this.
Thanks in Advance.

try the following.
DATA: begin of ITAB occurs 0,
      field1 type char10,
      field2 type char10,
      end of itab.
data: filename type string value 'C:\TMP.TXT'.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
   FILENAME                      = filename
   FILETYPE                      = 'ASC'
  TABLES
    DATA_TAB                      = itab.
loop at itab.
  write:/ itab-field1, 20 itab-field2.
endloop.
create a file with tab-delimitations.

Similar Messages

  • Change from UPLOAD to GUI_UPLOAD  function module

    pls  let me know that  wat are  the  changes that should be made if  the report  currently using UPLOAD function module and it should be  replaced with GUI_UPLOAD  function module ..
    wat should be the TYPE of  file name and File type ????????  with the respect to changes ....
    thanks . in advance..

    Check out this thread to find the answer
    UPLOAD and GUI_UPLOAD
    Regards,
    Santosh

  • Help me on using GUI_UPLOAD function

    Dear my friends,
    I am using GUI_UPLOAD function to upload a file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
      filename contain file path
        FILENAME                      = filepath
      filetype is ASC
        FILETYPE                      = 'ASC'
      Use tab key to seperate field
        HAS_FIELD_SEPARATOR           = ','
      Internal table keep data from file by function GUI_UPLOAD
        TABLES
            data_tab   =   tblTrantable.
    but it did not work for HAS_FIELD_SEPARATOR option.
    although i tried to use HAS_FIELD_SEPARATOR = '#'
    but system still return by fix lengh data column not by separator.
    <u>note : my SAP version = 4.6C</u>
    Please help me,
    Thanks !
    Message was edited by:
            Quoc Luc Nguyen
    Message was edited by:
            Quoc Luc Nguyen

    hi,
    set has field separartor to 'x'.
    chk this FM for example:
    CALL FUNCTION 'GUI_UPLOAD'
         EXPORTING
           FILENAME                      = W_FILENAME1
          FILETYPE                      = W_FILETYPE1
          HAS_FIELD_SEPARATOR           = 'X'
         HEADER_LENGTH                 = 0
         READ_BY_LINE                  = 'X'
          DAT_MODE                      = 'X'
         CODEPAGE                      = ' '
         IGNORE_CERR                   = ABAP_TRUE
         REPLACEMENT                   = '#'
         CHECK_BOM                     = ' '
         VIRUS_SCAN_PROFILE            =
         NO_AUTH_CHECK                 = ' '
       IMPORTING
         FILELENGTH                    =
         HEADER                        =
         TABLES
           DATA_TAB                      = IT_UPLOAD
        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.
    regards,
    keerthi

  • Where does GUI_UPLOAD function store the files?

    Where does GUI_UPLOAD function store the files?

    Hi Audrey
    Here is an example of accessing files from application server: 
    open dataset w_file for input in text mode.
      if sy-subrc <> 0.
        message e895 with 'Unable to locate file'.
      else.
        do.
          read dataset w_file into it_data.
          if sy-subrc eq 4.            " End of file reached
            clear it_data.
            exit.
          else.
            append it_data.
            clear it_data.
          endif.
        enddo.
        close dataset w_file.
    In the above example, w_file is declared as string containing  c:\usr\sap\test.txt
    And this file should be there on this path on application server.
    And, yes, you need to declare it_data as an internal table containing fields corresponding to file from which you are reading data.
    Regards
    Ashish Jain
    [email protected]

  • Problem in GUI_UPLOAD function module

    Hi Folks,
    I am in the BI system where I have limited scope of upload function module, So I used GUI_UPLOAD as a upload function module.
    I am uploading CSV file and which have amount field (with comma ',' ) as one of the column , So it is truncating the other columns while retrieving data into internal table and giving wrong data in columns.
    Any other Function module, or tricks to upload file which have ',' in one of the column.
    Thanks
    PP

    Hi,
    Well in this case you will have to change the file format i.e. Instead of CSV make it tab delimited etc.
    Else change the amount value by replacing comma(which woud be a tedious task).
    There is no other alternative.
    Best regards,
    Prashant

  • Gui_upload function

    Hi experts,
    I used function gui_upload - to upload excel file.
    the data i get is that the cells is seperated by ','.(name,age,mail,,,,)
    i want to take this data and put it in a structure, that each cell will be in
    seperate in the structure.
    how can i put this data in my structure?
    thanks,
    Michal.

    i figure it out thanks.

  • GUI_UPLOAD Function Module in 4.6C does not split into lines

    Dear All,
    I'm about to upload text file into SAP using the FM 'GUI_UPLOAD'.
    Previously I've developed a test program to upload the same file in SAP v4.7
    and it returns correctly into several lines as expected.
    Snippet:
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = l_filename
          filetype                        = 'ASC'
          has_field_separator       = ' '
          header_length               = 0
          read_by_line                  = 'X'
        TABLES
          data_tab                      = gt_tabfile
    As we can see, the 'read_by_line' parameter is already 'X'. gt_tabfile only consist of 1 string column.
    But as I run the same code using the same parameter and file in SAP v4.6C
    it returned only 1 line of very long string instead of the correct lines resulted in 4.7.
    Is there anything to do with codepage (4.6 is English 1100, I forgot the codepage in 4.7 but i believe it's the same due to language selection is EN). Or anything to do with OSS Note?
    Kindly help me to resolve the issue.
    Appreciate it very much

    Thank you for trying to help.
    Please be noted I've done all the possible value on these parameter
    -   filetype 'ASC' OR 'BIN'
    -  has_field_separator ' ' or 'X'
    -  header_length 0 or 1 which is dont make sense since my file dont have header so must be 0
    -  read_by_line ' ' of 'X' doesnt work my expectation.
    Any other good questions please? How 4.6C and 4.7 above make a different result?

  • Doubt in ABAP function

    Hi,
    I have a doubt in one of the abap function module i use.
    This contain code to retrieve ,update and delete and create values in table. I am using this function  module to
    retrieve ,update and delete and create values in table.  This is the ABAP code.
    FUNCTION ZUP_DESIG12.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(DESG_CODE) TYPE  ZUP_DESIG-DESG_CODE OPTIONAL
    *"     VALUE(DESG_DESC) TYPE  ZUP_DESIG-DESG_DESC OPTIONAL
    *"     VALUE(DESG_ACT) TYPE  ZUP_DESIG-DESG_ACT OPTIONAL
    *"     VALUE(DESG_OPT) TYPE  ZUP_DESIG-DESG_OPT OPTIONAL
    *"  EXPORTING
    *"     VALUE(DESG_CODE_C) TYPE  ZUP_DESIG-DESG_CODE
    *"     VALUE(DESG_DESC_C) TYPE  ZUP_DESIG-DESG_DESC
    *"     VALUE(DESG_ACT_C) TYPE  ZUP_DESIG-DESG_ACT
    *"     VALUE(DESG_OPT_C) TYPE  ZUP_DESIG-DESG_OPT
    *"  TABLES
    *"      WA STRUCTURE  ZMSTR_DESIG
    DATA CNT TYPE I.
    SELECT MANDT DESG_CODE DESG_DESC DESG_ACT FROM ZMSTR_DESIG
      INTO TABLE WA.
    IF DESG_OPT = 'U'.
    UPDATE ZMSTR_DESIG
        SET DESG_DESC = DESG_DESC
        DESG_ACT = DESG_ACT
        WHERE DESG_CODE = DESG_CODE.
    MESSAGE 'Updated Successfully' TYPE 'I'.
    ELSEIF DESG_OPT = 'C'.
    SELECT COUNT( * ) FROM ZMSTR_DESIG INTO CNT
       WHERE DESG_CODE = DESG_CODE.
       IF CNT > 0.
       MESSAGE 'Duplicate Designation code' TYPE 'I'.
       ELSE.
      WA-DESG_CODE = DESG_CODE.
      WA-DESG_DESC = DESG_DESC.
      WA-DESG_ACT = DESG_ACT.
      MODIFY ZMSTR_DESIG FROM WA.
       MESSAGE 'Inserted successfully' TYPE 'I'.
    ENDIF.
    ELSEIF DESG_OPT = 'D'.
       DELETE FROM ZMSTR_DESIG WHERE DESG_CODE = DESG_CODE.
       MESSAGE 'Deleted successfully' TYPE 'I'.
    ENDIF.
    ENDFUNCTION.
    can any one what is  wrong in this function.
    Regards,
    H.V.Swathi

    My doubt is how to write code to insert data to table. I have written code like this.
    try{
             String str1= wdContext.currentTestElement().getCode();
              String str2= wdContext.currentTestElement().getDesc();
              boolean str3= wdContext.currentTestElement().getAct();
              String str4= wdContext.currentTestElement().getOpt();
              String str5;
              if(str3)
              str5=new String("x");
              else
              str5=new String(" ");
              Zup_Desig12_Input input=new Zup_Desig12_Input();
              input.setDesg_Code(str1);
              input.setDesg_Desc(str2);
              input.setDesg_Act(str5);
              input.setDesg_Opt(str4);
              wdContext.nodeZup_Desig12_Input().bind(input);
              wdContext.currentZup_Desig12_InputElement().modelObject().execute();
        }catch(Exception e)
             wdComponentAPI.getMessageManager().reportSuccess(e.toString());
    But i am getting      java.lang.ArrayIndexOutOfBoundsException: -1
    in line
    input.setDesg_Act(str5);
    can any one help me plz

  • Doubt in keyPressed() function!

    Hi to all,
    Im doing project in J2ME. In my source code, i used keyPressed() function to get the user's choice by using switch case.Now my doubt is, should i use one more keyPressed() function in inside my previous keyPressed() func.(i.e. nested keypressed() func)?.. For eg: In my application, there will be four choices.. 1.Cars 2. Bikes 3.Mobiles 4.exit...If an user press the key '3' means, i need to giv him one more choice screen like 1.Nokia 2.Sony ericsson 3.Motorola.. If an user press '2' means, have to display the info about sony ericsson...Right now im using code like the following:
    public void keyPressed(int key)
    switch(key)
    case KEY_NUM1:
    break;
    case KEY_NUM2:
    break;
    case KEY_NUM3:
    break;
    case KEY_NUM4:
    break;
    Now my doubt is....Should i use like the following:
    public void keyPressed(int key)
    switch(key)
    case KEY_NUM1:
    break;
    case KEY_NUM2:
    break;
    case KEY_NUM3:
    public void keyPressed(int key)
    switch(key)
    case KEY_NUM1:
    break;
    case KEY_NUM2:
    break;
    case KEY_NUM3:
    break;
    case KEY_NUM4:
    break;
    break;
    case KEY_NUM4:
    break;
    }

    My doubt is how to write code to insert data to table. I have written code like this.
    try{
             String str1= wdContext.currentTestElement().getCode();
              String str2= wdContext.currentTestElement().getDesc();
              boolean str3= wdContext.currentTestElement().getAct();
              String str4= wdContext.currentTestElement().getOpt();
              String str5;
              if(str3)
              str5=new String("x");
              else
              str5=new String(" ");
              Zup_Desig12_Input input=new Zup_Desig12_Input();
              input.setDesg_Code(str1);
              input.setDesg_Desc(str2);
              input.setDesg_Act(str5);
              input.setDesg_Opt(str4);
              wdContext.nodeZup_Desig12_Input().bind(input);
              wdContext.currentZup_Desig12_InputElement().modelObject().execute();
        }catch(Exception e)
             wdComponentAPI.getMessageManager().reportSuccess(e.toString());
    But i am getting      java.lang.ArrayIndexOutOfBoundsException: -1
    in line
    input.setDesg_Act(str5);
    can any one help me plz

  • Doubt in using :Function Module : MS_CONVERT_TO_OTHER_CURRENCY

    Hi ,.
    In the Function Module :MS_CONVERT_TO_OTHER_CURRENCY.
    I have to export following parametes:
    DATE            
    FROM_CURRENCY   
    FROM_AMOUNT     
    TO_CURRENCY     
    COMPANY_CURRENCY
    RATE  (optional)    .
    Here my doubt is :what is the purpose of COMPANY_CURRENCY .What value i have to populate here , how i have to find the  company currency?
    I think we have to find this COMPANY_CURRENCY  based on the sales organization.
    Please update me regarding this COMPANY_CURRENCY .
    Thanks,
    Suresh.

    Have you tried using 'CONVERT_TO_FOREIGN_CURRENCY' instead?
    DATA: v_amount TYPE p DECIMALS 2.
    CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
    EXPORTING
    date = sy-datum
    foreign_currency = 'INR'
    local_amount = '1.00'
    local_currency = 'USD'
    IMPORTING
    foreign_amount = v_amount
    EXCEPTIONS
    no_rate_found = 1
    overflow = 2
    no_factors_found = 3
    no_spread_found = 4
    derived_2_times = 5
    OTHERS = 6.
    IF sy-subrc = 0.
    WRITE: / 'US dollar to Indian rupees - ', v_amount.
    ENDIF.

  • Doubt in Analytical Functions

    Hi,
    I am new to oracle , i have a doubt : I have written a query using analytical functions to get the desired , but i wanted the same in a normal query .
    INPUT TABLE :
    NAME AMOUNT
    A 100
    A 200
    A 300
    B 200
    B 300
    C 300
    Query : SELECT name,AMOUNT,ROW_NUMBER( ) OVER (PARTITION BY name order by name NULLS LAST) SRLNO
    FROM data ORDER BY name, SRLNO;
    output table:
    NAME AMOUNT SRLNO
    A 100 1
    A 200 2
    A 300 3
    B 200 1
    B 300 2
    C 300 1
    QUESTION: I wanted the same output table with normal SQL quey , but i don't want to use any partition statement here (nor any analytical functions) .
    Please provide solution for this .

    i don't want to use any partition statement here (nor any analytical functions) .Why not? What you want to do is what analytics does. I get suspicious when anybody - but especially somebody who's new to Oracle - aks how to do something different from using the built-ins provided by Oracle.
    I wanted the same output table with normal SQL queySo you're ruling out Pipelined functions and MODEL clauses? Or not?
    Cheers, APC
    blog : http://radiofreetooting.blogspot.com

  • Doubt in enqueue_array functionality

    Hi,
    I am using enqueue_array function to insert multiple rows in the queue. Payload type is user defined object (obj) containing one attribute: JMS Message. If I create a type (tbl) which is table of obj at the schema level then enqueue_array works perfectly and inserts all the rows into the queue.
    But If I don't declare a type at the schema level and instead declare it in the pl/sql block, then enque_array function doesn't work. I don't get any error but no row gets inserted in the queue.
    My doubt is why no row is getting inserted in the 2nd case? Does Oracle treats the 2 types in different ways? Please clarify. Thank you.

    Hi,
    I am using enqueue_array function to insert multiple rows in the queue. Payload type is user defined object (obj) containing one attribute: JMS Message. If I create a type (tbl) which is table of obj at the schema level then enqueue_array works perfectly and inserts all the rows into the queue.
    But If I don't declare a type at the schema level and instead declare it in the pl/sql block, then enque_array function doesn't work. I don't get any error but no row gets inserted in the queue.
    My doubt is why no row is getting inserted in the 2nd case? Does Oracle treats the 2 types in different ways? Please clarify. Thank you.

  • Doubt on gui_upload

    Hi
    I am working with r/3 version 4.6 B . I ma using gui_upload to read the data froma text file from desktop. the text file contains tow columns of data separated by tab space. when i pass this to the gui_upload the two columns data is going into first column of the internal table. the code is shown below
    DATA : BEGIN OF itab_bdc OCCURS 0,
    konob LIKE table-konob,
    matnr LIKE table-matnr,
    END OF itab_bdc
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = p_file1
    filetype = 'ASC'
    has_field_separator = 'X'
    HEADER_LENGTH = 0
    read_by_line = 'X'
    DAT_MODE = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    CHECK_BOM = ' '
    VIRUS_SCAN_PROFILE =
    NO_AUTH_CHECK = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = itab_bdc
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    when i see the internal table itab_bdc the field konob contains both the columns data of the text file. It is not splitting the konob and matnr data into two different columns. what shd i do ??
    thanks
    sankar

    This question had been answer in other thread...
    [GUI_UPLOAD FM;
    Please do not duplicate threads...Locking this one...
    Greetings,
    Blag.

  • Doubt in update function module

    dear friends..
    i have created an UPDATE function module with Processing type- Update Module, Start Immediate. i have handled the exceptions using Raise statement in the function module..
    the call function looks as..
      CALL FUNCTION 'ZFI_LCTXN_TABLES_UPDATE'
        in update task
        EXPORTING
          ZLCTMB1  = p_lctmb1
          NU_ENTRY = p_global-ins_zlctmb1
        TABLES
          UPD_PO   = UPD_PO
          UPD_SH   = UPD_SH
        EXCEPTIONS
          ERROR    = 1
          OTHERS   = 2.
      p_subrc = sy-subrc.
      commit work.
    but if the update fails, and even though the RAISE ERROR works, and update termination message is registered in SM13, i dont get the value for sy-subrc as 1 .
    is it the right way..if yes please tell me how to generate an error message within the transaction..so that the user knows the update has failed..
    thank you for your time
    Nivin

    Hi,
    Maybe it's usefull  for you.
    <b>
      IF sy-subrc EQ 4.
        MESSAGE e001 RAISING not_found.
      ELSEIF sy-subrc EQ 8.
        MESSAGE e002 RAISING not_found.
      ELSE.
      ENDIF.</b>
    Using this to create a message and raise in the same time !
    Regards.
    Marcelo Ramos

  • Doubt in RFC Function module

    Hi,
    I am creating one RFC in that i need to declare one import parameter whose length is is.
    when i am giving like i_exclide like kna1-loevm is not accepting.
    when i am declaring like i_exclude like char1.
    it is giving error like reference parameters are not allowed in RFC.
    anybody can tell me how to declare.
    thanks,
    maheedhar

    Hi,
    Go to se37,
    Give ur RFC function module and click change.
    Go to "Import" tab , you can find a checkbox "Pass Value" , check this checkbox.
    Now you try to compile the code , you wont get that error.
    Reward points for useful answer.
    Thanks,
    Jey

Maybe you are looking for