Program to upload data from a tab-delimited file ...

I have to upload data from a tab-delimited file with following fields into database table(ZCBU) with same fields:
CBU (parent)
KUNNR (child)
ERDAT (effective from)
MANDT (client)
SFID (salesforce ID)
AEDAT (effective to)
AENAM (assigned by).
This file can be of type PC(txt) or UNIX.
plz tell me how to do this in both type of files

Hi,
DATA: bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
DATA: xfile TYPE string.
DATA: BEGIN OF itab OCCURS 0,
        empno TYPE zmemp-empno,
        name  TYPE zmemp-first_name,
        last  TYPE zmemp-last_name,
        comp  TYPE zmemp-comp,
        place TYPE zmemp-place,
        END OF itab.
PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Form to get the file path of legacy data stored on presentation server
  PERFORM get_file_path.
START-OF-SELECTION.
  MOVE p_file TO xfile.
to get the data from excel sheet data into an internal table
  PERFORM get_data.
  LOOP AT itab .
    REFRESH bdcdata.
    PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9001'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'S9001_EMPNO'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=CREA'.
    PERFORM bdc_field       USING 'S9001_EMPNO'
                                  itab-empno.
    PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9002'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'S9002_PLACE'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=SAVE'.
    PERFORM bdc_field       USING 'S9002_EMPNO'
                                  itab-empno.
    PERFORM bdc_field       USING 'S9002_FIRST_NAME'
                                  itab-name.
    PERFORM bdc_field       USING 'S9002_LAST_NAME'
                                  itab-last.
    PERFORM bdc_field       USING 'S9002_COMP'
                                  itab-comp.
    PERFORM bdc_field       USING 'S9002_PLACE'
                                  itab-place.
    PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9001'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'S9001_EMPNO'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=BACK'.
    CALL TRANSACTION 'ZMEMP'
    USING bdcdata
    UPDATE 'A'
    MODE   'N'.
  ENDLOOP.
       Start new screen                                              *
FORM bdc_dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
ENDFORM.                    "BDC_DYNPRO
       Insert field                                                  *
FORM bdc_field USING fnam fval.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
ENDFORM.                    "BDC_FIELD
*&      Form  get_file_path
FORM get_file_path .
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    CHANGING
      file_name = p_file.
ENDFORM.                    " get_file_path
*&      Form  get_data
FORM get_data .
  DATA : lines1 TYPE i.
  MOVE p_file TO xfile.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename            = xfile
      filetype            = 'ASC'
      has_field_separator = 'X'
    TABLES
      data_tab            = itab.
  DESCRIBE TABLE itab LINES lines1.
  WRITE : / lines1 , 'REcords uploaded' .
ENDFORM.                    " get_data
Regards,
Nihar Swain,

