Field separator problem in file
Hi All,
I have a req in content converion .
I have 2 fields
A and B mapping is one to one only
for this I have used fieldseparator =','
Endseparator='nl'
My req is like this
if only A is coming then comma should also come even B is not coming.
A
A
A,B
A,B
A
A
I hope the req is clear...
Regards
Hi Raj,
There is no issue of parameter .I used these 2 paramters only. and they are working fine but now the req is this
In my scenario there is 2 fields let say Ganga and Raj
both fields in file like this
Raj
Raj,Ganga
Raj,Ganga
Raj
Raj
Raj
My req is this even if ganga not come and only Raj is coming Comma, should also come
Regards
Similar Messages
-
How to get field separator in flat file using GUI_DOWNLOAD function
hi,
how to get field separator in flat file using GUI_DOWNLOAD function.
thanking you.Hi,
Use WRITE_FIELD_SEPARATOR = 'X'.
Check this sample code
REPORT z_file_download.
DATA: w_name(90) TYPE c.
DATA:
BEGIN OF fs_flight,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price LIKE sflight-price,
currency LIKE sflight-currency,
END OF fs_flight.
DATA:
BEGIN OF fs_head,
carrid(10) TYPE c,
connid(10) TYPE c,
fldate(10) TYPE c,
price(10) TYPE c,
curr(10) TYPE c,
END OF fs_head.
DATA:
t_head LIKE
TABLE OF
fs_head.
DATA:
t_flight LIKE
TABLE OF
fs_flight.
fs_head-carrid = 'CARRID'.
fs_head-connid = 'CONNID'.
fs_head-fldate = 'FLDATE'.
fs_head-price = 'PRICE'.
fs_head-curr = 'CURRENCY'.
APPEND fs_head TO t_head.
SELECT-OPTIONS:
s_carrid FOR fs_flight-carrid.
START-OF-SELECTION.
SELECT carrid
connid
fldate
price
currency
FROM sflight
INTO TABLE t_flight
WHERE carrid IN s_carrid.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'D:\flight.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
* 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 = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = t_head
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
OTHERS = 22
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 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:\flight.xls'
filetype = 'ASC'
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = t_flight
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
OTHERS = 22.
IF sy-subrc EQ 0.
MESSAGE 'Download successful' TYPE 'I'.
ENDIF.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Sender File Adapter - FCC - No incoming field separator - How to do FCC?
Hi,
I have a sender File adapter and I need to do the File Content Conversion but there apparently no incoming field separator and the file ocntains just running text - no data records but just information.
For example the incoming file is something like:
The Hongkong and Shanghai Banking Corporation Limited 27JAN2009 PAGE 1
Incorporated in Hong Kong with limited liability
ABC IAL LIMITED ABU DHABI, UAE
ABC MIDDLE EAST Account No. 001-8888888
ABU DHABI Payment Set AAA
BBB MAIL BOX NO.99 Contact Person ABC LIMITED
7777777777 Telephone
AUTOPAY LIST - PROCESSED
(AUTOPAY-OUT SALARY)
Payment Date 27JAN2009
First Party Narrative . 66666666
Second Party Narrative .
The Message type that I am mapping to contains:
MT_XXXX
WA
Item
Item2
Item3
This is so that the information can be mapped to different field areas and send across to the Receiver Mail Adapter. In the mail i receive, i get the running text. I tried giving the field separator as '0x09' but it is not working.
I have also tried WA..fieldContentFormatting to nothing but again no luck.
I have tried with Recordset Sequence with Ascending and variable and have also tried Recordsets per Message with * and blank - but it did not help.
Please advice.
Regards,
ArchanaHi,
I assumed that it was tab but when I made the change in FCC, it did not work.
I would still like to have a output where it looks like below if more than 2 types of information in 1 line as below:
ABC IAL LIMITED ABU DHABI, UAE
ABC MIDDLE EAST Account No. 001-9999999999999
and not something like:
ABC IAL LIMITED ABU DHABI, UAE
ABC MIDDLE EAST Account No. 001-999999999999
I am not sure what to do here.
Help please.
Regards,
Archana -
Sender File Adapter - Problem with field separator
Hi,
I want to upload a CSV file into XI.
The file contains a text part which uses from time to time quotation marks like this:
SD,575757,383838,N/A,XYZ,"This is a text part",7676
But besides there are lines like this:
SD,575757,777722,N/A,XDE,FREETEXT,7575
Has anyone any idea how to configure the file adapter to get it recognize the quotation marks not as field separator?
I've already tried the enclosureSign parameters but that leads to an total unconverted line.
Is it maybe possible to customize two field separators like this:
Structure.fieldSeparator - ,"
Thanks for any answer,
ChristinaNo, it doesn't work.
I've specified now:
Structure.fieldSeparator ,
Structure.enclosureSign "
Structure.enclosureSignEscape ""
Every line without quotation marks is converted fine. Lines with quotation marks stay like in the original CSV file and the whole line is put into one XML tag (still comma separated).
Also the parameter fieldContentFormatting - nothing doesn't make a difference.
Other ideas? -
Variable message length without field separator to file receiver adapter
Hi,
I have a XML document as below
<MT_O_FF>
<ROW>
<HEADER> </HEADER>
<QMGR> </QMGR>
<MESSAGE> TEST MESSAGE </MESSAGE>
</ROW>
</MT_O_FF>
I know the field lengths of <HEADER> and QMGR but MESSAGE has variable length data. We don't want field separator between HEADER, QMGR and MESSAGE. The file should be created as below (text file)
TEST MESSAGE
The above blanks in front of TEST MESSAGE data needs to be there in the file. The problem I am facing is as <MESSAGE> is variable length and the file should not have field separator, is there any way we can create text file using file adapter?
If I use xml.fieldFixedLengths as below, as long as data in MESSAGE is less then 40000 then the file is created with data. If the length is more then 40000 then the file is getting created but the data in MESSAGE is getting truncated. The maximum length adapter allows me to use 40000.
xml.fieldFixedLengths=10,20,40000
xml.fieldNames=HEADER,QMGR,MESSAGE
xml.fieldTooShortHandling=ignore
Thanks in advance for your help.HI,
the parameter fieldTooShortHandling = ignore should solve your purpose.
Ignore means that the system applies the value completely, regardless of it being too long. Subsequent columns are moved correspondingly.
Thanks
Swarup -
Problem with PIPE as a field separator
Hi Gurus,
I am facing a problem in XI .The incoming file is PIPE as a field separator and a carriage return as end of each record.
The problem is that in trailer record if the last field has no value in the file then it is unable to identify it is a field.So all mapping which is there to check the empty filed is not working.
File format processed with status ok.
01|HEADER|F1
02|F1|F2|F3
03|COUNT1|F4
if the same file in the last record if the filed XX is blank then it is not able to trap in mapping.
01|HEADER|F1
02|F1|F2|F3
03|COUNT1|XX
If i am giving a extra PIPE at end of each record then it is working ok and the mapping can able to check if a field is blank.
But without putting a PIPE at the end is it possible to trap error if any last field is contains blank.
it is little URGENT.Please reply.
Thanks,
SatyaHi,
Suppose you called 03|COUNT1|F4 row as "trailer" in recordset structure.
Then you can use the following parameters:
trailer.missingLastfields = ignore - to get converted to XML only fileds that have been filled in
trailer.missingLastfields = add - to have last fileds filled with empty values
trailer.missingLastfields = error - to terminate FCC since file has not complete structure
Regards,
Jakub -
Separator problem in CSV file download
Hi All,
I am downloading the internal table data in CSV file format using the function modules SAP_CONVERT_TO_CSV_FORMAT and GUI_DOWNLOAD.
In the FM SAP_CONVERT_TO_CSV_FORMAT the default value for field separator is ;. But I want comma.
I am passing comma as a field separator but I am getting ; in my CSV file.
Please help.
Thanks in Advance.
- Neha.Hi
It seems fm SAP_CONVERT_TO_CSV_FORMAT doesn't use the parameter I_FIELD_SEPERATOR, but a the constant C_FIELD_SEPARATOR with value ;
So u should replace ; with comma after calling that fm or check a SAP note
Max -
File content conversion without field separator
Hi experts,
in my scenario I'm sending a txt file to an external receiver.
Each field of the file must be separated from the others with differents field separators according with the requirement of the receiver, for example:
field1;field2:field3, field4; ecc....
For this reason I've created in the source message many "FieldSeparator" fields. These fields will be populated by ABAP program.
I thought that it was possible to omit parameter fieldSeparator in content conversion, but testing the interface I receive an error because fieldSeparator is missing.
Is possible to omit fieldSeparator or to specify a fieldSeparator null?
The fields in the target file must be of variable lenght, so I cannot use FieldFixedLenght.
The only solution I found is to create in the target message structure a single string with each field concatenated, is the only possible solution?
Thanks
Fabio Boni
Edited by: Fabio Boni on Oct 21, 2010 5:47 PMSorry...posting error earlier..
The seperator can be concatenated at the end of each field in mapping.So seperator will be part of field value.
But with receiver FCC, you need to either mentione fieldfixedlenght or fieldseperator.Please check if space is going to to work for you as separator.
Edited by: nagarjuna _s on Oct 21, 2010 6:36 PM -
Separator problem after opening a exported CSV file in Excel
Dear experts,
After exporting a report to .CSV file from BEX browser, I opened this file with Excel. I found that "," is considered as separator, but not ";" which is by default the separator in CSV file exported.
For example, when i open the CSV in Notepad, i have:
"15.07.2008";"E001";"No value"
"15.07.2008";"E001";"No value, date, time"
When it is opened in Excel, I have
"15.07.2008";"E001";"No value"(Column A)
"15.07.2008";"E001";"No value(Column A) date(Column B) time"(Column C)
Is that a problem in Excel configuration? How to solve it (for example, set ; as separator)?
Thanks in advance!
Edited by: Xiaoxuan WU on Jan 23, 2008 4:00 PMHi,
Please try opening your .csv file in excel. I am assuming that all texts are in one column. Select this column, go to Data>Text to Columns. Set the checkbox to Delimited. Click on next. Set the delimeter to ; and the text qualifier to ". Click on next. Click on finish. Then save in another filename. Try opening this new .csv file in notepad and see if it has the format you needed.
Hope this helps,
Juice -
Problem with file sender adapter and endSeparator
Hy,
have the following situation: with a sender File adpater i have to receive the same structure of data but in two mode.
1) First mode : each recorset is defined as a file line
Example (not fields separator):
fielda,fieldb,fieldc
field2a,field2b,field2c
2) Second mode : recorset of the same line without end
separator and fieldseparator
Example (not fields separator):
fielda,fieldb,fieldc,field2a,field2b,field2c,......
I configured the adapter as follow.
structure.fieldFixedLengths 1,2,3
structure.fieldNames field1,field2,field3
structure.lastFieldsOptional YES
structure.processFieldNames fromConfiguration
structure.endSeparator 'nl'
PROBLEM
Mode 1) works but mode 2) doesn't work.
Could anyone solve my problem??
Thank's
MatiHi,
Try using two differnt record structure name for each mode.for eg give it as structure1 and structure2.then u give the content conversion parameter for both the recordset depending on ur requirement i.e, with and without end seperator.
regards
jithesh -
How to use Space as field Separator?
I have a flat file with space (multiple spaces between different fields) as a delimiter. Whenever I try to upload the file it doesn't allow me to perform. In the external tab when i chose CSV file and do not give any value in the file separator, it just pops up an information box '00H not allowed as a separator' and when I try to use ASCII /hex value '0040' still get the same message. The problem is, file is coming from 3rd party and they don't want to change the separator as comma or tab delimited CSV file.
1) Is there any program which I can use in TR to convert space as coma or tab delimited and then feed the value to different fields? OR
2) How to read the one line as one field and then feed to multiple fields?
3) Any other solution/idea?
please help me out.
Thanks,Hi Mau,
Goto you Flatfile Datasource -> Extraction Tab -> Data Format (CSV) -> Data Seperator -> ' ' ( ie. space ).
It will consider the space as the seperator.
Hope it helps you.
Assign points if it helps you.
Regards,
Yokesh. -
System not recognising the ~ as separator in txt file.
Hi,
In File2File senario, Sender system is placing txt file with 5 fields in the FTP server as mentioned below,
I have given "~" as fieldseparator and 'nl' as new line.
Fielsender.txt
Onetwothreefourfive
sixseveneightniniten
I have done all the Design and configuration in the XI.
In datatype defination I have given below structure.
File_MT
Data
ITEM
Field1 xsd:string
Field2 xsd:string
Field5 xsd:string
Problem: While executing this in Request payloads, the entire row ita taking into Field1 and its not
recnizing the ~ as separator.
Ex: <xml>...
<Data>
<item>
<field1>Onetwothreefourfive</field1>
</item>
<item>
<field1>sixseveneightniniten>
</item></Data>
Can anyone tell me where I am doing wrong and how can we overcome this.
Thanks in advance
Balaji.Thanks for your reply...
Its working for me, I have one more question.
In recever system I have give tab '0x09' as the file separator but I am getting the same file in recever side also.
Onetwothreefourfive
sixseveneightnineten
In recevier side the field separator in not working.
Can you please tell me where I am doing wrong.
thanks in advance.
Balaji. -
Set field separator for whitespace
Hi,
We have a set of flat files (around 12000) and it need to be load using oracle external table. we have concatenated all the files into one single file and loading the files into oracle database successfully.
But there is a problem, in the flat files we have identified that the field separator is "whitespace" and we gave whitespace as field separator in oracle external table statement. But there are some fields where there is null values for many rows and since the field separator is whitespace so the next field's value is being inserted into the null value field in place of null.
I am stuck in a very hard situation and really do not know how to come out of it. I have little idea that using awk or sed utilities we can set field separator.
Do you have any idea how to set the field separator in this case?
Your assistance is highly appreciated.
Below is the sample of one of those flat files:
051 419040086626885 55407914 P 00016731 01007644 02 Internet 0160638830 11121906182700021 016 00204 I TEST MNC004.MCC419.GPRS 094.124.161.023 094.124.006.197 094.124.006.010 1275741768 99999
Thanks in advance.Can you clarify some things about your data?
1. The sample data you posted only shows 20 values but the table has 21 columns. Is the last value NULL?
2. The sample data you posted shows 99999 for the last column but that corresponds to LAST_UPDATE_DATE which is a DATE field
Why the descrepancy?
3. Are the records delimited by CRLF or by LF? or by some other whitespace. CR and LF are considered whitespace
>
If TERMINATED BY WHITESPACE is specified, data is read until the first occurrence of a whitespace character (spaces, tabs, blanks, line feeds, form feeds, or carriage returns). Then the current position is advanced until no more adjacent whitespace characters are found. This allows field values to be delimited by varying amounts of whitespace. For more information about the syntax, see Syntax for Termination and Enclosure Specification.
>
so if the first record has one column with a missing (NULL) value the first column from record #2 will be used
as the last column of record #1. The data in the entire file will continue to shift forward causing every record to be wrong.
4. Have you contacted the vendor providing the files to find out how other clients are loading these files into a database?
5. Are there any data columns that cannot be NULL?
In order to properly parse record-oriented data you have to be able to locate the record boundaries; that is determine how many data values there are for each record. Using WHITESPACE alone you will not be able to do that if a NULL value is not represented in the file by some character.
Then for each set of data belonging to one record you need to be able to identify the data that belongs to each column. Using WHITESPACE alone
you will not be able to do that if a NULL value is not represented in the file by some character.
You need to contact the vendor for assistance in having the files produced in a way that they can be properly loaded again. Ask the vendor if they can reload their own files and, if so, what utility they are using to do it. The vendor should be able to use a different delimiter or replace NULL values with a special character so that they are represented in the data. -
The Flat file(.txt) has 5 fields separated by vertical bars(|). this fils has to be uploaded using the FM 'UPLOAD'.
Here the problem is, the internal table is not taking the individual field values, but it is taking the values of 2 or 3 fields into one field.
Kindly guide me on this.
I have also tried with 'ws_upload' and 'gui_upload'
eg. of flat file, given below,
500076|1003|01012005|31012005|8552000.00|8952000.00|22200|002|I
500076|1004|01012005|31012005|2690000.00|2748000.00|88900|003|IHi girish,
1. Exactly for this purpose,
i have developed an independent FORM
where we give inputs
a) file name (eg. abcd.txt)
b) separator (eg | in your case)
c) internal table (eg. t001)
2. It will provide the data
in proper format
(no matter what the separator)
(it can work with any kind of separator)
3. just copy paste in new program.
REPORT abc.
change your table declaration and file name
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
PERFORM myupload TABLES t001 USING 'd:\t001.txt' '|'.
BREAK-POINT.
in debug see t001
INDEPENDENT FORM
FORM myupload TABLES orgtab
USING filename separator.
Data
DATA : BEGIN OF itab OCCURS 0,
myline(1000) TYPE c,
END OF itab.
DATA : extension(5) TYPE c.
DATA : name(100) TYPE c.
DATA : newfilename TYPE string.
Step 1
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
TABLES
data_tab = itab.
Step 2
LOOP AT itab.
REPLACE ALL OCCURRENCES OF separator IN itab-myline WITH
cl_abap_char_utilities=>horizontal_tab.
MODIFY itab.
ENDLOOP.
Step 3
DATA : path LIKE pcfile-path.
path = filename.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
extension = extension
name = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
invalid_drive = 1
invalid_extension = 2
invalid_name = 3
invalid_path = 4
OTHERS = 5
Step 4
newfilename = filename.
REPLACE name IN newfilename WITH 'temp'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = newfilename
TABLES
data_tab = itab
FIELDNAMES =
Step 5
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = newfilename
has_field_separator = 'X'
TABLES
data_tab = orgtab.
ENDFORM. "myupload
3.
regards,
amit m. -
Hi Sdners,
My interface is Idoc to Flat file. I am facing a problem when I am doing content conversion for receiver communication channel.
My receiver structure is
abc 123 xyz
def 456 xyz
ghi 567 xyz
For me field separator is space. Can anybody suggest, what I have to give as field separator if space comes.
Regards
Jayaram.GThanks for your quick reply.......
Hi Vijay,
I tried by copying space from notepad and pasted in content conversion. But when I saved and activated my communication channel, it is not showing any space. Can you please help me out from this problem.
Hi Jyothi,
If possible can you provide hexadecimal code for field separator as space.
Thanks in advance.
Regards,
Jayaram.
Maybe you are looking for
-
How can I keep messages on the iCloud server?
I now compute from two locations, home 1 and home 2, with home 1 being my main machine. When I'm at home 2, how can I use Mail to read my messages but keep them on the server so that when I return to home 1, I can download to my main Mac? I can't f
-
I use the on screen po-up alarms quite a bit and notice that when one comes on screen the iCal icon bounces in the dock. About half the time, when I click on the alarm to get rid of it the icon in the dock keeps bouncing, apparently it will keep this
-
Hi, I have problem (can I call it hunt on ghost?) with MSI G4Ti4200 128MB. Graphic is freeze every 2sec on 0.3sec! I try to update drivers/bios/all other SW, change IRQ, change Bios settings, Detonator settings, VIA chipset drivers, 4x reinstall Win
-
Deleting The History Folder In Collections
Hi I had Safari all personalised but it crashed recently. When I restarted it, in the Collections column the History folder had re-appeared. I had deleted it somehow previously but can't remember how. I know how to delete bookmarks and folders etc. b
-
How to set Default value in Vendor master
Hi , While creating or Updating Vendor Master , House Bank should take automaticaly one purticular Bank . How to do this? please kindly help me on this issue. Thanks JK