Convert tab separated text to non-trivial xml. (pwsafe -- KeePassx)

I'd like to take the output of `pwsafe --exportdb > database.txt` and convert it to a KeePassX XML friendly format (feature request in pwsafe).
I found flat file converter but the syntax is beyond me with this example.  Solutions are welcomed.
More details
Here is the pwsafe --> KeePassX XML translations.  The pwsafe export is simply a txt file with 6 fields (the first field can be ignored):
uuid= doesn't translate
group= group>title
name= entry>title
login= entry>username
passwd= entry>password
notes= entry>comment
Example txt file for conversion (exported from pwsafe):
# passwordsafe version 2.0 database"
uuid group name login passwd notes
"123d9-daf-df-3423423" "retail" "amazon" "myamazonuser" "sjfJ849" "superfluous comment"
"4599d934-dsfs-324" "retail" "netflix" "netflixuser" "dj3W$#" ""
"4kdfkd-434-jj" "email" "gmail" "mygmail" "dfkpass" ""
Example xml in keepassx xml:
<!DOCTYPE KEEPASSX_DATABASE>
<database>
<group>
<title>Internet</title>
<entry>
<title>github</title>
<username>githubusername</username>
<password>githubpassword</password>
<comment>optional comment</comment>
</entry>
</group>
<group>
<title>retail</title>
<entry>
<title>amazon</title>
<username>username</username>
<password>myamazonpw</password>
</entry>
</group>
<group>
<title>retail</title>
<entry>
<title>netflix</title>
<username>username</username>
<password>mynfxpw</password>
</entry>
</group>
</database>
Last edited by graysky (2015-06-14 18:27:17)

