Fields should be quoted seperated by comma while transferring to text file

Hi Experts,
I need to show the file contents within double quotes and seperated by comma using 'GUI_DOWNLOAD'
For eg. The text file contents that are transferred to presentation server should look like,
"00210000001400","21000000149","","0000149","0014","10"
"00210006121500","21000612151","","0612151","1215","10".
I was coded like
**CONCATENATE c_quotes lv_matnr14 INTO lv_first.**
        **CONCATENATE lw_final-extwg+0(2) c_quotes INTO lv_last.**
        **CONDENSE lv_first NO-GAPS.**
        **CONDENSE lv_last NO-GAPS.**
        **CONCATENATE lv_first**
                    **lw_final-ean11+3(11)**
                    **lw_final-yyshortdesc**
                    **lw_final-ean11+7(8)**
                    **lw_final-ean11+9(4)**
                    **lv_last**
               **INTO lw_ps_data**
               **SEPARATED BY c_comma1.**
        **CONDENSE lw_ps_data NO-GAPS.**
        **APPEND lw_ps_data TO rt_ps_data.**
Can u please suggest if there is other better way than this.....?

try ABAP forum for a better response - ABAP Development

Similar Messages

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

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

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

  • Error while importing a text file for a list of values

    Hi Experts,
    While importing a text file for a list of values in designer, I am getting error message as below:
    "Invalid setting in Excel key of the Engines section of the Windows Registry. (3433)".
    I am using BO XI R3. Universe Designer version : 12.1.0.882
    Any suggestion ?
    Regards

    plzzzzzzzzzzzzzzzzz.............sme1 help me out

  • Error while sending a text file to client as attachment

    I want to download a file on clicking a button. Here is my button code
    <input type="button" onClick="showdownloadwindow()" value="Download My file">
    The java script showdownloadwindow() should invoke a jsp that has code to construct the text file to be downloaded
    Here is the javascript function
    <script>
         function showdownloadwindow()
              var url = 'http://<%=request.getServerName()%>'+':'+<%=request.getServerPort()%>+'/downloadtextfile.jsp';     
              window.open(url,"","");
    </script>
    the downloadtextfile.jsp looks something like this
    <%
              response.setContentType("text/plain");
              response.setHeader("Content-disposition","attachment; filename=myfile.txt" );
              BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
              String temp="Put some text string for now";
              bos.write(temp.getBytes());
              bos.flush();
              bos.close();
              response.flushBuffer();
    %>
    i have two problems
    1. when the button "Download My file" is clicked a separate window is opened and then the save file dialog box appears. How can I change my code
    so that it only shows download window only ( not another browser window)
    2. myfile.txt contains some error in addition to the temp string
    Here is the error from myfile.txt
    <BR><H3>Original Exception: </H3>
    <B>Error Message: </B>SRVE0199E: OutputStream already obtained<BR>
    <B>Error Code: </B>500<BR>
    <B>Target Servlet: </B>/downloadtextfile.jsp<BR>
    <B>Error Stack: </B><BR>
    java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
    <BR>    
         at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter&#40;SRTServletResponse.java:467&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.initOut&#40;JspWriterImpl.java:170&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.flushBuffer&#40;JspWriterImpl.java:163&#41;
    <BR>    
         at org.apache.jasper.runtime.PageContextImpl.release&#40;PageContextImpl.java:217&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext&#40;JspFactoryImpl.java:149&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext&#40;JspFactoryImpl.java:117&#41;
    <BR>    
         at com.ibm._jsp._downloadtextfile._jspService&#40;_downloadtextfile.java:93&#41;
    <BR>    
         at com.ibm.ws.jsp.runtime.HttpJspBase.service&#40;HttpJspBase.java:88&#41;
    <BR>    

    > Channel FILE_TLE_Sender_SalesOrder_CC: Empty document found - proceed without sending message.
    > Can someone tell me why this error is happening? 
    Maybe your source file is empty?
    This is exact what the error message says.

  • Getting error while creating a text file

    Hi,
    I have one macro which will write all the file names from a particular folder into a text file. However when I run it, I am getting the following error message and only last file of the identified folder is getting added in my text file.
    Run Time Error '55'
    File Already Open
    To reproduce the scenario please add one commandbutton in your excel shhet and add the following code:
    Private Sub CommandButton1_Click()
    Dim p As String, x As Variant
    p = "C:/*.docx"
    x = GetFileList(p)
    Select Case IsArray(x)
    Case True 'files found
    MsgBox UBound(x)
    For i = LBound(x) To UBound(x)
    Open "C:\temp.txt" For Output As 1
    Write #1, "File Name " & x(i)
    Next i
    Close #1
    Case False
    MsgBox "No matching files"
    End Select
    End Sub
    Function GetFileList(FileSpec As String) As Variant
    Dim FileArray() As Variant
    Dim FileCount As Integer
    Dim FileName As String
    On Error GoTo NoFilesFound
    FileCount = 0
    FileName = Dir(FileSpec)
    If FileName = "" Then GoTo NoFilesFound
    ' Loop until no more matching files are found
    Do While FileName <> ""
    FileCount = FileCount + 1
    ReDim Preserve FileArray(1 To FileCount)
    FileArray(FileCount) = FileName
    FileName = Dir()
    Loop
    GetFileList = FileArray
    Exit Function
    ' Error handler
    NoFilesFound:
    GetFileList = False
    End Function
    'End Function
    For example if I have 3 docx file(1,2,3-name of the files) in my C drive, the o/p that I want in my .txt file will be as follows.
    File Name 1.docx
    File Name 2.docx
    File Name 3.docx
    Thanks!!

    For i = LBound(x) To UBound(x)
    Open "C:\temp.txt" For Output As 1
    You call the Open method inside the FOR loop.
    BTW, a collection is much more easier.
    Andreas.
    Private Sub CommandButton1_Click()
    Dim Files As New Collection
    Dim File
    Dim ff As Integer
    File = Dir("C:\*.docx")
    Do While File <> ""
    Files.Add File
    File = Dir
    Loop
    If Files.Count = 0 Then
    MsgBox "No matching files"
    Exit Sub
    Else
    MsgBox Files.Count & " files"
    End If
    ff = FreeFile
    Open "C:\temp.txt" For Output As #ff
    For Each File In Files
    Print #ff, File
    Next
    Close #ff
    End Sub

  • How to tackle " . " or " , "Comma DECIMAL notations in text file uploading?

    Hi Experts,
    I hv to upload the text file via LSMW and creating the Purchse Orders.
    So, issue is with QUANTITY and VALUE fileds, bcoz, the text file may some times contain " . " as DECIAML or may some times " , "(comma-Europe) as DECIMALs.
    And some times this LSMW may run by US guys, where " ." is DECIMAL and some times Europe guys, where " , " is DECIMAL.
    So, request u that, let me know that, How to handle all situations? Is there any FM?
    thank u

    Hello Srinivas
    The easiest approach would be the organizational one:
    Assuming that all relevant values have at most two digitals then export all values without decimal sign and interpret the last two digit of any values as decimals values (this approach is used in many EDI messages).
    The second approach would be to include a "marker" about the decimal notation in the file.
    However, I would always recommend to use the simplest approach (= 1st approach).
    Regards
      Uwe

  • Double quotes problem while uploading tablimeited text file to internal tab

    H all,
    I am uploading excel data using GUI_UPLOAD function module by converting excel to tab delimited text format.
    Problem is Material AB" is converted to "AB"  "           " material in tabdelimited text format.
    Can anybody give solution to problem?
    Is it possible to upload excel file directly using GUI_UPLOAD function module?
    I can not use 'ALSM_EXCEL_TO_INTERNAL_TABLE'  and  'TEXT_CONVERT_XLS_TO_SAP'
    as i want to upload upload fields of length 3000 cahrs and these function module uploads fields of only 256 chars.
    Thanks.

    Get a excel - 97-2003.Fil the data which you want to upload .(3 columns )
    A      I      B     I     C     I.
    save it
    Code :
    TABLES : thead.
    Structure to store the file name, as selected from the open dialog
    TYPES: BEGIN OF file ,
            filename TYPE file_table-filename,
           END OF  file.
    Output for excel
    TYPES : BEGIN OF test,
                   a(5),
                   b(5),
                   c(5),
            END OF test.
    Internal table of excel
    DATA : it_test TYPE TABLE OF test.
    DATA : it_filename TYPE TABLE OF  file,.  "to store file names.
                 ws_filename TYPE       file.
    SELECTION-SCREEN
    PARAMETER: p_file LIKE rlgrap-filename  LOWER CASE.
    At Selection Screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Parameter to store the sy-subrc value from FM file_open_dialog
      DATA: rc TYPE i.
      CLEAR: it_filename,
             ws_filename,
             p_file .
    Get the file name and path from the presenatation server
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'Select Input File'
          default_filename        = '*.xls'
        CHANGING
          file_table              = it_filename
          rc                      = rc
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5.
      IF sy-subrc = 0.
        LOOP AT it_filename INTO ws_filename.
          p_file = ws_filename.
          EXIT.
        ENDLOOP.
      ENDIF.
    DATA: l_file TYPE string.
      CLEAR it_test .
      l_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = it_test
        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 NE 0.
        WRITE: "Upload error".
        STOP.
      ENDIF.

  • "Empty document Found" error while sending a text file

    Below is the error I'm getting while I'm trying to send a txt file using a fiel adapter.
    Channel FILE_TLE_Sender_SalesOrder_CC: Converted complete file content to XML format.
    Channel FILE_TLE_Sender_SalesOrder_CC: Empty document found - proceed without sending message.
    File "/data/TLE/XS1/inbound/850/Test_SalesOrder_3064_12-15-10.txt" deleted after processing.
    On the Communication Channel this is what I have:
    Recordset Name: DOCUMENT_ROOT
    Recordset Structure: DOC_HEADER,1,PO_HEADER,1,TAX,,FREIGHT,,SPECIAL_SHIP,,DOCUMENT_NOTE,,SHIP_TO_ADDRESS,,PRODUCT,,LINE_SHIP,,LINE_ITEM_NOTE,,ASSOC_LINE,,ORDER_MEMO,,DOC_TRAILER,1
    Key Field Name: keyfield
    DOC_HEADER.fieldNames    Value: keyfield,Source_System,Source_SUB_System,Source_Doc_Type,Source_Doc_Gen_Date,Source_Doc_Gen_Time,Source_Company,Source_Division,Source_Party_ID,Source_Ship_Location,Source_Sell_Location,Event_Name,Application_Program_File,Application_Program_Name,Destination_System,Destination_SUB_System,Destination_DOC_Type,Destination_Company,Destination_Division,Destination_Party_ID,Destination_Ship_Location,Destination_Sell_Location,Interchange_Control_Number,Group_Control_Number,Document_Control_Number,Date_Translated,Time_Translated,Primary_Key
    DOC_HEADER.fieldFixedLengths  Value: 30,30,30,30,10,4,30,15,30,20,20,8,30,30,30,30,30,30,15,30,20,20,10,10,10,10,4,30
    DOC_HEADER.keyFieldValue        Value: DOC_HEADER
    DOC_HEADER.lastFieldsOptional       Value: YES
    DOC_HEADER.endSeparator           Value: 'nl'
    Then I have same pattern for PO_HEADER, TAX and so on....
    Can someone tell me why this error is happening?  I'm using the same exact parameters in another XI environment and there's no error there.

    > Channel FILE_TLE_Sender_SalesOrder_CC: Empty document found - proceed without sending message.
    > Can someone tell me why this error is happening? 
    Maybe your source file is empty?
    This is exact what the error message says.

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

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

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

  • How to go to the next Page while generating a text file ??

    All,
    I am generating a text File dynamically based on the information from the Database. I need to give some Page breaks after every 80 lines. Does any one has any clue how can I do that.
    I am able to generate the file though.
    Also I need to set the Font to Courier.
    Please let me know if anyone has done anything like this.
    I am using "BufferedWriter" for generating the text file.
    Thanx

    Basically - I have to repeat the header if the records goes to the next Page. My records can increase decrease dynamically as the data is coming from the Database.
    I do not know how to find out whether it has reached the next page or not ??
    If you know by any chance how can I repeat the header once it goes to the next Page that would be a great help.
    Thanx

  • Problem with Latin Characters while transferring to the file

    Hi,
    I want to transfer the data to the file. But the problem i m facing is latin characters get converted to unwanted characters.
    If i use FM 'SCP_REPLACE_STRANGE_CHARS', it converts latin to english.
    But i want latin to be latin itself.
    Please help.

    hi..
    this has more to do with the conceppt of codepage of the system...that u r using..
    in some cases the development system is unable to recognise the local characters...and hence it prints junc characters....but wen u move the same to higher system...u can find the desired characters....
    Also try one thing ..log in in local (Latin Language ) and upload...even if it does not come in devlopment system...it will come in higher systems...
    Hope the above works...Reward points..if helpful...
    Edited by: Rudra Prasanna Mohapatra on Jul 3, 2008 1:27 PM

  • 'FROM keyword not found where expected'error while Inserting into Text file

    Hi,
    I have created a simple interface for testing purpose. All it has to do is to Read the data from a Source Text file and put it into another text file (exactly the same headers as that of source) ...
    I am using Oracle as my staging area.
    But at 'Insert column Header' Stage, it gives me a warning 'FROM keyword not found where expected' and when it goes to the next step 'Insert Rows' it gives me the same error 'FROM keyword not found where expected' and aborts its execution.
    I checked the query for insertion and found nothing wrong in it (FROM Statement is just where it is expected, that is) but somehow its not working.
    Can somebody help me out as i have done it before on other Installations and dont know why it is occuring that too for the simplest thing in ODI ...
    Regards,
    Nitesh.

    Probably you missed the concat operator.
    select rpad(nvl(lu_parid,' '),1,19)|| v_comma ||
    rpad(nvl(lu_class,' '),1,3)
    from temp_te07                                                                                                                                                                                                                                                                                                           

  • Problem while reading from text file using JDeveloper 10.1.2

    Hi,
    I am using JDeveloper 10.1.2 for my application. In this, I have one requirement to read some data from a text file. For that, I created a test file and saved along with the java file folder. From there, I am trying to read this file but it says the file not found exception.
    Application is looking the file from another location. "F:\DevSuiteHome_1\jdev\system10.1.2.1.0.1913\oc4j-config"
    But, I want to read it from my home folder. How is it possible to read from that location?
    Regards,
    Joby Joseph

    HI,
    Check followings will useful
    How to read .txt file from adfLib jar at model layer using relative path
    Accessing physical/relative path from Bean

  • Uploading data to BW from a TEXT file , string fields show error

    I am trying to upload a TEXT file to SAP BW:
    City     Value   Date
    City1    100.00   20060101
    City2    200.00   20060102
    City3    300.00   20060103
    The text file has 3 fields:
    City (CHAR -STRING)
    Value (Numc)
    Date   (Dats)
    I have defined a file source system, the infosource and the datasource in order to upload the text file to BW.
    When uploading the infopackage of the text file, an error appears for the infoobject of type CHAR (STRING).
    The PSA is loading the record but it is in RED status showing that the characters are not allowed in the CITY field.
    The upload is made right if i substitute the string with a number, then the upload shows the green light.
    I need to upload string values to the CITY infoobject in my infocube, but the infopackage shows the red light when the text file includes characters like 'City1', it only permits numbers in the CHAR field.
    Please help me in order to upload a text file with CHAR (string) values to BW.
    Thanks in advance for your valuable help.
    I am working with CSV files.
    Carlos Eduardo España.
    [email protected]

    Hi Cempro,
    Always remember, the input file should have upper case letters. In your case, you have given in lowercase , so please change to upper case and run the Infopackage again. This should go fine.
    note: If the input file has lowercase letters, it need a different approach, meaning, you need to check few boxes. So, to avoid all thet, just change in your input file and just run the Infopackage.
    Remember, to do an ENTER at the "input file" section in the "external data" tab in Infopackage screen. This way, you are instructing the Infopackage to use the newly changed file.
    Thanks,
    Raj

  • Comma seperated fields fetched in a text file

    hi all,
             well in the reporting context,i am lookin forward to fetch data from the internal table and then download them into a text file,the condition of retrieval of the data is that every field should be seperated by a comma in the text file,
                 currently i m using "gui download" function module and its giving out the fetched reords correctly,but i m not able to put a "," seperator between the fields.....
       could anyone help me with this??
    points will rewarded generously,,,,
    thanks in advance

    Hi ,
    Use this statement first
    CONCATENATE
              "Give the field name which are to be displayed with , seperator  
              INTO wa_final-string
             SEPARATED BY ',' .
      INSERT wa_final
      INTO i_final INDEX 1.
    Pass this tabel in gui_download.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                        = BIN_FILESIZE
          filename                               = lwa_file
          filetype                                 = 'ASC'
      APPEND                                = ' '
      WRITE_FIELD_SEPARATOR   = ' '
      HEADER                                = '00'
      TRUNC_TRAILING_BLANKS    = ' '
      WRITE_LF                              = 'X'
      COL_SELECT                         = ' '
      COL_SELECT_MASK              = ' '
      DAT_MODE                             = ' '
      CONFIRM_OVERWRITE           = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                             = ' '
      IGNORE_CERR                        = ABAP_TRUE
      REPLACEMENT                       = '#'
      WRITE_BOM                            = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                               = ' '
      WK1_N_SIZE                                     = ' '
      WK1_T_FORMAT                               = ' '
      WK1_T_SIZE                                      = ' '
    IMPORTING
      FILELENGTH                      = FILELENGTH
        TABLES
          data_tab                            =     i_final
      FIELDNAMES                      = FIELDNAMES
        EXCEPTIONS
          file_write_error                = 1
          no_batch                        = 2
          gui_refuse_filetransfer         = 3
          invalid_type                    = 4
          no_authority                    = 5
          unknown_error                   = 6
          header_not_allowed              = 7
          separator_not_allowed           = 8
          filesize_not_allowed            = 9
          header_too_long                 = 10
          dp_error_create                 = 11
          dp_error_send                   = 12
          dp_error_write                  = 13
          unknown_dp_error                = 14
          access_denied                   = 15
          dp_out_of_memory                = 16
          disk_full                       = 17
          dp_timeout                      = 18
          file_not_found                  = 19
          dataprovider_exception          = 20
          control_flush_error             = 21
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

Maybe you are looking for