Concatenate with 'tab' delimiter in Unicode system

Hi All,
In current system we have a program that creates a tab-delimited file with following code where wa1 and wa2 are character-type fields.
data: delim type x value '09'.   (a tab in hex)
concatenate wa1 delim wa2 into wm_lstfil.
Unicode system won't allow char and hex fields to intermix.  Suggestions on how to replace this code so that we continue to create a tab-delimited output line?
Thanks,
Kirsten

Hi
You can use the following...
CLASS cl_abap_char_utilities DEFINITION LOAD.
DATA: text TYPE string.
<b>Concatenate your data into variable text .... and then,</b>
REPLACE cl_abap_char_utilites=>horizontal_tab WITH space INTO text.
Regards,
Raj

Similar Messages

  • Concatenate with tab delimiter

    Hi,
    I need to put 3 fields in a Unix text file separating them with a tab delimiter.I know How to send it to unix but anyone tell me how I write the concatenate .
    I have another issue ...when I bring it back from unix to r/3...then how should I check for it to split the fields?
    anyone help ASAP
    Message was edited by:
            ramana peddu

    To split use something like this:
    Data: rec_str(180).
    data: F1(60),
            F2(60),
            F3(60)
    do.
      read dataset YourFile into rec_str.
      if sy-subrc <> 0.
         exit.
      endif.
      SPLIT rec_str AT cl_abap_char_utilities=>horizontal_tab INTO F1 F2 F3.
      write:/ F1, F2, F3.
    enddo.

  • Transfer data in unix with tab-delimited

    Hi,
    How can we transfer data to unix with tab-delimited? I have incoming file with tab-delimited and want to copy as backup file in another folder in unix. When I read the incoming file, tab separator is translated into '#' so when I do transfer data to the backup folder, the file contains '#'.
    Is there a way to transfer data in tab-delimited?
    thank you
    alia

    try to use delimiter cl_abap_char_utilities=>HORIZONTAL_TAB.
    here is a piece of code:
    REPORT  ztestfile                               .
    DATA: BEGIN OF gt_file_out OCCURS 0,
            filed(2000),
          END OF gt_file_out.
    START-OF-SELECTION.
      DATA: lv_file_out LIKE filename-fileextern.
      CONCATENATE 'Hello' 'World' INTO gt_file_out SEPARATED
        BY cl_abap_char_utilities=>horizontal_tab.
      APPEND gt_file_out.
      lv_file_out = '
    XXXX\XXXX\mytest1.txt'.
      OPEN DATASET lv_file_out FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      LOOP AT gt_file_out.
        TRANSFER gt_file_out TO lv_file_out.
      ENDLOOP.
      CLOSE DATASET lv_file_out.
    Message was edited by: joseph fryda

  • Download the file in Presentation server with TAB Delimited

    Hi,
    I have to download the data of the finla internal table in presentation servr.
    The oup put file should be TAB Delimited. I can do the same with using LOOP.
    Is there any class or FM to do the same so that the out put file can be TAB Delimited.
    Sandeep

    HI,
    you can use the fm
    GUI_DOWNLOAD
    in that if you see the
    WRITE_FIELD_SEPARATOR - the import parameter, you can use this
    so that the fille will be downloaded with tab delimited.
    Regards,
    Venkatesh

  • Problem with cl_abap_char_utilities= horizontal_tab in Unicode system

    Hello Experts,
    My code in 4.7 system was,
    *DATA: gf_tab TYPE x VALUE '9'.
      CONCATENATE '[bc^bd128]' gp_user gf_tab gp_pw '[/]'
      INTO        gf_anmeldung.
      WRITE:  30  gf_anmeldung.*
    The output will be printed to a barcode printer and we get the barcode.  The barcode contains, the user name, tab delimiter and the password.
    Now, Using a scanner (handheld device) we scan the barcode.  The scanner is connected to the SAP server.  So as we give the user name and the password in the SAP easy access screen, the scanner takes the values from the barcode.  This means, the user name from the barcode ->to the user name field, tab delimter -> to come to the next field, password from the barcode ->to the password field.  This logins the SAP in the handheld device.
    Now, in ECC 6 system, the code was changed as below,
    DATA: gf_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    After this change, now the scanner is not recognizing and throws the error "fill in all the required fields"
    I am not sure, if it is not retrieving the user name or the tab delimiter is creating the problem.
    Any suggestion would be appreciated.
    Cheers,
    Balaji
    Edited by: Balaji Dhandapani on Feb 3, 2010 6:34 PM

    Hi ,
    I think in the older version u r using the '09' as the end of line , So in the barcode it is consideringthe user id and then thinking that end of line and putting the next string say password in the correct postion.
    Try to use the CR_LF( Carriage return and line feed).
    Try this.
    Regards,
    Bharani.

  • Output file as a text file with tab delimited and fixed length fields

    Hi all,
    I have developed a custom report which outputs an excel file on the user desktop who executes that report.Now i need to create an additional (second) excel file with almost the same data as the first file.
    Im using the FM GUI_DOWNLOAD to create the file.i need have the 2nd file as txt file(seperated by space/tab delimited) and also i want the fields to have fixed length.For this format of the file,what parameters do I need to pass to the FM ?
    BR,
    SRM Tech.

    Thanks for the prompt reply.
    Also in the sel screen,Im entering the path where  the o/p file needs to be downloadede.g. C:/Output_folder/Output.xls...Now if I need a text file,do I need to give the fielname as C:/Output_folder/Output.txt.?

  • Building a CSV with TAB Delimited

    Apex 3.1.2
    Customer wants to build a Apex Report with CSV output, but have TAB delimited columns, not comma delimited. Any ideas on how to insert a TAB into the CSV "Separator" column?
    Thanks,
    Dwight

    Thanks Tony.
    Appears that in my version of Apex at least, only one character can be entered in the "Separator" column so putting "\t" doesn't work. Going to massage the file afterwards. Thanks for the help.
    Dwight

  • Problem with FM NAMETAB_GET in Unicode system

    Hi everyone,
    I'm working in a landscape that has a non-unicode development, non-unicode testing, unicode testing and non-unicode production. The intention is to have a unicode production in the future.
    I have an application that has been developed to visualize IDocs so that end users will use this application instead of WE02, WE05, etc (don't know why and this can't be changed). The thing is that this application uses FM NAMETAB_GET to get the fields of the segment, the dictionary length and the offset in order to parse the IDoc.
    In non-unicode systems it works fine, but after testing in the unicode system, we found out that it wasn't parsing right, and the problem is that FM NAMETAB_GET is doubling the length of the fields (I guess because Unicode chars need 2 bytes). So the length and offset are wrong and my segment is parsed incorrectly. Does anyone know how to solve this? Is it anyway to tell this FM to work IN CHARACTER MODE? Remember that I can't divide the lenght by 2 because I have some non-unicode systems in the landscape.
    Best regards and thank you!
    Pablo

    Problem solved, I will directly use FM DDIF_NAMETAB_GET which gives me the desired data in DFIES_TAB: Thanks

  • Help needed with Carriage Return in Unicode system

    Hi Experts,
    we have an issue with one of our programs regarding the carriage return that is used when creating a csv file. This issue has only came about because of the recent upgrade to ECC6.
    The main change to the program was the redefinition of the line feed variable.
    Existing statement was --> DATA: v_lf TYPE x VALUE '0D'.
    This was then replaced with
    New statement --> DATA: v_lf type c VALUE cl_abap_char_utilities=>cr_lf.
    Since this change has been implemented, the csv file that is created and sent on as an attachment via the function SO_NEW_DOCUMENT_ATT_SEND_API1 is now not displayed correctly.
    When looking at the attachment in trn SOST, a message is also displayed saying the file is not in a recognizable format when selecting the file to view.
    The hex value for cl_abap_char_utilities=>cr_lf is 000D000A and this seems to be causing the issue.
    I've also tried using Function FI_DME_CHARATERS as I only really want to use the CR. However, the hex value for this is 000D and not 0D.
    Is there any way of converting this to have a hex value of 0D?
    Thanks in advance,
    Chris

    HI,
    Sorry it is not the CONTENTS_TXT it is CONTENTS_BIN. Instead of CONTENTS_BIN you need to pass to CONTENTS_HEX
    Check my Code..i have used the CONTENTS_HEX instead of CONTENTS_BIN
    DATA: l_tab_lines TYPE i,
            l_string TYPE char300,
            l_line TYPE string.
      CONSTANTS : l_c_255(255)  TYPE c VALUE '255',
                  l_c_txt(3)    TYPE c VALUE 'TXT'.
      DATA: lt_reclist  TYPE STANDARD TABLE OF somlreci1,       "Recipients
            lt_objpack  TYPE STANDARD TABLE OF sopcklsti1,
            lt_objhead  TYPE STANDARD TABLE OF solisti1,
            lt_objtxt   TYPE STANDARD TABLE OF solisti1,     "Body of EMail
            lt_objbin   TYPE STANDARD TABLE OF solisti1."Attachment of EMail
      DATA: l_doc_chng TYPE sodocchgi1,     "attributes of document to send
            l_reclist  LIKE LINE OF lt_reclist,
            l_objpack  LIKE LINE OF lt_objpack,
            l_obj      LIKE LINE OF lt_objhead.
      DATA :
        l_hex LIKE solix,
        lt_contents_hex LIKE STANDARD TABLE OF solix ,
        conv TYPE REF TO cl_abap_conv_out_ce,
        l_buffer TYPE xstring,
        l_hexa(510) TYPE x.
    * Completing the recipient list
      l_reclist-receiver = p_emailid.
      l_reclist-express  = 'X'.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist TO lt_reclist.
      CLEAR  l_reclist.
    * Body of Email Message
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.       " Blank line
      l_obj-line = '<html>'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line = '<body>'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line =  '<p><code>Hello,</p></code>'(t04).
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line = cl_abap_char_utilities=>newline.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.       " Blank line
      CONCATENATE
       '<p><code>'(f01)
       'Please click the link to access the Confirmation Form.'(t01)
       'Kindly complete the same and return it to the HR contact 15 days' &
       ' prior to the date of confirmation of the employee.'(t02)
       '</p></code>'(f02) INTO l_obj-line SEPARATED BY space.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line = cl_abap_char_utilities=>newline.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.       " Blank line
      CONCATENATE '<a href="' text-l01 text-l02 '">'
             INTO l_obj-line.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      CONCATENATE  '<p><code>'(f01)
                   'Link to Confirmation Forms'(034)
                   '</p></code>'(f02)
                   '</a>'
             INTO l_obj-line.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line = cl_abap_char_utilities=>newline.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.       " Blank line
      l_obj-line = '<p><code>The details of the employees ' &
                   'are as follows:</p></code>'(017).
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line = cl_abap_char_utilities=>newline.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.       " Blank line
    * Table headings in the Mail Body
      l_obj-line =  '<table border="1">'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line =  '<tr>'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line =   '<th><p><code>Name</p></code></th>'(030).
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line =  '<th><p><code>Department</p></code></th>'(031).
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line =  '<th><p><code>DOJ</p></code></th>'(032).
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line =  '<th><p><code>Confirmation Date</p></code></th>'(033).
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line =  '</tr>'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
    ** Body of Email Message
    * Email Attachment
    * Append headings
      CONCATENATE 'Employee No.'(002)
                  'Employee Group'(016)
                  'Employee Name'(001)
                  'Designation'(003)
                  'Joining Date'(004)
                  'Department'(005)
                  'Branch/Location'(006)
                  'Unit'(007)
                  'Confirmation Due'(008)
                  'Form sent on'(009)
                  'Form Return by'(010)
                  'Employee Group'(016)
                  'Qualification'(012)
                  'Trainee Category'(013)
                INTO l_string
           SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      APPEND l_string TO lt_objbin.
      CLEAR l_string.
      APPEND INITIAL LINE TO lt_objbin.
      LOOP AT p_emp_details INTO i_emp_details_line.
        CONCATENATE i_emp_details_line-pnalt
                    i_emp_details_line-egroup
                    i_emp_details_line-ename
                    i_emp_details_line-stext
                    i_emp_details_line-srvdt
                    i_emp_details_line-ltext
                    i_emp_details_line-pbtxt
                    i_emp_details_line-btrtx
                    i_emp_details_line-mndat
                    i_emp_details_line-fsdate
                    i_emp_details_line-frdate
                    i_emp_details_line-egroup
                    i_emp_details_line-ptext
                    i_emp_details_line-ftext
               INTO l_string
          SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
        APPEND l_string TO lt_objbin.
        CLEAR l_string.
        l_obj-line =  '<tr>'.
        APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
        CONCATENATE '<td>' '<p><code>'(f01)
                     i_emp_details_line-ename '</p></code>'(f02) '</td>'
                     INTO l_string.
        APPEND l_string TO lt_objtxt.   CLEAR l_string.
        CONCATENATE '<td>' '<p><code>'(f01)
                    i_emp_details_line-ltext '</p></code>'(f02) '</td>'
                    INTO l_string.
        APPEND l_string TO lt_objtxt.   CLEAR l_string.
        CONCATENATE '<td>' '<p><code>'(f01)
                    i_emp_details_line-srvdt '</p></code>'(f02) '</td>'
                    INTO l_string.
        APPEND l_string TO lt_objtxt.   CLEAR l_string.
        CONCATENATE '<td>' '<p><code>'(f01)
                    i_emp_details_line-mndat '</p></code>'(f02) '</td>'
                    INTO l_string.
        APPEND l_string TO lt_objtxt.   CLEAR l_string.
        l_obj-line =  '</tr>'.
        APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      ENDLOOP.
      l_obj-line = '  </table>'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line = '</body>'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      l_obj-line = '</html>'.
      APPEND l_obj TO lt_objtxt.   CLEAR l_obj.
      IF r_cprob EQ 'X'.
        l_string = 'Completion of probation List'(018).
      ELSE.
        l_string = 'Completion of extension of probation List'(035).
      ENDIF.
      APPEND l_string TO lt_objhead.
    * APPEND object_header.
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = lt_objbin
          objcont_new = lt_objbin.
      LOOP AT lt_objbin INTO l_line.
       conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' endian = 'B').
        CALL METHOD conv->write( data = l_line ).
        l_buffer = conv->get_buffer( ).
        MOVE l_buffer TO l_hexa.
        MOVE l_hexa TO l_hex-line.
        APPEND l_hex TO lt_contents_hex.
      ENDLOOP.
    * File name for attachment
      CONCATENATE 'Completion of probation List'(018)
                   sy-datum '.XLS' INTO l_obj SEPARATED BY space.
      APPEND l_obj TO lt_objhead.
    * Email Body Details
      CLEAR l_tab_lines.
      DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
      l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 +
                              STRLEN( l_string ).  "size of doc in bytes
      l_doc_chng-obj_name = sy-repid.
      l_doc_chng-obj_langu = sy-langu.
      l_doc_chng-obj_descr = l_string.
      l_doc_chng-sensitivty = 'P'.          "  Send mail as a confidential
      l_objpack-head_start = 1.
      l_objpack-head_num   = 1.
      l_objpack-body_start = 1.
      l_objpack-body_num   = l_tab_lines.
      l_objpack-doc_type   = 'HTML'. "l_c_txt.
      APPEND l_objpack TO lt_objpack.
      CLEAR  l_objpack.
    * Email Attachment Details
      CLEAR l_tab_lines.
      DESCRIBE TABLE lt_objbin LINES l_tab_lines.
    * Creation of the entry for the compressed attachment
      l_objpack-transf_bin = 'X'.
      l_objpack-head_start = 1.
      l_objpack-head_num   = 1.
      l_objpack-body_start = 1.
      l_objpack-doc_type   = 'XLS'.
      l_objpack-obj_name   = l_obj.
      l_objpack-obj_descr  = l_obj.
      l_objpack-body_num   = l_tab_lines.
      l_objpack-doc_size   = l_tab_lines * l_c_255.
      APPEND l_objpack TO lt_objpack.
      CLEAR  l_objpack.
    * Send the document
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = l_doc_chng
          put_in_outbox              = ' '
          commit_work                = 'X'
        TABLES
          packing_list               = lt_objpack
          object_header              = lt_objhead
    *      contents_bin               = lt_objbin
          contents_txt               = lt_objtxt
          contents_hex               = lt_contents_hex
          receivers                  = lt_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.

  • Date is not show up in correct format from excel with tab-delimited was generated from query

    Hi,
    My code below worked file and save file into txt file.  However, the date is the problem.  I have to open excel file and manulay change the format of the date to make it shows the correct date, other way, it alutomatic shows 00:00:00 when i first open the file.  How can i make the date automatic shows from the file i generated in excel?
    <cfset tab = chr(9)>
    <cfset Str = "">
    <cfloop query="q_report">
    <cfset Str = Str & q_report.purchasedNo & tab & q_report.desc & tab & q_report.Del_date & chr(13) & chr(10)>
    </cfloop>
    <cffile action="write" output="#Str#" file="#variables.file#">
    thanks

    Have you tried using DateFormat() on the date?
    ^_^

  • Re: Tab delimited file(interface prg)

    Hi,
    I have a problem with tab delimited file.
    i am getting one tab delimited file from the user i ahve to import it to the application sever and from the i will give tht prg as input to my prg and i will do some processing and accrodingly i will genrate some file in the format they need till now i dont have any problem
    but the records which have errors in the input file it self, for those records i need to generate the error file but while importing it to presentation server from application server that should be again genrate the tab delimited file .. so while genrating error file wht need to be done.. please help me...
    am i clear with my explanation
    i will reward for all usefull answers....

    If you are using a 4.7 or older systems then use this
    Declare a constant of HEX
    constants c_hextab(1) type x value '09'.
    and use this constant in concatenate statement to generate a tab character.
    Reward points please.

  • Tab delimited file on app server. How to do that?

    Hello,
    When i transfer a tab delimited file from pre. server(windows) to app. server(windows) using CG3Z , the tab delimitation  is not working.
    for eg : the file with below layout
    01.04.2007     31.03.2008     1     120     
    01.05.2007     31.07.2008     2     140     
    is getting changed like
    01.04.2007#31.03.2008#1#120     
    01.05.2007#31.07.2008#2#140     
    All i need is a tab delimited file in app server also . Wats that i need to do for this ? Also how can i write a tab delimited file on app server through my program using open dataset.
    Thanks for ur time.
    Jeeva.

    Hi..
    Check this code: you will find the solution:
    Using the Static Attribute <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB</b>
    Example:
    This is the Simple way you can download the ITAB with Tab delimiter:
    DATA : V_REC(200).
    OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP AT ITAB INTO WA.
      Concatenate WA-FIELD1 WA-FIELD2
             INTO V_REC
             SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
      TRANSFER V_REC TO P_FILE.
    ENDLOOP.
    CLOSE DATASET P_FILE.
    Note: if there are any Numeric fields ( Type I, P, F) In your ITAB then before CONCATENATE you have to Move them to Char fields ..
    Reward if Helpful.
    Example:
    DATA: V_RECORD(200).
    OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF SY-SUBRC <> 0.
      EXIT.
    ENDIF.
    DO.
    READ DATASET P_FILE INTO V_RECORD.
      IF SY-SUBRC NE 0.
        EXIT.
      ENDIF.
    SPLIT V_Record at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
                                INTO WA-FIELD1 WA-FIELD2.
    APPEND WA TO ITAB.
    ENDDO.
    <b>reward if Helpful.</b>

  • Convert_otf in unicode system

    Hello,
    we have switched a CRM4.0 system from non-unicode to unicode. In this context we became two problems with the result of the function module 'CONVERT_OTF'. We call the function Module following:
      call function 'CONVERT_OTF'
       exporting
         format                      = 'PDF'
         max_linewidth               = 132
         copynumber                  = 0
       importing
         bin_filesize                = lv_bin_filesizepdf
        tables
         otf                         = it_otfdata
         lines                       = lt_lines_pdf
    the otf tabel is generated by a Smartform.
    Noticeable is, that the pdf table in the unicode system has similarly only the half quantity of rows than in the non-unicode system. (The parameter FLATE_COMPR_OFF in Report RSTXPDF3 allways is on)
    1. Problem
    We send the pdf table (lt_lines_pdf) via RFC to a non-unicode R/3 system and save it there on the file system. After switching to unicode, the document in the RFC system is damaged an cannot processed.
    2. Problem
    We transform the lt_lines_pdf for an archive in the following way.
    data: ls_data    type char1024
        , lv_134     type char134
        , ls_lines   type tline
        , lt_data    type standard table of tbl1024
    field-symbols: <fs> type tbl1024.
    assign ls_data to <fs> casting.
      lv_count = 0.
      loop at lt_lines_pdf into ls_lines.
        lv_134 = ls_lines.
        lv_offset = lv_count.
        lv_count = lv_count + 134.
        if lv_count < 1024.
          ls_data+lv_offset(134) = lv_134.
        else.
          lv_count = lv_count - 1024.
          lv_begin = 134 - lv_count.
          ls_data+lv_offset(lv_begin) = lv_134(lv_begin).
          append <fs> to lt_data.
          clear ls_data.
          if lv_count > 0.
            ls_data = lv_134+lv_begin(*).
          endif.
        endif.
      endloop.
      if ls_data is not initial.
        append <fs> to lt_data.
      endif.
    We need lt_data for the FM 'SCMS_AO_TABLE_CREATE'.
    I hope anybody can help me, I invest already much time in this problem!

    Hi,
    CONVERT_OTF packs two byte into one character of i-tab LINES on unicode systems. If you pass this via RFC to non-unicode systems data ist lost. The table contents are bytes when if the data type is character. The conversion routines between unicode and non-unicode do not know about this.
    However the function module contains an export paramter BIN_FILE. This parameter is of type XSTRING, which has always a byte-representation. This datatype will not be converted between RFC-calls.
    Greetings

  • Download into tab delimited  text file

    Hi all
    I am uploading  data from a text file with tab delimited.
    For some reason if the record doesnot satisfy the criteria i cannot upload the record .
    In the program i am moving those records into another internal table and deleting from the actual that i ausing to update the ztable.
    I need to download those fault records into another text file with tab delimited space with the same format so that they can correct those records and upload again.
    Thanks
    Preeti

    Preeti,
    Look at the code below. It should do everything that U want to do. However it uploads data from excel and downloads data into a text file.
    Hope this helps,
    Shreekant.
    Program Name  : ZRSD0177_XREF_EXCEL_UPLOAD                           *
    REPORT  zrsd0177_xref_excel_upload NO STANDARD PAGE HEADING    .
    TABLES : zzsd0010,
             knvv.
    DATA : g_repid LIKE sy-repid,
           $v_start_col         TYPE i VALUE '1',
           $v_start_row         TYPE i VALUE '2',
           $v_end_col           TYPE i VALUE '256',
           $v_end_row           TYPE i VALUE '65536',
           gd_currentrow TYPE i.
    *Data Declaration for the table ZZSD0010
    DATA : BEGIN OF it_zzsd0010 OCCURS 0.
            INCLUDE STRUCTURE zzsd0010.
    DATA : END OF it_zzsd0010.
    *DATA : it1_zzsd0010 LIKE it_zzsd0010 OCCURS 0 WITH HEADER
          LINE.
    *Data Declaration for EXCEL TABLES
    DATA :BEGIN OF it_tab_driver OCCURS 0,
               mandt                LIKE zzsd0010-mandt,
               sorg                 LIKE zzsd0010-vkorg,
               sdis                 LIKE zzsd0010-vtweg,
               sdiv                 LIKE zzsd0010-spart,
               gelco_princ_customer LIKE zzsd0010-princ_customer,
               sell_div             LIKE zzsd0010-kdgrp,
               payer                LIKE zzsd0010-payer,
               qad_cust(10)         TYPE c,
               name(30)             TYPE c,
               broker(3)            TYPE c,
          END OF it_tab_driver.
    DATA : it_tab_driver1 LIKE it_tab_driver OCCURS 0 WITH HEADER LINE.
    DATA :BEGIN OF it_tab_lookup OCCURS 0,
               rpc_ship_to(10) TYPE c,
               rpc_sold_to(10) TYPE c,
               rpc_bill_to(10) TYPE c,
               type(10)        TYPE c,
               qad_ship_to(10) TYPE c,
               qad_sold_to(10) TYPE c,
               qad_bill_to(10) TYPE c,
               sell_div1       LIKE zzsd0010-kdgrp,
               broker(3)       TYPE c,
          END OF it_tab_lookup.
    DATA : BEGIN OF it_knvv OCCURS 0,
            kunnr LIKE knvv-kunnr,
            vkorg LIKE knvv-vkorg,                              "V004
            vtweg LIKE knvv-vtweg,                              "V004
            spart LIKE knvv-spart,                              "V004
            kdgrp LIKE knvv-kdgrp,
           END OF it_knvv.
    DATA: it_outfile(200)   OCCURS 0 WITH HEADER LINE.
    DATA: it_outfile1(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_outfile2(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_outfile3(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_outfile4(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_driver LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA: it_lookup LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    *--- Selection Screen
    SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.
    PARAMETERS : p_file  LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\driver.xls'.
    PARAMETERS : p1_file LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\lookup.xls'.
    PARAMETERS : p2_file LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\error.txt'.
    PARAMETERS : p3_file LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\warning_Sales_Div.txt'.
    PARAMETERS : p4_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\warning_Sales_Org.txt'.                        "V004
    PARAMETERS : p5_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\warning_Dist_channel.txt'.                     "V004
    PARAMETERS : p6_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\warning_Division.txt'.                         "V004
    PARAMETERS : p7_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\cust_not_found.txt'.
    SELECTION-SCREEN : END OF BLOCK blk.
    INITIALIZATION.
      g_repid = sy-repid.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p1_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p1_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p2_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p2_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p3_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p3_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p4_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p4_file.                               "V004
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p5_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p5_file.                               "V004
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p6_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p6_file.                               "V004
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p7_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p7_file.                               "V004
    START-OF-SELECTION.
    Get the data from XLS to Internal Table
      PERFORM f1000_upload_driver_data.
      PERFORM f2000_upload_lookup_data.
    *UPDATE DATA BASE
      SORT it_tab_driver BY gelco_princ_customer qad_cust.
      SORT it_tab_lookup BY qad_sold_to.
      CLEAR : it_tab_lookup,
              it_tab_driver.
      LOOP AT it_tab_driver.
        CLEAR : it_tab_lookup.
        IF
           it_tab_driver-gelco_princ_customer = it_tab_driver-qad_cust.
    Hit the sold-to column first, and if does not find a hit then try
    the bill-to column.
          READ TABLE it_tab_lookup
          WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
          IF sy-subrc = 0.
            it_zzsd0010-mandt          = it_tab_driver-mandt.
            it_zzsd0010-vkorg          = it_tab_driver-sorg.
            it_zzsd0010-vtweg          = it_tab_driver-sdis.
            it_zzsd0010-spart          = it_tab_driver-sdiv.
            it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-kunnr          = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-payer          = ' '.
            it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
            it_zzsd0010-ernam          = sy-uname.
            it_zzsd0010-erdat          = sy-datum.
            it_zzsd0010-erzet          = sy-uzeit.
            it_zzsd0010-aenam          = sy-uname.
            it_zzsd0010-aedat          = sy-datum.
            it_zzsd0010-aezat          = sy-uzeit.
            PERFORM f6000_add_zeros_to_cust.                    "V004
            APPEND it_zzsd0010.
            INSERT INTO zzsd0010 VALUES it_zzsd0010.
            PERFORM f5000_warning_file.                         "V004
            CLEAR  it_zzsd0010.
          ELSEIF sy-subrc <> 0.
            READ TABLE it_tab_lookup
            WITH KEY qad_bill_to = it_tab_driver-gelco_princ_customer.
            IF sy-subrc = 0.
              it_zzsd0010-mandt          = it_tab_driver-mandt.
              it_zzsd0010-vkorg          = it_tab_driver-sorg.
              it_zzsd0010-vtweg          = it_tab_driver-sdis.
              it_zzsd0010-spart          = it_tab_driver-sdiv.
              it_zzsd0010-princ_customer = it_tab_lookup-rpc_bill_to.
              it_zzsd0010-kunnr          = it_tab_lookup-rpc_bill_to.
              it_zzsd0010-payer          = 'X'.
              it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
              it_zzsd0010-ernam          = sy-uname.
              it_zzsd0010-erdat          = sy-datum.
              it_zzsd0010-erzet          = sy-uzeit.
              it_zzsd0010-aenam          = sy-uname.
              it_zzsd0010-aedat          = sy-datum.
              it_zzsd0010-aezat          = sy-uzeit.
              PERFORM f6000_add_zeros_to_cust.                  "V004
              APPEND it_zzsd0010.
              INSERT INTO zzsd0010 VALUES it_zzsd0010.
              PERFORM f5000_warning_file.                       "V004
              CLEAR  it_zzsd0010.
            ELSE.
              it_tab_driver1 = it_tab_driver.
              APPEND it_tab_driver1.
            ENDIF.
          ENDIF.
        ELSEIF it_tab_driver-gelco_princ_customer <> it_tab_driver-qad_cust.
    Hit the sold-to column first, and if does not find a hit then try
    the bill-to column.
          READ TABLE it_tab_lookup
          WITH KEY qad_sold_to = it_tab_driver-qad_cust.
          IF sy-subrc = 0.
            it_zzsd0010-mandt          = it_tab_driver-mandt.
            it_zzsd0010-vkorg          = it_tab_driver-sorg.
            it_zzsd0010-vtweg          = it_tab_driver-sdis.
            it_zzsd0010-spart          = it_tab_driver-sdiv.
            it_zzsd0010-kunnr          = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-payer          = ' '.
            it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
            it_zzsd0010-ernam          = sy-uname.
            it_zzsd0010-erdat          = sy-datum.
            it_zzsd0010-erzet          = sy-uzeit.
            it_zzsd0010-aenam          = sy-uname.
            it_zzsd0010-aedat          = sy-datum.
            it_zzsd0010-aezat          = sy-uzeit.
            READ TABLE it_tab_lookup
            WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
            IF sy-subrc = 0.
              it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
              PERFORM f6000_add_zeros_to_cust.                  "V004
              APPEND it_zzsd0010.
              INSERT INTO zzsd0010 VALUES it_zzsd0010.
              PERFORM f5000_warning_file.                       "V004
              CLEAR  it_zzsd0010.
            ELSEIF sy-subrc <> 0.
              READ TABLE it_tab_lookup
              WITH KEY qad_bill_to = it_tab_driver-gelco_princ_customer.
              IF sy-subrc = 0.
                it_zzsd0010-princ_customer = it_tab_lookup-rpc_bill_to.
                PERFORM f6000_add_zeros_to_cust.                 "V004
                APPEND it_zzsd0010.
                INSERT INTO zzsd0010 VALUES it_zzsd0010.
                PERFORM f5000_warning_file.                      "V004
                CLEAR  it_zzsd0010.
              ELSE.
                it_tab_driver1 = it_tab_driver.
                APPEND it_tab_driver1.
              ENDIF.
            ENDIF.
          ELSEIF sy-subrc <> 0.
            READ TABLE it_tab_lookup
            WITH KEY qad_bill_to = it_tab_driver-qad_cust.
            IF sy-subrc = 0.
              it_zzsd0010-mandt          = it_tab_driver-mandt.
              it_zzsd0010-vkorg          = it_tab_driver-sorg.
              it_zzsd0010-vtweg          = it_tab_driver-sdis.
              it_zzsd0010-spart          = it_tab_driver-sdiv.
              it_zzsd0010-kunnr          = it_tab_lookup-rpc_bill_to.
              it_zzsd0010-payer          = 'X'.
              it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
              it_zzsd0010-ernam          = sy-uname.
              it_zzsd0010-erdat          = sy-datum.
              it_zzsd0010-erzet          = sy-uzeit.
              it_zzsd0010-aenam          = sy-uname.
              it_zzsd0010-aedat          = sy-datum.
              it_zzsd0010-aezat          = sy-uzeit.
              READ TABLE it_tab_lookup
              WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
              IF sy-subrc = 0.
                it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
                PERFORM f6000_add_zeros_to_cust.                "V004
                APPEND it_zzsd0010.
                INSERT INTO zzsd0010 VALUES it_zzsd0010.
                PERFORM f5000_warning_file.                     "V004
                CLEAR  it_zzsd0010.
              ELSEIF sy-subrc <> 0.
                READ TABLE it_tab_lookup
                WITH KEY qad_bill_to = it_tab_driver-gelco_princ_customer.
                IF sy-subrc = 0.
                  it_zzsd0010-princ_customer = it_tab_lookup-rpc_bill_to.
                  PERFORM f6000_add_zeros_to_cust.              "V004
                  APPEND it_zzsd0010.
                  INSERT INTO zzsd0010 VALUES it_zzsd0010.
                  PERFORM f5000_warning_file.                   "V004
                  CLEAR  it_zzsd0010.
                ELSE.
                  it_tab_driver1 = it_tab_driver.
                  APPEND it_tab_driver1.
                ENDIF.
              ENDIF.
            ELSE.
              it_tab_driver1 = it_tab_driver.
              APPEND it_tab_driver1.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
      LOOP AT it_tab_driver.
        IF
         it_tab_driver-gelco_princ_customer <> it_tab_driver-qad_cust.
          READ TABLE it_tab_lookup
          WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
          IF sy-subrc = 0.
            it_zzsd0010-mandt          = it_tab_driver-mandt.
            it_zzsd0010-vkorg          = it_tab_driver-sorg.
            it_zzsd0010-vtweg          = it_tab_driver-sdis.
            it_zzsd0010-spart          = it_tab_driver-sdiv.
            it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-kunnr          = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-payer          = ' '.
            it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
            it_zzsd0010-ernam          = sy-uname.
            it_zzsd0010-erdat          = sy-datum.
            it_zzsd0010-erzet          = sy-uzeit.
            it_zzsd0010-aenam          = sy-uname.
            it_zzsd0010-aedat          = sy-datum.
            it_zzsd0010-aezat          = sy-uzeit.
            PERFORM f6000_add_zeros_to_cust.                    "V004
            APPEND it_zzsd0010.
            INSERT INTO zzsd0010 VALUES it_zzsd0010.
            PERFORM f5000_warning_file.                         "V004
            CLEAR  it_zzsd0010.
          ELSE.
            it_tab_driver1 = it_tab_driver.
            APPEND it_tab_driver1.
          ENDIF.
        ENDIF.
      ENDLOOP.
      PERFORM f3000_data_base_not_updated.
      PERFORM f4000_check_sales_division.
    *&      Form  f1000_upload_driver_data
    FORM f1000_upload_driver_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_file
          i_begin_col             = $v_start_col
          i_begin_row             = $v_start_row
          i_end_col               = $v_end_col
          i_end_row               = $v_end_row
        TABLES
          intern                  = it_driver
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/10 'File '.
      ENDIF.
      IF sy-subrc EQ 0.
        READ TABLE it_driver INDEX 1.
        gd_currentrow = it_driver-row.
        LOOP AT it_driver.
          IF it_driver-row NE gd_currentrow.
            APPEND it_tab_driver.
            CLEAR it_tab_driver.
            gd_currentrow = it_driver-row.
          ENDIF.
          CASE it_driver-col.
            WHEN '0001'.
              it_tab_driver-mandt = it_driver-value.
            WHEN '0002'.
              it_tab_driver-sorg = it_driver-value.
            WHEN '0003'.
              it_tab_driver-sdis = it_driver-value.
            WHEN '0004'.
              it_tab_driver-sdiv = it_driver-value.
            WHEN '0005'.
              it_tab_driver-gelco_princ_customer = it_driver-value.
            WHEN '0006'.
              it_tab_driver-sell_div = it_driver-value.
            WHEN '0007'.
              it_tab_driver-payer = it_driver-value.
            WHEN '0008'.
              it_tab_driver-qad_cust = it_driver-value.
            WHEN '0009'.
              it_tab_driver-name = it_driver-value.
            WHEN '0010'.
              it_tab_driver-broker = it_driver-value.
          ENDCASE.
        ENDLOOP.
      ENDIF.
      APPEND it_tab_driver.
    ENDFORM.                    " f1000_upload_driver_data
    *&      Form  f2000_upload_lookup_data
    FORM f2000_upload_lookup_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p1_file
          i_begin_col             = $v_start_col
          i_begin_row             = $v_start_row
          i_end_col               = $v_end_col
          i_end_row               = $v_end_row
        TABLES
          intern                  = it_lookup
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/10 'File '.
      ENDIF.
      IF sy-subrc EQ 0.
        READ TABLE it_lookup INDEX 1.
        gd_currentrow = it_lookup-row.
        LOOP AT it_lookup.
          IF it_lookup-row NE gd_currentrow.
            APPEND it_tab_lookup.
            CLEAR it_tab_lookup.
            gd_currentrow = it_lookup-row.
          ENDIF.
          CASE it_lookup-col.
            WHEN '0001'.
              it_tab_lookup-rpc_ship_to = it_lookup-value.
            WHEN '0002'.
              it_tab_lookup-rpc_sold_to = it_lookup-value.
            WHEN '0003'.
              it_tab_lookup-rpc_bill_to = it_lookup-value.
            WHEN '0004'.
              it_tab_lookup-type        = it_lookup-value.
            WHEN '0005'.
              it_tab_lookup-qad_ship_to = it_lookup-value.
            WHEN '0006'.
              it_tab_lookup-qad_sold_to = it_lookup-value.
            WHEN '0007'.
              it_tab_lookup-qad_bill_to = it_lookup-value.
            WHEN '0008'.
              it_tab_lookup-sell_div1    = it_lookup-value.
            WHEN '0009'.
              it_tab_lookup-broker      = it_lookup-value.
          ENDCASE.
        ENDLOOP.
      ENDIF.
      APPEND it_tab_lookup.
    ENDFORM.                    " f2000_upload_lookup_data
    *&      Form  f3000_data_base_not_updated
          text
    FORM f3000_data_base_not_updated .
      CALL FUNCTION 'DOWNLOAD'
       EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
         filename                      = p2_file
         filetype                      = 'ASC'
        TABLES
          data_tab                      = it_tab_driver1
      FIELDNAMES                    =
       EXCEPTIONS
         invalid_filesize              = 1
         invalid_table_width           = 2
         invalid_type                  = 3
         no_batch                      = 4
         unknown_error                 = 5
         gui_refuse_filetransfer       = 6
         customer_error                = 7
         OTHERS                        = 8
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " data_base_not_updated
    *&      Form  f4000_Check_Sales_Division
          text
    FORM f4000_check_sales_division .
      SORT it_outfile.
      SORT it_outfile1.
      SORT it_outfile2.
      SORT it_outfile3.
      CALL FUNCTION 'DOWNLOAD'
        EXPORTING
          filename                = p3_file
          filetype                = 'ASC'
        TABLES
          data_tab                = it_outfile
        EXCEPTIONS
          invalid_filesize        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          customer_error          = 7
          OTHERS                  = 8.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p4_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile1                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p5_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile2                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p6_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile3                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p7_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile4                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
    ENDFORM.                    " f4000_Check_Sales_Division
    *&      Form  f5000_warning_file
          Sales area in KNVV table is compared with the sales area in
          ZZSD0010 table and a warning file is created if any mismatch   *
          occurs                                                         *
    FORM f5000_warning_file .                                   "V004
      IF it_zzsd0010-payer <> 'X'.                              "V003
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'             "V002
          EXPORTING                                             "V002
            input  = it_zzsd0010-kunnr                          "V002
          IMPORTING                                             "V002
            output = it_zzsd0010-kunnr.                         "V002
        SELECT kunnr                                            "V002
               vkorg                                            "V004
               vtweg                                            "V004
               spart                                            "V004
               kdgrp                                            "V002
          INTO TABLE it_knvv                                    "V002
          FROM knvv                                             "V002
         WHERE kunnr = it_zzsd0010-kunnr.                       "V002
        IF sy-subrc = 0.                                        "V002
          READ TABLE it_knvv WITH KEY kunnr = it_zzsd0010-kunnr.
          IF it_zzsd0010-kdgrp <> it_knvv-kdgrp.                "V002
            CONCATENATE it_zzsd0010-princ_customer              "V002
                        it_zzsd0010-kunnr                       "V002
                        it_zzsd0010-kdgrp                       "V002
                        it_knvv-kdgrp                           "V002
            INTO it_outfile SEPARATED BY space.                 "V002
            APPEND it_outfile.                                  "V002
          ENDIF.                                                "V002
          IF it_zzsd0010-vkorg <> it_knvv-vkorg.                "V004
            CONCATENATE it_zzsd0010-princ_customer              "V004
                        it_zzsd0010-kunnr                       "V004
                        it_zzsd0010-vkorg                       "V004
                        it_knvv-vkorg                           "V004
            INTO it_outfile1 SEPARATED BY space.                "V004
            APPEND it_outfile1.                                 "V005
          ENDIF.                                                "V004
          IF it_zzsd0010-vtweg <> it_knvv-vtweg.                "V004
            CONCATENATE it_zzsd0010-princ_customer              "V004
                        it_zzsd0010-kunnr                       "V004
                        it_zzsd0010-vtweg                       "V004
                        it_knvv-vtweg                           "V004
            INTO it_outfile2 SEPARATED BY space.                "V004
            APPEND it_outfile2.                                 "V005
          ENDIF.                                                "V004
          IF it_zzsd0010-spart <> it_knvv-spart.                "V004
            CONCATENATE it_zzsd0010-princ_customer              "V004
                        it_zzsd0010-kunnr                       "V004
                        it_zzsd0010-spart                       "V004
                        it_knvv-spart                           "V004
            INTO it_outfile3 SEPARATED BY space.                "V004
            APPEND it_outfile3.                                 "V005
          ENDIF.                                                "V004
          CLEAR it_outfile.                                     "V002
          CLEAR it_outfile1.                                    "V004
          CLEAR it_outfile2.                                    "V004
          CLEAR it_outfile3.                                    "V004
          CLEAR it_knvv.                                        "V002
          REFRESH it_knvv.                                      "V002
        ELSE.                                                   "V002
          CONCATENATE 'CUSTOMER'                                "V002
                       it_zzsd0010-kunnr                        "V002
                      'NOT FOUND IN KNVV TABLE'                 "V002
          INTO it_outfile4 SEPARATED BY space.                   "V002
          APPEND it_outfile4.                                    "V002
        ENDIF.                                                  "V002
      ENDIF.                                                    "V003
    ENDFORM.                    " f5000_warning_file            "V004
    *&      Form  f6000_add_zeros_to_cust
          text
    -->  p1        text
    <--  p2        text
    form f6000_add_zeros_to_cust .
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'             "V002
          EXPORTING                                             "V002
            input  = it_zzsd0010-kunnr                          "V002
          IMPORTING                                             "V002
            output = it_zzsd0010-kunnr.                         "V002
    endform.                    " f6000_add_zeros_to_cust

  • Inserting a tab delimited file

    Hi there,
    I am inserting data into a database from text files. I can easily do this in sql with csv files but I need to be able to do it with tab delimited files. I know you can do this from the built in Oracle tool (I am using express edition) but I was wandering if anyone know how to write a script for it in sql.
    Any help would be greatly appreciated.
    Thanks

    If you are using SQL Loader to load the data use below syntex
    FIELDS TERMINATED BY X'9'
    The X'9' is Hexadecimal Format -> X
    and Hex 9 is the ASCII code of the TAB character.
    Check out the link for more details:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:533222350291
    Regards
    Arun

Maybe you are looking for