Similar Messages

  • Acquire data from a tab delimited file using a popup dialog object on a stamp

    I am trying to import data from a tab delimited file using a popup dialog object on a stamp.  I have purchased the book by Thom Parker--All About PDF Stamps in Acrobat and Paperless Workflows and have been working through the examples in the appendix.
    My problem is understanding how to bring the data into the dialog object from the file.
    I don't want to plagiarize his book--so am electing at this time not to show my code.  The  script is reading the file, just not bringing in the records from the file so that I can select which line to import into the stamp.
    I have typed in the code exactly how the book describes, but when the popup dialog object is selected, there is nothing in the drop-down.  When I click OK, the first record is put on the stamp--except for the fields that I am wanting to appear in the dialog object popup box.
    I have searched the forums, and also the JavaScript reference.  There are examples of the popup dialog object, but none of them show how to import the data from a file--just for the items to be typed in as the list.
    Any help would be greatly appreciated!  i have been trying to work on this for several months now.

    Karl
    Thank you for getting back with me!
    In answer to your questions:
    1. Your trusted function is not a trusted function. Did you put this
    function into a folder level script so that it will get executed at system
    startup?--
         yes--I saved the script as a .js file and put it in the following path (I have Acrobat XI Pro for Windows)
    C:\Documents and Settings\tjohnson\Application Data\Adobe\Acrobat\Privileged\11.0\JavaScripts\GetTabData.js
    2. The script cannot find your tab delimited data file, or it cannot
    extract the data. Did you add the data file in the correct location? The
    location from the script in the book would be c:\mydata\Contacts.txt
    Yes--the file is in the same path as the book.
    Below is my code that references the file.
    var cPath = "/c/mydata/Contacts.txt";
    the slashes in the book go in the direction of the text above--should they go in the direction that you have in your question?
    Also,  the name and email address need to be separated by one Tab character.
    They are. 
    3. The fields need to be named the same way as the columns in the data file (the two names are in the first line of the file).
    My headings are RevByFromTab and EmailFromTab--which match the names of the two fields on the stamp.
    So, check that you are not getting any errors in the JavaScript console
    (Ctrl-J or Cmd-J), and verify that the tab delimited file is in the correct
    location
    When I run in the java script console--and I just run the script on the stamp,
    it says
    TypeError: event.source is null
    17:Console:Exec
    undefined
    When I place the stamp on the page, the popup box is working, but when you click on the down arrow, there is nothing listed.  When I click OK, the RevByFromTab is populated by the first item in the file, but the EmailFromTab field says undefined.
    Thank you
    Message was edited by: tdjohnson7700

  • GUI_UPLOAD can't upload data in a tab-delimited text file

    Hi.
    I was trying to upload data in a tab-delimited textfile.
    I could do it for a ASC textfile (by setting FILETYPE = 'ASC'), but I couldn't do it for a tab-delimited textfile (by setting FILETYPE = 'DAT').
    Any help is appreciated.

    hi kian,
    If u r using DAT file then HAS_FIELD_SEPERATOR should contain X.
    <b>check the following code:</b>
    parameters: p_file  like rlgrap-filename. " File Name.
    call function 'GUI_UPLOAD'
        exporting
          filename              =  p_file      " NAME of the file
    <b>  filetype                = 'DAT'
          has_field_separator     = 'X '</b>  "  <b>X  indicates Fields are separated by tabs.</b>
        tables
          data_tab                = t_file   " Internal table that contains the file 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.
    <b>IF the file type is DAT then following rules applies.</b>
    The components of the internal table are filled from the file. If the
    table contains several columns, the entries in the file must be
    separated by tabs. No conversion exits are carried out.
    The following applies for the different data types:
      -   I or N or P or F
       The numbers must be formatted according to the decimal representation
       defined in the user settings.
        -   D
       The date must be defined according to the date format defined in the
       user settings.
        -   T
       The time must have the format hh:mm:ss.
    Reward me if useful...
    Harimanjesh AN

  • Trouble importing contacts from a tab-delimited file into Contacts on 10.9.5

    I am having Trouble importing contacts from a tab-delimited file into Contacts on MacBook Pro, OS 10.9.5, Intel 2.4 GHz Core 2 Duo., 400GB drive, 4GB memory DDR3
    So far I have:
    - Followed closely the help screen in Contacts app
    - Modified my source document meticulously - first in MS Word, then copied and tweaked in Apple's "Text Edit" app
    - The problem arises when I go to access the document for import.  Specifically, the target document, and all others in that file, are "greyed out" and thus can't be "opened" to facilitate the import process
    - Tried changing the extension of the document name to ".txt", ".rtf", and ".rtd". No change or improvement.
    - Searched Apple.com/help and found nothing relevant
    Can anyone offer some advice or tell me what I may be overlooking in this process?
    Any help will be greatly appreciated!
    Thanks,
    <Email Edited By Host>

    Hi Rammohan,
    Thanks for the effort!
    But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
    Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields.  I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
    Moreover I have about 10 such work areas.  so the effort would be ten times the above effort! I want to avoid this! Please help!
    I would be very grateful if you could provide an alternative solution.
    Thanks once again,
    Best Regards,
    Vinod.V

  • Which CKM is used for moving data from Oracle to delimited file ?

    Hi All
    Please let me know Which CKM is used for moving data from Oracle to delimited file ?
    Also is there need of defining each columns before hand in target datastore. Cant ODI take it from the oracle table itself ?

    Addy,
    A CKM is a Check KM which is used to validate data and log errors. It is not going to assist you in data movement. You will need an LKM SQL to File append as answered in another thread.
    Assuming that you have a one to one mapping, to make things simpler you can duplicate the Oracle based model and create a file based model. This will take all the column definitions from the Oracle based model.
    Alternatively, you can also use an ODI tool odiSQLUnload to dump the data to a file
    HTH

  • Import text into a form from a tab delimited file using an action

    Good evening.
    I am using Adobe Acrobat XI Pro
    I have been working all weekend so far on this, and have tried many options.
    What I am wanting is to import a line of data from an excel file into a form, save the file with a name drived from the form fields, close the new file, then go back to the original file, import a line of data, and so on and so on.
    I had all of this working in livecyle with a tool, but now that we are going to Windows 8 and Microsoft Office 2013, the driver that I need to load the excel file into the form is not available--so now I have to redo the forms in Adobe and import using a tab delimited file.
    I would like to do this with an action.
    Thus far, I have the following.
    **Credit goes to George Johnson who helped me with the script to save the file using field names a few months ago**
    To start, I have a folder level script
    mySaveAs = app.trustPropagatorFunction(function(doc,path)
    app.beginPriv();
    var myDoc = event.target;
    myDoc.saveAs(path);
    app.endPriv();
    myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path)
    //privileged and/or non-privileged code above
    app.beginPriv();
    mySaveAs(doc, path);
    app.endPriv
    //Privileged and/or non-privileged code below
    For the Action, I start with the Form file loaded
    Then I execute a javascript to import the text into the file.
    this.importTextData("/c/data/clerical.txt");
    The next step is to save the file using field names as part of the file name
    --credit goes to George Johnson who assisted me with this on a similar project a few months ago.
    //Get the Field Value
    var fn=getField("Last").valueAsString + "-" + getField("First").valueAsString;
    //Specify the folder
    var fldr = "/c/data/";
    //Determine the full path
    var fp=fldr + fn + ".pdf";
    //save the file
    myTrustedSpecialTaskFunc(this, fp);
    That is as far as I have gotten. 
    What I want to do now is load the original form file, import the next line into the form, save the file, repeat.
    If anyone could assist me, I would greatly appreciate it.
    **note  I had to type this from my I-pad because I kept getting kicked off the internet from my computer.  I hope my code is typed correctly.

    George
    Thank you so much for your response.
    Yes--there are multiple lines in the data file--it will vary from month to month.  It looks like from what you are saying is that I need to do the global variable since it will constantly change, and then increment it as it goes through the text file.  When it reaches the end, then it will stop.
    I looked at the following links--but this is from Adobe 9 API--I don't know if things have changed with XI--especially since 9 used batch processing and XI has actions.
    Count PDF Files
    http://help.adobe.com/livedocs/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/js/html/ wwhelp.htm?href=JS_API_AcroJS.88.1.html
    Global counter
    http://help.adobe.com/livedocs/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/js/html/ wwhelp.htm?href=JS_API_AcroJS.88.1.html
    I am not exactly sure how to include this in my code.
    If you could point me in the right direction, I would appreciate it.

  • Changes in BDC program to upload data from text/excel file

    Hi friends i have obtained the BDc program after recording :
    start-of-selection.
    perform open_group.
    perform bdc_dynpro      using 'SAPLCOIH' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-GSBER'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'AUFPAR-PM_AUFART'
                                  'PM01'.
    perform bdc_field       using 'CAUFVD-IWERK'
                                  '460a'.
    perform bdc_field       using 'CAUFVD-GSBER'
                                  '2460'.
    perform bdc_field       using 'CAUFVD-EQUNR'
                                  '10000009'.
    perform bdc_dynpro      using 'SAPLCOIH' '3000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'CAUFVD-KTEXT'
                                  'abc'.
    perform bdc_field       using 'CAUFVD-INGPR'
                                  'GM'.
    perform bdc_field       using 'CAUFVD-VAPLZ'
                                  'RTN_VELR'.
    perform bdc_field       using 'CAUFVD-VAWRK'
                                  '460A'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-GLTRP'.
    perform bdc_field       using 'CAUFVD-GSTRP'
                                  '1.8.2010'.
    perform bdc_field       using 'CAUFVD-GLTRP'
                                  '1.8.2010'.
    perform bdc_field       using 'CAUFVD-TPLNR'
                                  'RTNP-HIG'.
    perform bdc_field       using 'CAUFVD-EQUNR'
                                  '10000009'.
    perform bdc_field       using 'AFVGD-INDET'
                                  '1'.
    perform bdc_field       using 'AFVGD-WERKS'
                                  '460A'.
    perform bdc_field       using 'AFVGD-STEUS'
                                  'PMIN'.
    perform bdc_field       using 'AFVGD-ARBEH'
                                  'H'.
    perform bdc_field       using 'AFVGD-DAUNE'
                                  'H'.
    perform bdc_dynpro      using 'SAPLCOIH' '3000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CAUFVD-KTEXT'.
    perform bdc_field       using 'CAUFVD-KTEXT'
                                  'abc'.
    perform bdc_field       using 'CAUFVD-INGPR'
                                  'GM'.
    perform bdc_field       using 'CAUFVD-VAPLZ'
                                  'RTN_VELR'.
    perform bdc_field       using 'CAUFVD-VAWRK'
                                  '460A'.
    perform bdc_field       using 'CAUFVD-GSTRP'
                                  '01.08.2010'.
    perform bdc_field       using 'CAUFVD-GLTRP'
                                  '01.08.2010'.
    perform bdc_field       using 'CAUFVD-TPLNR'
                                  'RTNP-HIG'.
    perform bdc_field       using 'CAUFVD-EQUNR'
                                  '10000009'.
    perform bdc_field       using 'AFVGD-LTXA1'
                                  'abc'.
    perform bdc_field       using 'AFVGD-INDET'
                                  '1'.
    perform bdc_field       using 'AFVGD-ARBPL'
                                  'RTN_VELR'.
    perform bdc_field       using 'AFVGD-WERKS'
                                  '460A'.
    perform bdc_field       using 'AFVGD-STEUS'
                                  'PMIN'.
    perform bdc_field       using 'AFVGD-ARBEH'
                                  'H'.
    perform bdc_field       using 'AFVGD-DAUNE'
                                  'H'.
    perform bdc_transaction using 'IW31'.
    perform close_group.
    after executing it has two options.one is for call transactioin and other is for with session.Now i want to do the uploading from text file.Please guide me how to achieve that and what should be the order of fields in the text file.I am just a beginner.I know how to do that with LSMW bt trying BDc first time for creating PM orders

    You can use class "cl_gui_frontend_services". First you must select file with "file_open_dialog" method and the you can upload file with "gui_upload" method into internal table. Here is a sample: (I didn't try the code but I'm sure you can get it working, there are lots of sample codes about that. You can also search FM "GUI_UPLOAD").
    REPORT  zreport.
    DATA:
    gv_subrc TYPE sysubrc,
    gv_result TYPE abap_bool,
    gt_data_tab type table of zstruc.
    PARAMETERS: p_fname LIKE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
        PERFORM file_open_dialog USING space space space space
                            CHANGING p_fname gv_action gv_subrc.
    START-OF-SELECTION.
    PERFORM gui_upload TABLES gt_data_tab
                     USING p_fname  CHANGING gv_subrc.
    *** FORMS ***
    FORM file_open_dialog USING pv_window_title
                                pv_default_extension
                                pv_default_filename
                                pv_initial_directory
                       CHANGING pv_filename
                                pv_user_action
                                pv_subrc.
      DATA:
      lt_file_table TYPE filetable,
      lv_rc         TYPE i,
      lv_initial_directory TYPE string.
      IF pv_initial_directory IS INITIAL.
        PERFORM get_desktop_directory CHANGING lv_initial_directory.
      ELSE.
        lv_initial_directory = pv_initial_directory.
      ENDIF.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = pv_window_title
          default_extension       = pv_default_extension
          default_filename        = pv_default_filename
    *     file_filter             =
    *     with_encoding           =
          initial_directory       = lv_initial_directory
    *     multiselection          =
        CHANGING
          file_table              = lt_file_table
          rc                      = lv_rc
          user_action             = pv_user_action
    *     file_encoding           =
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5
      pv_subrc = sy-subrc.
      IF pv_subrc EQ 0.
        READ TABLE lt_file_table INTO pv_filename INDEX 1.
      ENDIF.
    ENDFORM.
    FORM gui_upload TABLES pt_data_tab
                     USING pv_filename
                  CHANGING pv_subrc    TYPE sysubrc.
      DATA:
      lt_data_tab TYPE TABLE OF string,
      lv_filename TYPE string.
      lv_filename = pv_filename.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename                = lv_filename
          filetype                = 'ASC'
         has_field_separator     = 'X'
    *     header_length           = 0
    *     read_by_line            = 'X'
    *     dat_mode                = SPACE
    *     codepage                = SPACE
    *     ignore_cerr             = ABAP_TRUE
    *     replacement             = '#'
    *     virus_scan_profile      =
    *     show_transfer_status    = 'X'
    *   IMPORTING
    *     filelength              =
    *     header                  =
        CHANGING
          data_tab                = lt_data_tab
        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
          not_supported_by_gui    = 17
          error_no_gui            = 18
          OTHERS                  = 19
      pv_subrc = sy-subrc.
      IF pv_subrc EQ 0.
        pt_data_tab[] = lt_data_tab[].
      ENDIF.
    ENDFORM.

  • Problem in Uploading Data using a Tab Separated File?

    Hi All,
    I am trying to upload a file which tab separated containing customer and bank details and my file structure somewhat in the following manner.
    10     21169     abcde     xyz     kdHDHLk     gdh     ghgah  (Customer Details)
    20     21169     DE     20050000     01122334  (bank details for customer 21169)
    20     21169     DE     23022200     1122334455
    (bank details for customer 21169)
    20     21169     DE     23984899     223344556    (bank details).
    But when I am trying to intial upload the details to an internal table using GUI_upload FM and display to check if it is loading correctly or not it is not giving me any o/p.
    I am copying the code which I am trying to execute. Please tell me what way I need to modify the code so that it executes correctly.
    parameters: p_file type rlgrap-filename.
    data: begin of wa_file,
          text(256) type c,
          end of wa_file.
    data: it_file like table of wa_file.
    types: begin of ty_kna1,
           kunnr type kunnr,
           name1 type name1,
           sortl type sortl,
           stras type stras,
           ort01 type ort01,
           land1 type land1,
           spras type spras,
           end of ty_kna1.
    data: it_kna1 type standard table of ty_kna1,
          wa_kna1 type ty_kna1.
    types: begin of ty_knbk,
           kunnr type kunnr,
           banks type knbk-banks,
           bankl type knbk-bankl,
           bankn type knbk-bankn,
           end of ty_knbk.
    data: it_knbk type standard table of ty_knbk,
          wa_knbk type ty_knbk.
    data: v_id(2).
    At Selection-Screen on Value-Request for p_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
       DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_file
    Start-of-Selection.
    data: p_file1 type string.
          p_file1 = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = p_file1
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = it_file
    * 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.
    constants: c_tab type X value '09'.
    loop at it_file into wa_file.
    if wa_file+0(2) = '10'.
    split wa_file at 'c_tab'
              into v_id
                   wa_kna1-kunnr
                   wa_kna1-name1
                   wa_kna1-sortl
                   wa_kna1-stras
                   wa_kna1-ort01
                   wa_kna1-land1
                   wa_kna1-spras.
    append wa_kna1 to it_kna1.
    elseif wa_file+0(2) = '20'.
    split wa_file at 'c_tab'
           into v_id
                wa_knbk-kunnr
                wa_knbk-banks
                 wa_knbk-bankl
                 wa_knbk-bankn.
    append wa_knbk to it_knbk.
    endif.
    endloop.
    write:/ 'Customer Master General Data'.
    uline.
    loop at it_kna1 into wa_kna1.
    write:/ wa_kna1-kunnr,
             wa_kna1-name1,
                   wa_kna1-sortl,
                   wa_kna1-stras,
                   wa_kna1-ort01,
                   wa_kna1-land1,
                   wa_kna1-spras.
    endloop.
    clear wa_kna1.
    skip 2.
    write:/ 'Customer Master Bank Data'.
    uline.
    loop at it_knbk into wa_knbk.
    write:/ wa_knbk-kunnr,
             wa_knbk-banks,
             wa_knbk-bankl,
             wa_knbk-bankn.
    endloop.
    clear wa_knbk.
    Regards,
    MD

    Declare Class cl_abap_char_utilities
    Use File type as 'DBF'
    Has_field_seperator = w_tab in FM GUI_UPLOAD
    DATA: w_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
        CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
        BIN_FILESIZE                    =
          filename                        = w_file
       filetype                        = 'DBF'
        append                          = ' '
       write_field_separator           = w_tab
        TABLES
          data_tab                        = it_extractchar
       fieldnames                      = it_header
    EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       OTHERS                          = 22

  • Split tab delimited file

    Hiall,
    I filled an internal table with the data from a tab delimited file (trought the FM FTP_TOR3).
    All my date is in the internal table, but I want to split it now. I tried with the '#' (as ALT + 3), but he doesn 't split the line.
    I'm on 4.6, so I cannot use the horizontal_tab as splitter

    While I was searching on this forum on unicode-characters (had a feeling it was something like this), I found  a post with practicly the same problem (but with a somewhat bizarre title ), there they told me to use this :
    data : c_tab type x value '09'.
    as splitter. Apparently, it has something to do with Unix unicode, and the windows # differs from the Unix #.
    Problem solved, thanks for the help
    (awarded you 10 points for the help )
    kr
    Björn

  • Upload tab-delimited file from the application server to an internal table

    Hello SAPients.
    I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
    I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
    Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
    Thank you in advance for your help.

    Try:
    REPORT ztest MESSAGE-ID 00.
    PARAMETER: p_file LIKE rlgrap-filename   OBLIGATORY.
    DATA: BEGIN OF data_tab OCCURS 0,
          data(4096),
          END   OF data_tab.
    DATA: BEGIN OF vendor_file_x OCCURS 0.
    * LFA1 Data
    DATA: mandt  LIKE bgr00-mandt,
          lifnr  LIKE blf00-lifnr,
          anred  LIKE blfa1-anred,
          bahns  LIKE blfa1-bahns,
          bbbnr  LIKE blfa1-bbbnr,
          bbsnr  LIKE blfa1-bbsnr,
          begru  LIKE blfa1-begru,
          brsch  LIKE blfa1-brsch,
          bubkz  LIKE blfa1-bubkz,
          datlt  LIKE blfa1-datlt,
          dtams  LIKE blfa1-dtams,
          dtaws  LIKE blfa1-dtaws,
          erdat  LIKE  lfa1-erdat,
          ernam  LIKE  lfa1-ernam,
          esrnr  LIKE blfa1-esrnr,
          konzs  LIKE blfa1-konzs,
          ktokk  LIKE  lfa1-ktokk,
          kunnr  LIKE blfa1-kunnr,
          land1  LIKE blfa1-land1,
          lnrza  LIKE blfa1-lnrza,
          loevm  LIKE blfa1-loevm,
          name1  LIKE blfa1-name1,
          name2  LIKE blfa1-name2,
          name3  LIKE blfa1-name3,
          name4  LIKE blfa1-name4,
          ort01  LIKE blfa1-ort01,
          ort02  LIKE blfa1-ort02,
          pfach  LIKE blfa1-pfach,
          pstl2  LIKE blfa1-pstl2,
          pstlz  LIKE blfa1-pstlz,
          regio  LIKE blfa1-regio,
          sortl  LIKE blfa1-sortl,
          sperr  LIKE blfa1-sperr,
          sperm  LIKE blfa1-sperm,
          spras  LIKE blfa1-spras,
          stcd1  LIKE blfa1-stcd1,
          stcd2  LIKE blfa1-stcd2,
          stkza  LIKE blfa1-stkza,
          stkzu  LIKE blfa1-stkzu,
          stras  LIKE blfa1-stras,
          telbx  LIKE blfa1-telbx,
          telf1  LIKE blfa1-telf1,
          telf2  LIKE blfa1-telf2,
          telfx  LIKE blfa1-telfx,
          teltx  LIKE blfa1-teltx,
          telx1  LIKE blfa1-telx1,
          xcpdk  LIKE  lfa1-xcpdk,
          xzemp  LIKE blfa1-xzemp,
          vbund  LIKE blfa1-vbund,
          fiskn  LIKE blfa1-fiskn,
          stceg  LIKE blfa1-stceg,
          stkzn  LIKE blfa1-stkzn,
          sperq  LIKE blfa1-sperq,
          adrnr  LIKE  lfa1-adrnr,
          mcod1  LIKE  lfa1-mcod1,
          mcod2  LIKE  lfa1-mcod2,
          mcod3  LIKE  lfa1-mcod3,
          gbort  LIKE blfa1-gbort,
          gbdat  LIKE blfa1-gbdat,
          sexkz  LIKE blfa1-sexkz,
          kraus  LIKE blfa1-kraus,
          revdb  LIKE blfa1-revdb,
          qssys  LIKE blfa1-qssys,
          ktock  LIKE blfa1-ktock,
          pfort  LIKE blfa1-pfort,
          werks  LIKE blfa1-werks,
          ltsna  LIKE blfa1-ltsna,
          werkr  LIKE blfa1-werkr,
          plkal  LIKE  lfa1-plkal,
          duefl  LIKE  lfa1-duefl,
          txjcd  LIKE blfa1-txjcd,
          sperz  LIKE  lfa1-sperz,
          scacd  LIKE blfa1-scacd,
          sfrgr  LIKE blfa1-sfrgr,
          lzone  LIKE blfa1-lzone,
          xlfza  LIKE  lfa1-xlfza,
          dlgrp  LIKE blfa1-dlgrp,
          fityp  LIKE blfa1-fityp,
          stcdt  LIKE blfa1-stcdt,
          regss  LIKE blfa1-regss,
          actss  LIKE blfa1-actss,
          stcd3  LIKE blfa1-stcd3,
          stcd4  LIKE blfa1-stcd4,
          ipisp  LIKE blfa1-ipisp,
          taxbs  LIKE blfa1-taxbs,
          profs  LIKE blfa1-profs,
          stgdl  LIKE blfa1-stgdl,
          emnfr  LIKE blfa1-emnfr,
          lfurl  LIKE blfa1-lfurl,
          j_1kfrepre  LIKE blfa1-j_1kfrepre,
          j_1kftbus   LIKE blfa1-j_1kftbus,
          j_1kftind   LIKE blfa1-j_1kftind,
          confs  LIKE  lfa1-confs,
          updat  LIKE  lfa1-updat,
          uptim  LIKE  lfa1-uptim,
          nodel  LIKE blfa1-nodel.
    DATA: END   OF vendor_file_x.
    FIELD-SYMBOLS:  <field>,
                    <field_1>.
    DATA: delim          TYPE x        VALUE '09'.
    DATA: fld_chk(4096),
          last_char,
          quote_1     TYPE i,
          quote_2     TYPE i,
          fld_lth     TYPE i,
          columns     TYPE i,
          field_end   TYPE i,
          outp_rec    TYPE i,
          extras(3)   TYPE c        VALUE '.,"',
          mixed_no(14) TYPE c        VALUE '1234567890-.,"'.
    OPEN DATASET p_file FOR INPUT.
    DO.
      READ DATASET p_file INTO data_tab-data.
      IF sy-subrc = 0.
        APPEND data_tab.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    * count columns in output structure
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      columns = sy-index.
    ENDDO.
    * Assign elements of input file to internal table
    CLEAR vendor_file_x.
    IF columns > 0.
      LOOP AT data_tab.
        DO columns TIMES.
          ASSIGN space TO <field>.
          ASSIGN space TO <field_1>.
          ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
          SEARCH data_tab-data FOR delim.
          IF sy-fdpos > 0.
            field_end = sy-fdpos + 1.
            ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
    * Check that numeric fields don't contain any embedded " or ,
            IF <field_1> CO mixed_no AND
               <field_1> CA extras.
              TRANSLATE <field_1> USING '" , '.
              CONDENSE <field_1> NO-GAPS.
            ENDIF.
    * If first and last characters are '"', remove both.
            fld_chk = <field_1>.
            IF NOT fld_chk IS INITIAL.
              fld_lth = strlen( fld_chk ) - 1.
              MOVE fld_chk+fld_lth(1) TO last_char.
              IF fld_chk(1) = '"' AND
                 last_char = '"'.
                MOVE space TO fld_chk+fld_lth(1).
                SHIFT fld_chk.
                MOVE fld_chk TO <field_1>.
              ENDIF.       " for if fld_chk(1)=" & last_char="
            ENDIF.         " for if not fld_chk is initial
    * Replace "" with "
            DO.
              IF fld_chk CS '""'.
                quote_1 = sy-fdpos.
                quote_2 = sy-fdpos + 1.
                MOVE fld_chk+quote_2 TO fld_chk+quote_1.
              ELSE.
                MOVE fld_chk TO <field_1>.
                EXIT.
              ENDIF.
            ENDDO.
            <field> = <field_1>.
          ELSE.
            field_end = 1.
          ENDIF.
          SHIFT data_tab-data LEFT BY field_end PLACES.
        ENDDO.
        APPEND vendor_file_x.
        CLEAR vendor_file_x.
      ENDLOOP.
    ENDIF.
    CLEAR   data_tab.
    REFRESH data_tab.
    FREE    data_tab.
    Rob

  • Importing data from tab delimited file

    Hi everyone,
    This is my first question on here so I hope I am doing the right thing.
    I've searched online as much as I can to find an answer or a way to fix my problem but I have not been able to find a resolution.
    My issue is I'm trying to import name and contact information from a excel file, that I have saved as a tab delimited file, into a fillable PDF file. I'm able select the text file through the import option and it shows the correct information as different rows that I can import but when I select one and click on to finish the import of the data I get an error message advising that some of the text could not be imported. The issue is nothing is being imported at all.
    I've made sure that all the relevant fields are the same name as what the form has but still cannot get anything to import.
    Does anyone have any ideas why this may not be working? Also I basically have no ability to write JavaScript to import the information otherwise I would look at travelling down that path.
    Please let me know if I need to be any more specific.
    Regards,
    Adam

    Ok I can share the form itself and will need to quickly create some data itself to go along with it
    PDF Form Shared Files - Acrobat.com 
    Here is the tab delimited file I am trying to use (well the format anyway).
    Test Data File Shared Files - Acrobat.com
    Adam
    Thanks Pat Willener

  • Upload data from excel:can we upload from .csv only?

    Hi Experts,
    Can we upload data from .CSV file only? Is this a limitation in ABAP? What if i have an excel sheet with multiple worksheets and I want to pick data from one of the worksheet. Is this scenario possible?
    Thanks and Regards,
    Rohit

    Hi Rohit.
    In CRM , it works somewhat differently. Following code snippet will help u.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          DEF_FILENAME     = 'p_infile'
          DEF_PATH         = ' '
          MASK             = '*.txt'
          MODE             = '0'
          TITLE            = 'UPLOAD TAB DELIMITED FILE'(078)
        IMPORTING
          FILENAME         = p_infile
    *     RC               =
        EXCEPTIONS
          INV_WINSYS       = 1
          NO_BATCH         = 2
          SELECTION_CANCEL = 3
          SELECTION_ERROR  = 4
          OTHERS           = 5.
      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
    START-OF-SELECTION.
      gd_file = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                    = gd_file
    *   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                   = it_record
    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.
        write: 'Error' , sy-subrc .
        skip.
      ENDIF.

  • UPLOADING tab delimited file onto FTP server

    Hello all
    Can i upload a tab delimited file onto the FTP server. If yes then how
    points guranteed if answered!!

    Hi,
    Yes you can do this one .. you can have a look at the standard program 'RSEPSFTP'.
    REPORT ZFTPSAP LINE-SIZE 132.
    DATA: BEGIN OF MTAB_DATA OCCURS 0,
    LINE(132) TYPE C,
    END OF MTAB_DATA.
    DATA: MC_PASSWORD(20) TYPE C,
    MI_KEY TYPE I VALUE 26101957,
    MI_PWD_LEN TYPE I,
    MI_HANDLE TYPE I.
    START-OF-SELECTION.
    *-- Your SAP-UNIX FTP password (case sensitive)
    MC_PASSWORD = 'password'.
    DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
    *-- FTP_CONNECT requires an encrypted password to work
    CALL 'AB_RFC_X_SCRAMBLE_STRING'
         ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
         ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
         ID 'DSTLEN' FIELD MI_PWD_LEN.
    CALL FUNCTION 'FTP_CONNECT'
         EXPORTING
    *-- Your SAP-UNIX FTP user name (case sensitive)
           USER            = 'userid'
           PASSWORD        = MC_PASSWORD
    *-- Your SAP-UNIX server host name (case sensitive)
           HOST            = 'unix-host'
           RFC_DESTINATION = 'SAPFTP'
         IMPORTING
           HANDLE          = MI_HANDLE
         EXCEPTIONS
           NOT_CONNECTED   = 1
           OTHERS          = 2.
    CHECK SY-SUBRC = 0.
    CALL FUNCTION 'FTP_COMMAND'
         EXPORTING
           HANDLE = MI_HANDLE
           COMMAND = 'dir'
         TABLES
           DATA = MTAB_DATA
         EXCEPTIONS
           TCPIP_ERROR = 1
           COMMAND_ERROR = 2
           DATA_ERROR = 3
           OTHERS = 4.
    IF SY-SUBRC = 0.
      LOOP AT MTAB_DATA.
        WRITE: / MTAB_DATA.
      ENDLOOP.
    ELSE.
    * do some error checking.
      WRITE: / 'Error in FTP Command'.
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
         EXPORTING
           HANDLE = MI_HANDLE
         EXCEPTIONS
           OTHERS = 1.  
    Regards
    Sudheer

  • Detecting line-breaks within a column of an uploaded tab-delimited file.

    Suppose you upload a tab-delimited file from your laptop and split each row of the file into some structure that you append to an itab.
    Is there a way inside ABAP to detect that a field of the uploaded file has a CR or CRLF in it?  And if so, where it is ?
    Thanks in advance ...

    You can use any of the following for those char.
    DATA:   head_crnl(1)   TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              top_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              end_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              blank_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              final_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              first_pgbr(1)  TYPE c VALUE cl_abap_char_utilities=>form_feed.
    Declare the above variables and check if they occur in the file. Hope this helps.

  • Functions to upload UNIX tab-delimited file

    plz tell me  lists of  Functions to upload UNIX tab-delimited file in the database table

    HI,
    data : itab like standard table of ZCBU.
    ld_file = p_infile.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
          MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
          APPEND wa_upload TO it_record.
        ENDIF.
      ENDDO.
      CLOSE DATASET ld_file.
    ENDIF.
    loop at it_record.
    itab-field1 = it_reocrd-field1.
    itab-field2 = it_record-field2.
    append itab.
    endloop.
    *-- Now update the table
    modify ZCBU from table itab.

Maybe you are looking for

  • How to create event handler in project online

     how to create a remote event handler for project online... i want to create a event handler onprojectcreating using CSOM...need Help..

  • How do I install a certificate?

    I need to install / import a certificate in order to access a website for which I have an account. How do I do this? Any help would be greatly appreciated.

  • Why does my ibooks keep blacking out or shutting down

    Why does my ipad keep turning off in ibook use

  • How to move NEF pictures in a folder on my desktop

    Hi all, I'm new to mac and have been playing a bit with iPhoto and it really seems great. Here is my problem, I have a D90 which takes JPG and NEF pictures at the same time. When I import my pictures in iPhoto it puts both files next to each other. H

  • Want to put 2 pages on one sheet

    Windows Adobe Acrobat 7.0 Professional I have copied a camera manual as a .pdf file. The pages are small enough that I want to put two pages on one 8 1/2 x 11 sheet. When I have only one page per sheet, the image on the screen and on the printed page