It seems that ffe does not work quite well with tab/space separated list (at least I was not able to get it working). However you can use sed to replace tabs with commas:
sed -e "s/\t/,/g" input.txt | ffe -c pwsafe.rc -s example.txt -l 2>/dev/null
and this is pwsafe.rc
structure pwsafe {
type separated , *
output group
quoted
header first
record line {
field uuid * * noprint
field title
field title * * entry
field username * * entry
field passwordd * * entry
field comment * * entry
output noprint {
data ""
no-data-print no
output entry {
data " <%n>%t</%n>\n"
no-data-print no
output group {
file_header "<!DOCTYPE KEEPASSX_DATABASE>\n <database>\n"
record_header " <group>\n"
data " <%n>%t</%n>\n <entry>\n"
record_trailer " <entry>\n </group>\n"
file_trailer "</database>\n"
no-data-print no
If you are not bound to ffe, maybe it is easier to use a python script which is simpler to modify and it is more flexible. Something like the following should work:
#!/usr/bin/python
import sys
from xml.dom import minidom
class Converter(object):
def __init__(self, filename):
self.url = filename
def convert(self):
inp_f = open(self.url, 'r')
data = inp_f.readlines()
inp_f.close()
# xml document model
doc = minidom.Document()
root = doc.createElement('database')
doc.appendChild(root)
for line in data:
if '"' not in line:
continue
fields = line.split('\t')
if len(fields) < 6:
continue
# uuid = fields[0].strip('"') # unused
group = fields[1].strip('" ')
name = fields[2].strip('" ')
login = fields[3].strip('" ')
passwd = fields[4].strip('" ')
notes = fields[5].strip('" \n')
group_node = doc.createElement('group')
root.appendChild(group_node)
# <group>
group_title_node = doc.createElement('title')
group_node.appendChild(group_title_node)
group_title_node.appendChild(doc.createTextNode(group))
# one <entry> per <group>
entry_node = doc.createElement('entry')
group_node.appendChild(entry_node)
# <entry> -> <title>
entry_title_node = doc.createElement('title')
entry_title_node.appendChild(doc.createTextNode(name))
entry_node.appendChild(entry_title_node)
# <entry> -> <username>
entry_uname_node = doc.createElement('username')
entry_uname_node.appendChild(doc.createTextNode(login))
entry_node.appendChild(entry_uname_node)
# <entry> -> <password>
entry_passwd_node = doc.createElement('password')
entry_passwd_node.appendChild(doc.createTextNode(passwd))
entry_node.appendChild(entry_passwd_node)
# <entry> -> <comments>
entry_comment_node = doc.createElement('comment')
entry_comment_node.appendChild(doc.createTextNode(notes))
entry_node.appendChild(entry_comment_node)
print('<!DOCTYPE KEEPASSX_DATABASE>')
print(root.toprettyxml(' ', '\n'))
if __name__ == "__main__":
try:
ifname = sys.argv[1]
except IndexError:
print("Input file name required")
sys.exit(1)
cc = Converter(ifname)
cc.convert()
NOTE: I'm assuming from the example you posted that every <group> node contains only one <entry> child node.
--edit[0]: corrected a typo in the python code (just realized that it is <comment> instead of <comments ) and made the parsing function more reliable
Last edited by mauritiusdadd (2015-06-15 09:29:01)

Similar Messages

  • Convert tab delimited  file content into an xml

    Hi,
    I am completely new to java and i am trying to create a tree of an
    output i have. generally the output is tab delimited and i have a
    sample output in the following link
    http://jena.sourceforge.net/ontology/examples/class-hierarchy/output.txt
    I want to create an xml out of it in the tree format as below
    <Class :Thing>
    (/t) <Class :KoalaWithPhD>
    (/t) <Class :MaleStudentWith3Daughters>
    (/t) <Class :Habitat>
    </Class :Thing>
    note i have added (/t ) just to explain u that kolawithphd is child node of thing ...and so on.
    Can someone throw in a simple code snipet that can help me do this.
    Really appreciate your help
    Thanks
    aks

    You need to detect the amount of indent, and whether the current line is more or less indented. You also need a stack to hold the indents of the previous lines, so the converter knows which one it's matching.
    Assuming the output is like the jena example - spaces only as indent and no non-xml-attribute-value characters in the class names, one possible converter would look like:import java.io.*;
    import java.util.*;
    public class ClassesToXml {
      public static void main (String[] args) {
        try {
          BufferedReader in = null;
          try {
            in = new BufferedReader(new FileReader(args[0]));
            String line;
            int previousIndent = -1;
            LinkedList stack = new LinkedList();
            System.out.print("<classes");
            while ((line = in.readLine()) != null) {
              final int indent = indent(line);
              if (indent <= previousIndent) {
                System.out.println("/>");
                while (indent < previousIndent) {
                  System.out.println("</class>");
                  previousIndent = ((Integer)stack.getFirst()).intValue();
                  stack.removeFirst();
              } else {
                System.out.println(">");
                stack.addFirst(new Integer(previousIndent));
                previousIndent = indent;
              System.out.print("<class name='" +
                               line.substring(line.indexOf("Class ") + 6).trim() +
            System.out.println("/>");
            while (stack.size() > 1) {
              System.out.println("</class>");
              stack.removeFirst();
            System.out.println("</classes>");
          } finally {
            if (in != null) {
              in.close();
        } catch (IOException ioe) {
          ioe.printStackTrace(System.out);
      static int indent (String line) {
        final int length = line.length();
        for (int indent = 0; indent < length; indent++) {
          if (line.charAt(indent) != ' ') {
            return indent;
        return length;
    }Pete

  • Export as Tab Separated Text (TTX)

    I am using CR XI R2 to create the reports.  The reports are then run through Oracle's IBPM Process Monitor which uses CR Runtime Engine 9.  The old Oracle's IBPM Process Monitor also uses the same runtime engine, but it offered option to export the reports to TTX.  The new one doesn't.  Are we missing a DLL?
    Thanks.
    Mai

    TTX is not installed by default. Go to Add/Remove programs and select Crystal Report XI R2 and Modify and use the Custom Install option. Expand the database option and check on TTX. If it's not there you'll have to use another datasource like XML etc.
    Thank you
    Don

  • Receiver File Adapter - Tab delimited Text file

    I am using receiver file adapter to convert message created by ABAP PROXY to convert tab delimited text file format.
    XML message is in following format.
    - <DT_R3_ROLES_OUTBOUND_REC>
      <LIST_CATEGORY>SAP_HR</LIST_CATEGORY>
      <USRID>MRUDULAP</USRID>
      <EMAIL>[email protected]</EMAIL>
      <NAME>MRUDULA PATEL</NAME>
      </DT_R3_ROLES_OUTBOUND_REC>
    - <DT_R3_ROLES_OUTBOUND_REC>
      <LIST_CATEGORY>SAP_HR</LIST_CATEGORY>
      <USRID>HCHD</USRID>
      <EMAIL>[email protected]</EMAIL>
      <NAME>H CHD</NAME>
      </DT_R3_ROLES_OUTBOUND_REC>
    I have used file content conversion in the adapter configuration.
    Recordset structure = DT_LISTSERV_INBOUND_REC
    DT_LISTSERV_INBOUND_REC.addHeaderLine = 0
    DT_LISTSERV_INBOUND_REC.fieldSeparator = ','
    How to use Tab as the delimiter in the fieldSeparator field?
    Now the output in the file is as follows :
    [email protected]'MRUDULA PATEL
    [email protected]'H CHD
    What I need to do to make the file as the tab delimited file?
    Thanks in advance!
    Mrudula Patel

    Hi Mruddula,
    Use fieldSeparator: '0x09' for horizontal tab
    <b>DT_LISTSERV_INBOUND_REC.fieldSeparator: '0x09'</b>
    Naveen

  • Converting SQL Server text field containing XML string to XI XML via JDBC

    Hello
    My client has a SQL Server database containing a field of type Text which contains an XML string e.g.
    <DispatchJob> <DispatchDateTime>2003-09-29T13:29:15</DispatchDateTime> <AssignedFSE>F118</AssignedFSE> <DispatchJobPurchase> <DealerID>14C5</DealerID> <DateOfPurchase>1997-10-01T00:00:00</DateOfPurchase> </DispatchJob>
    I am using JDBC to access this but could someone please recommend the best and easiest solution for converting this string to XI XML for subsequent mapping to BAPI or IDOC or ABAP Proxy and transmission to SAP. There are other fields as well in the database table so thoughts at the moment are to use a normal graphical message mapping followed by an XSL mapping. Will an XSL mapping be able to do this and if so is that the best solution?
    Also I need to do the reverse of this and take fields coming from SAP via BAPI,IDOC etc. and convert them to a single database table field as an XML string also via the JDBC adapter. What is the best way to do this. Could it be done simply with functions in the graphical mapping e.g. concatenate?
    Thank you in advance.
    Trevor

    Hi Michal
    Thanks for the prompt reply.
    I was anticipating XSLT for reading from the SQL Server database and converting the XML string.
    But how would you convert the individual fields from SAP into a single field as an XML string for storing in the SQL Server database? What approach would you use?
    Regards
    Trevor

  • How to convert the TEXT file into an XML using plsql code

    Hi all ,
    I need to convert an TEXT file into an XML file how can i do it
    Below is my sample TEXT file .
    TDETL00000000020000000000000120131021115854ST2225SKU77598059          0023-000000010000
    I want the above to be converted into the below format
    <?xml version="1.0" encoding="UTF-8"?>
    <txt2xml>
      <!-- Processor splits text into lines -->
      <processor type="RegexDelimited">
      <regex>\n</regex>
            <!--
            This is used to specify that a message should be created per line in
            the incoming file;
            NOTE: this was designed to work with all the processors, however it
            only works correctly with 'RegexDelimited' processors (check the
            enclosing top processor type)
             -->
             <maxIterationsPerMsg>1</maxIterationsPerMsg>
      <!-- For lines beginning with FHEAD (File Header) -->
      <processor type="RegexMatch">
      <element>FHEAD</element>
      <regex>^FHEAD(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,Type,Date</element>
      <regex>^(\d{10})(\w{4})(\d{14})$</regex>
      </processor>
      </processor>
      <!-- For lines beginning with TDETL (Transaction Details) -->
      <processor type="RegexMatch">
      <element>TDETL</element>
      <regex>^TDETL(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,TransControlNumber,TransDate,LocationType,Location,ItemType,Item,UPCSupplement,InventoryStatus,AdjustReason,AdjustSign,AdjustQty</element>
      <regex>^(\d{10})(\d{14})(\d{14})(\w{2})(\d{4})(\w{3})([\w ]{13})([\w ]{5})(\d{2})(\d{2})([+-]{1})(\d{12})$</regex>
      </processor>
      </processor>
      <!-- For lines beginning with FTAIL (File Tail) -->
      <processor type="RegexMatch">
      <element>FTAIL</element>
      <regex>^FTAIL(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,TransCount</element>
      <regex>^(\d{10})(\d{6})$</regex>
      </processor>
      </processor>
      </processor>
    </txt2xml>
    Thanks

    Sorry, that doesn't make much sense.
    The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
    Are you a user of this utility?

  • Read text file (ASCII), tab separated

    how to read contens of text file (ASCII), tab separated in a report.

    hi kailash,
                    To read contents of text files (Ascii) use GUI_UPLOAD function.
    GUI_UPLOAD - this FM will Upload the Data of a text File to ITAB.
    Please see below the code for it.It is very simple ,plz go through it.
    In the code when u call the function GUI_UPLOAD just mention the file type as 'ASCII' as done below.
    pls do reward if useful.
    Thanks.
    types: begin of ttab,
           f1(25) type c,
           f2(10) type c,
           f3(10) type c,
           end of ttab.
    data: itab type table of ttab with header line.
    data: file_str type string.
    parameters: p_file type localfile.
    at selection-screen on value-request for p_file.
      call function 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static    = 'X'
        CHANGING
          file_name = p_file.
    start-of-selection.
      file_str = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = file_str
        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            =
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
        TABLES
          DATA_TAB                      = itab
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17.
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
      Loop at itab.
        write : / itab-f1,itab-f2,itab-f3.
      endloop.

  • Create text file (ASCII), tab separated and load in sap (transaction al11)

    hi..
    i need to create a text file (ASCII), tab separated in sap which can be viewed in transaction AL11.
    thank you.

    Hi kailashl,
    Do intend to create a tab delimited file through program. or is it that you wish to diretly place the file on the application server.
    PS: if you wish to place the file which you have on the application server from presentation you use the tcode CG3Z, you need to give the source file path on the front end and target path on the application.
    If you wish to write the file onto the app server using program that you can do using dataset. and for tab delimited u can use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    PS: Award points ONLY if the solution was useful to you.

  • Excel to Tab delimited .text

    At work i have to deal with a lot of excels in which i have to save the file as .txt and then .xls, I will then upload the .txt file to SAP
    In the txt files, the numbers are being saved with "." (dot) and not with a ","(Comma) in the decimals, even though then numbers in excel are formated in number with 2 decimals and with comma separator.
    So I'm having problems with this, I've tried the different formats (number, text, general) but nothing seems to work. If I save manually in Tab delimited .txt the files is always saved with a comma in the decimals, but if i run the excel macro the .txt always save with a dot. I've also tried changing the file format in my VBA (TextWindows, TextMSDOS, Currentplatformtext) without sucess.
    Can anyone give me some help with this? I've been looking the internet for a solution but found none. The number of files i have to upload is huge, so i'd like to program my macro to do all this saving automatically.
    Thank you..
    PS:The VBA code I am using now is this:
    Sub Save()
        Dim NomeFicheiro As String
        Dim PathGrav As String
        NomeFicheiro = InputBox("Nome do Ficheiro?")
        PathGrav = "H:\Starflows\" & NomeFicheiro
        If NomeFicheiro = "" Then Exit Sub
        ActiveWorkbook.SaveAs Filename:=PathGrav, FileFormat:=xlTextWindows, CreateBackup:=False
        ActiveWorkbook.SaveAs Filename:=PathGrav, FileFormat:=xlNormal, CreateBackup:=False
        ActiveWorkbook.Close SaveChanges:=False
    End Sub

    I thought it might me the regional settings, mine are in Portuguese and by default we have the comma as decimal separator, so this should be ok.
    I tried changing to the English (US) format using both the comma and the dot as separator, but the problem remains, the macro is always saved with dot instead of comma, even so if I save the file manually as tab delimited text.
    What I also did was, I configured dot as decimal separator in the regional settings and putted commas in the numbers in my excel, I think it recognizes the numbers as text, in this case, when i run the macro the numbers in the text are saved with quotes like this but with commas, for example  "12,56". But in this case SAP does not accept the file because of the quotes.
    I remembered something that might be the reason for this happening. when I manually save as tab delimited .txt, excel asks me 2 questions, which i answer yes and which could be important.
    1. Excel tells me that the selected file type does not support workbooks that contain multiple sheets and to save only the active sheet click ok. This does not look like the problem but i changed the code to:
    ActiveSheet.SaveAs Filename:=PathGrav, FileFormat:=xlTextWindows, CreateBackup:=False
    I executed it but the dot and not comma remains.
    2. 123.txt may contain features that are not compatible with Text (Tab delimited). Do you want to keep the workbook in this format?
    *To keep this format, which leaves out any incompatible features, click Yes.
    *To preserve the features, click No. then save a copy in the latest Excel format
    I press yes and the file is saved as comma delimited.
    Could it be that i need to add something to my VBA code, as when the macro runs I am not prompted any of these questions.
    Thanks

  • Download tsv (tab separated values) to Appleworks spreadsheet

    Previously was able to download data from an AOL portfolio directly into an Appleworks 5 spreadsheet operating an iMac with OS 9. Now using OS 10.4.6 and Appleworks 6.2.9 on a Mac Mini none of the AOL options work. The other options for download are csv (comma separated values), qif (Quicken) and asc (Metastock).
    Mac Mini   Mac OS X (10.4.6)  
    Mac Mini   Mac OS X (10.4.6)  

    I have a text.tsv file (Google calls it a csv, but
    that's their error) which I feel I should be able to
    just drop onto AW and have it open in a spreadsheet.
    All I get is a couple of odd characters in the A1
    cell.
    Try dropping the file onto an open AppleWorks word processor document. If it is indeed a tab delimited text file, with no internal formatting information, you should then be able to copy it and paste into a spreadsheet.
    Your comment regarding "a couple of odd characters in the A1 cell" indicates to me that there's more than simply text, tabs and returns in the file. If that's the case, you should be able to see the extra (often odd) characters in the WP document. If so, toggle 'Show invisibles' to on by pressing command-; (semi colon), then copy only the relevant text, tabs (will show as a right pointing arrow) and returns (will show as a reversed L haped arrow pointing left), and paste that block into your spreadsheet.
    Regards,
    Barry

  • Graphics convert but not text even when ocr is disabled

    graphics convert but not text even when ocr is disabled

    Hmmm... I seem to have found the plist file that is doing it. I was looking at /Library/Application\ Support/Apple/Remote\ Desktop/ before... looks like /Library/Preferences/com.apple.ARDAgent.plist is the culprit.
    This plist is a binary, so I had to use plutil to convert to xml in order to make it human readable. I wonder if I can just hack this file up a bit and re-deploy it to each machine. Or I wonder if it would re-build if I simply remove it from each client. I will need to test to find out, seeing as though the task servers are listed in it, probably not a good idea to remove it all the way.

  • Want to convert plist to text

    I want to convert plist to text because I accidently deleted Sticky widget and want to get the text back (via Time machine) then just create a document with the information.
    I need something non techinical - I googled it but was not easy to find a simple solution.  I tried downloading Apple developer tools but took so long I cancelled the down load.  I tried an internet convertor but the file was blank.  I know it is not as I can see the actualy text but failing all this I will edit the file manually but that is tedious work.
    Thank you.

    Not quite sure your problem.  Open plist with TextWranger.app and it is text. You can copy and paste into TextEdit.app if that helps (plain text.)

  • Import data from tsv (tab separated values) file

    I have a large tab separated values file that I want to import into an oracle table so I can a) run queries on this data and b) split into smaller and more manageable files.
    I'm very new to Oracle. I have installed 10g XE and sql_developer.
    This tsv file has 3,684,011 rows. Maybe it could be imported into an Access DB then into Oracle, but that seems like extra work??

    I have a text.tsv file (Google calls it a csv, but
    that's their error) which I feel I should be able to
    just drop onto AW and have it open in a spreadsheet.
    All I get is a couple of odd characters in the A1
    cell.
    Try dropping the file onto an open AppleWorks word processor document. If it is indeed a tab delimited text file, with no internal formatting information, you should then be able to copy it and paste into a spreadsheet.
    Your comment regarding "a couple of odd characters in the A1 cell" indicates to me that there's more than simply text, tabs and returns in the file. If that's the case, you should be able to see the extra (often odd) characters in the WP document. If so, toggle 'Show invisibles' to on by pressing command-; (semi colon), then copy only the relevant text, tabs (will show as a right pointing arrow) and returns (will show as a reversed L haped arrow pointing left), and paste that block into your spreadsheet.
    Regards,
    Barry

  • 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

  • I purchased PDF Converter Plus, v1.0 (4 ). I am unable to convert PDF into text. I get all gibberish when I try to do the conversion.

    I purchased PDF Converter Plus, v1.0 (4 ). I am unable to convert PDF into text. I get all gibberish when I try to do the conversion.

    I went to the site and did exactly as the 'support' said. I tried three PDF documents for conversion to Word. On clicking 'convert', the last window gives the file with .doc suffix. After I save and open it the window says, "The XML file cannot be opened because there are problems with the contents." Under "Details", it says, "Incorrect document syntax".
    Please guide me further.
    Thanks

Maybe you are looking for

  • K7N2 Delta L Won't Post

    Specs: MB - K7N2 Delta L FSB 400 CPU - AMD Athalon XP 2800+ Video - GeForce 2 MX400 (PCI) Hard Drive - (When attached)  Maxtor 160GB 7200RPM 8MB Cache RAM - Kingston 256 MB DDR400 CL2.5 (KVR400X644C25/256 PSU - AXIO 480W   3.3V - 28A +5V - 37A 12V -

  • How to remove a an ambulance siren without ruining a couples vows.

    Hello all, I just picked up Audition CS 6 hoping I could just watch a few tutorials and remove the siren from this couples vow of a wedding I shot yesterday. I want to have this highlight video posted no later than Noon on Sunday as I work within a 4

  • How to create an array of an object,

    Hi, Trying this in Oracle 10.3 studio, I have to use a web service, I have re-catalogued the web service succesfully, I am getting compilation error whenI try to create an array of a object, Services.PackageTrackingService.PackageTrackingItem[] pkgTr

  • Android 3G wasn't working(Miriam)

    OMG This Tech support lady named Miriam Originally from Utah was an angel of God. I have a motorola Droid A855 older phone but works great. About 3 months ago it started not being able to receive 3G but could still connect wifi and make calls and rec

  • Canon 6D Raw to CS2 Camera Raw

    Is there an update for Photoshop CS2 that will allow me to download Raw files from my Canon 6D directly into PS Camera Raw? Thanks!