Writing schema for pipe delimited file
Hi all,
I have to write a pipe delimited file (|) in .txt at a particular location. I am not seeing this option in native schema creation.
The file should be written in following format:
Header1
Line1
Line2
Line3
Header2
Line1
Line2
Line3
Can we write a schema for such kind of scenario?
Here is an example for the format specified above:
Orderno1|Customer1|site1
Partno1|price1|Quantity1
Partno2|price2|Quantity2
Partno3|price2|Quantity1
Orderno2|Customer2|site2
Partno1|price2|Quantity2
Partno1|price2|Quantity2
Partno2|price2|Quantity3
Please help me out.
Thanks in advance,
Abhishek.
Hi Abhishek,
You are right there is no option in native schema creation wizard for generating '|' delimiter file.
But you can achieve this problem with another approach.
step 1: Create schema file for ',' (comma) delimiter through native format builder wizard.
step 2: open the created XSD file and replace ',' with '|' option in terminatedBy command of each element.
step 3: Attach this updated XSD file to your outbound(write) service.
Thanks
Praveen
Edited by: PraveenT2 on Nov 19, 2008 11:01 PM
Similar Messages
-
File content conversion for Pipe delimited file
Hi
i have a scenario ( file-xi-proxy) in whch file is coming in a pipe delimited.
my data type is like
DT_ XXXXX
AwardInfo
Header contains some fileds
DetailRecord contains some fileds
trailer contains some fields
what are content conversion parameters i have to use
venkatSedamkar,
Expecting you have one header, multiple details and one trailer then give recordset structure in sender file communication channel as:
Header,1,DetailRecord ,*,trailer,1
In content conversion you should give parameters:
Header.fieldSeparator : |
Header.endSeparator : 'nl'
DetailRecord.fieldSeparator : |
DetailRecord.endSeparator : 'nl'
trailer.fieldSeparator : |
trailer.endSeparator : 'nl'
You may need to change the parameters also according to your strcuture and the file layout. See this SAP help for file content conversion:
http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
Regards,
---Satish -
Pipe delimited file on application server.
Hi , i m creating a text file on application server, i have written below code and file is getting created correctly. however, i want to create pipe delimited file. is there any method for this?
DATA : lv_line(173).
DATA : l_wa_itab_length(4) TYPE c VALUE '173'.
IF NOT p_tab[] IS INITIAL.
SORT p_tab.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
IF sy-subrc NE 0.
MESSAGE 'Error on output file read' TYPE 'E'.
ELSE.
LOOP AT p_tab.
lv_line = p_tab.
TRANSFER lv_line TO p_file LENGTH l_wa_itab_length.
CLEAR p_tab.
CLEAR lv_line.
ENDLOOP.
CLOSE DATASET p_file.
ENDIF.
ENDIF.
REFRESH p_tab.i m pasting below my entire code.
REPORT zmigration_data_download.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
DATA: d_table_ref TYPE REF TO data.
DATA: d_rfc_db_opt TYPE rfc_db_opt.
DATA: it_opt LIKE rfc_db_opt OCCURS 0 WITH HEADER LINE.
DATA: d_file TYPE string.
PARAMETERS: p_tab TYPE dd02l-tabname OBLIGATORY.
PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY DEFAULT '/usr/sap/tmp/test.txt'.
SELECT-OPTIONS: s_opt FOR d_rfc_db_opt NO INTERVALS.
START-OF-SELECTION.
REFRESH it_opt.
LOOP AT s_opt WHERE sign = 'I' OR option = 'EQ'.
it_opt-text = s_opt-low.
APPEND it_opt.
ENDLOOP.
CREATE DATA d_table_ref TYPE TABLE OF (p_tab).
UNASSIGN <fs_table>.
ASSIGN d_table_ref->* TO <fs_table>.
IF <fs_table> IS ASSIGNED.
CLEAR <fs_table>.
SELECT * FROM (p_tab) INTO TABLE <fs_table>
WHERE (it_opt).
IF sy-subrc EQ 0.
PERFORM download_file TABLES <fs_table> USING p_file.
MESSAGE i398(00) WITH 'Upload from SAP Successfull'.
ENDIF.
ENDIF.
*& Form download_file
text
-->P_<FS_TABLE> text
-->P_P_FILE text
FORM download_file TABLES p_tab USING p_file.
DATA : lv_line(173).
DATA : l_wa_itab_length(4) TYPE c VALUE '173'.
IF NOT p_tab[] IS INITIAL.
SORT p_tab.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
IF sy-subrc NE 0.
MESSAGE 'Error on output file read' TYPE 'E'.
ELSE.
LOOP AT p_tab.
lv_line = p_tab.
TRANSFER lv_line TO p_file LENGTH l_wa_itab_length.
CLEAR p_tab.
CLEAR lv_line.
ENDLOOP.
CLOSE DATASET p_file.
ENDIF.
ENDIF.
REFRESH p_tab.
ENDFORM. " download_file -
Extract data from Pipe Delimited file
Hi everybody,
Could someone provide me the command to extract data from a pipe delimited file ("|") using Open/Read Data set.
I mean eliminating the delimiter ("|") and just picking the data.
Thanks
MHere you go.. this code snippet parses the input file record by using pipe (variable lv_pipe) as separator, for tab separated file you can use lv_tab like wise...
TYPES: BEGIN OF ts_field,
field(50) TYPE c,
END OF ts_field,
tt_field TYPE TABLE OF ts_field.
DATA: ls_record TYPE string,
ls_input_data TYPE ts_input_data,
lv_tab TYPE x VALUE '09',
lv_pipe TYPE C VALUE '|',
ls_field TYPE ts_field,
lt_field_tab TYPE tt_field,
lv_field_index TYPE syindex,
lv_record_no TYPE syindex.
FIELD-SYMBOLS: <fs_field> TYPE ANY.
OPEN DATASET fv_file_path IN TEXT MODE FOR INPUT.
IF sy-subrc = 0.
DO.
lv_record_no = lv_record_no + 1.
READ DATASET fv_file_path INTO ls_record.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT ls_record AT lv_pipe INTO TABLE lt_field_tab.
CLEAR: lv_field_index, ls_input_data.
LOOP AT lt_field_tab INTO ls_field.
lv_field_index = lv_field_index + 1.
ASSIGN COMPONENT lv_field_index OF STRUCTURE
ls_input_data TO <fs_field>.
IF sy-subrc = 0.
<fs_field> = ls_field-field.
ENDIF.
ENDLOOP.
APPEND ls_input_data TO ft_input_data.
ENDIF.
ENDDO.
CLOSE DATASET fv_file_path. -
Download data into a pipe delimited file
I want to download data from an internal table into a pipe delimited file.
I plan to use FM: SAP_CONVERT_TO_TEX_FORMAT but the system I am working on is BW 3.1.
This FM does not exists in BW 3.1
How can I download data from an internal table into a pipe delimited file?
Please help,
Thanks,
CDPlease use Search before posting, this has been discussed many times already. Not necessarily as "pipe delimited", but delimiter doesn't really matter here. Here is just one of the recent posts:
Write internal table to file GUI_DOWNLOAD or TRANSFER?
Note that all GUI functions only work in the foreground. There are also some solutions in "pure ABAP", like looping through the internal table fields and adding a delimiter. Or a quick and dirty solution - define an internal table with the extra fields for delimiters (mainframe legacy!).
Also questions specific to BW should be posted in the BW forum IMHO, not in ABAP General. Otherwise you'll get a lot of "valuable" suggestions here... -
Hi
can anybody tell me how the pipe delimited file look like ?? If possible with example. What is the difference between tab delimited, pipe delimited, CSV, flat file, fixed with fomat file and text file ??
Thanks
KumarHey
here is the thing
you have two different words, <i>Delimited</i> and <i>Separated</i>
now if u go with the dictionary meaning then <i>Delimited</i> means in the end which means Pipe should be in the end,and going with the dictionary meaning of <i>Separated</i> means it should be in between .but since we are not English authors i guess u can consider Raj's reply as more authentic.
Its all Business jargo so don't worry too much about it,you have to handle these files in FCC so if u have Pipe in between the entries then give .fieldSeparator as Pipe(|) and if u have Pipe(|) only in the end give .endSeparator as Pipe(|).
Thanx
Aamir -
HI Guys,
can some body explain what a pipe delimited file format is.
thanks
Column Name = WRKAREA_CODE
Format of Pipe Delimited File = 20 Digits
SAP DB Type = CHAR (20)
Description = Work Area Code
WRKAREA_CODE is a field of the table WFAV_WRKAREAHI,
a pipe delimited file is a file in which the content of the file is seperated by a pipe symbol..
example
100|Name|School|age|
*-- Read the File From PC
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = V_FILENAME
TABLES
DATA_TAB = I_FILE
EXCEPTIONS
OTHERS = 17.
*-- Split the Record into Individual Fields
SPLIT X_FILE-LINE AT '|' INTO X_PRSTR-VCODE
X_PRSTR-CURR
X_PRSTR-ODLEVEL
X_PRSTR-DLEVEL
X_PRSTR-EDATE
X_PRSTR-SCODE
X_PRSTR-TCODE
X_PRSTR-DCODE
Thanks
Mahesh
Thanks
Mahesh -
SQLLDR - spec for "fields terminated" clause for tab delimited files
Does anyone know what the spec for tab delimited files is for the "fields terminated" clause in SQLLDR? See the below example for a comma delimited file:
FIELDS TERMINATED BY ","
Thanks in advance!
JeffHi Jeff,
You can try this,
TERMINATED BY WHITESPACE
The WHITESPACE option is usefull when, delimiter is any whitespace character including spaces, tabs, blanks, line feeds, form feeds, or carriage returns. (Only used with TERMINATED, not with ENCLOSED.)
I hope this will help you.
Thanks,
Thazul. -
How to create schema for Header and Footer with pipe delimiter file BPEL11g
Hi all,
I have issule creating Schema for Header and Footer with body file .The file format is Pipe delimiter.The following format below like is...
Softeware Components:File Adapter(Read) 11g,
1|1211|000|577|5444
1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
1|4544|000|yted
I hope get the sollution for this from this Forum..Please help me out..Thankyou.You mean how many rows or columns..?
If coloumns means 5 and rows only one(1). -
How to create Schema Header and footer with Pipe delimiter file..?
Hi all,
I have issue with creating Schema Header and footer with body file ..The file format is Pipe delimiter.. The follwing file below like is...
Adapters:File Adapter(Read)-11g.
1|000|2025|SDFG|54787
1|2055|244|9566|000|000|044|2577|361147|45554|wweqw|52555|564|000|647|464
1|2027|344|4566|000|000|044|8577|361147|45554|wweqw|82555|564|000|647|844
1|2024|444|6566|000|000|044|9577|361147|45554|wweqw|12555|564|000|647|544
1|2023|544|8566|000|000|044|5577|361147|45554|wweqw|52555|564|000|647|442
1|2022|644|3566|000|000|044|7577|361147|45554|wweqw|02555|564|000|647|448
1|0000|546|25544|454
If you have sollution for this, please help me out..Thank you.You mean how many rows or columns..?
If coloumns means 5 and rows only one(1). -
FCC for Broken pipe delimited file
Hi Fellow SDNer's
I have a broken pipe delimited flat file . I want to do file content conversion for the same .
Can you please help me with the parameters
I am on PO 7.4 dual stack
Thanks
Ninad SaneHi Ninad
It looks like the broken pipe character is outside the US-ASCII character set.
ASCII Code - The extended ASCII table
You can try using the ASCII character to see if it works or not:-
Header.fieldSeparator = '0xA6'
Check also the following thread that mentions the use of non US-ASCII character.
Content conversion - endSeparator and fieldSeparator with unusual separators
In particular, it mentions OSS note 1936206 - if you have the corrections in place, you can try using MessageTransformBean and specifying the encoding with the following additional parameter.
xml.fieldSeparator.encoding=ISO-8859-1
Rgds
Eng Swee -
Hi guys,
I am uploading the data from a file which is in the application server and in pipe delimiter format.
This file in the format like .... let us take 100 records among those one record is header, 98 data records and one trailer record. These are seperated by the record locater like header with 0, data record with 1 and trailer with 9.
So what i am doing is uploading that file first of all into one internal table I_ARFILE, then splitting the data at pipe into 3 different internal tables. In the mean time I am doing the validations also for the number of records...
like there should not be more than one header, and one trailer........
here I am pasting my code.....
IF l_subrc = 0.
LOOP AT I_ARFILE.
READ TABLE I_ARFILE INTO WA_ARFILE.
SPLIT WA_ARFILE AT C_PIPE INTO WA_ARHEADER-P_RECTYPE
WA_ARHEADER-P_PRCID
WA_ARHEADER-P_SENDR
WA_ARHEADER-P_CDATE
WA_ARHEADER-P_CTIME
WA_ARHEADER-P_OBTYP
WA_ARHEADER-P_SEQNO
WA_ARHEADER-P_FRTXT.
IF WA_ARHEADER-P_RECTYPE = 0.
APPEND WA_ARHEADER TO I_ARHEADER.
DESCRIBE TABLE I_ARHEADER LINES V_ITABLINES.
VALIDATION FOR NUMBER OF HEADER RECORDS
IF V_ITABLINES <> 1.
MESSAGE 'NUMBER OF LINES READ ARE NOT SAME' TYPE 'E'.
LEAVE PROGRAM.
ENDIF.
CLEAR V_ITABLINES.
ELSE.
SPLIT I_ARFILE AT C_PIPE
INTO WA_ARITEM-P_RECTYPE
WA_ARITEM-p_xblnr
WA_ARITEM-p_bldat
WA_ARITEM-p_budat
WA_ARITEM-p_blart
WA_ARITEM-p_awkey
WA_ARITEM-p_kunnr
WA_ARITEM-p_xref1
WA_ARITEM-p_xref2
WA_ARITEM-p_xref3
WA_ARITEM-p_wrbtr
WA_ARITEM-p_zterm
WA_ARITEM-p_zuonr
WA_ARITEM-p_rstgr
WA_ARITEM-p_wskto
WA_ARITEM-p_sgtxt.
IF WA_ARITEM-P_RECTYPE = 1.
APPEND WA_ARITEM TO I_ARITEM.
ENDIF.
VALIDAITON FOR THE NUMBER OF DATA RECORDS.
DESCRIBE TABLE I_ARITEM LINES V_ITABLINES.
DESCRIBE TABLE I_ARFILE LINES V_ITABLINES1.
V_ITABLINES1 = V_ITABLINES1 - 2.
IF V_ITABLINES1 <> V_ITABLINES.
MESSAGE 'NUMBER OF LINES READ ARE NOT SAME' TYPE 'E'.
LEAVE PROGRAM.
ENDIF.
LOOP AT I_ARITEM.
V_BAL1 = V_BAL1 + I_ARITEM-P_WRBTR.
V_DIS = V_DIS + I_ARITEM-P_WSKTO.
ENDLOOP.
CHECKING THE SUM OF THE BALANCE AMOUNT OF ALL THE RECORDS AND BALANCE AMOUNT IN TRAILER RECORD
IF V_BAL1 <> WA_ARTRAILER-TOBAL.
MESSAGE 'TOTAL AMOUNT IS NOT EQUAL TO THE SUM OF ALL THE AMOUNTS' TYPE 'E'.
ELSE.
CHECKING THE SUM OF THE DISCOUNT AMOUNT OF ALL THE RECORDS AND BALANCE AMOUNT IN TRAILER RECORD
IF V_DIS <> WA_ARTRAILER-TODIS.
MESSAGE 'TOTAL DISCOUNT AMOUNT IS NOT EQUAL TO THE SUM OF ALL THE DISCOUNT AMOUNTS' TYPE 'E'.
ENDIF.
CLEAR V_BAL1.
APPEND WA_ARITEM TO I_ARITEM.
CLEAR WA_ARITEM.
CLEAR WA_ARFILE.
CLEAR V_ITABLINES.
CLEAR V_ITABLINES1.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
ELSE.
READ TABLE I_ARFILE INTO WA_ARFILE INDEX V_ITABLINES.
SPLIT WA_ARFILE AT C_PIPE INTO WA_ARTRAILER-P_RECTYPE
WA_ARTRAILER-COUNT
WA_ARTRAILER-TOBAL
WA_ARTRAILER-TODIS.
IF WA_ARTRAILER-P_RECTYPE = 9.
APPEND WA_ARTRAILER TO I_ARTRAILER.
ENDIF.
DESCRIBE TABLE I_ARTRAILER LINES V_ITABLINES.
IF V_ITABLINES <> 1.
MESSAGE 'NUMBER OF LINES READ ARE NOT SAME' TYPE 'E'.
LEAVE PROGRAM.
ENDIF.
CLEAR WA_ARFILE.
CLEAR V_ITABLINES.
ENDIF.
*CLEAR WA_ARFILE.
CLEAR V_ITABLINES.
CLEAR V_ITABLINES1.
ENDIF.
ENDLOOP.
In this code something wrong like....
I have to modify this code so that i can split the file based on the record indicator to different internal tables.
if you see my code I am going wrong after i split the data into header internal table... did the validations then I put the else condition and split the same record again into 2nd internal table. But I have to take the second record once the first one is filled..........
Can any one guide me how to do that plz...... I am bit confused with this
SRIHi,
Please check , first you need to split the file and move header, item, trailer , then using these internal tables do your validations
DESCRIBE TABLE I_ARFILE LINES V_LIN
READ TABLE I_ARFILE INTO WA_ARFILE INDEX 1.
IF SY-SUBRC EQ 0.
SPLIT WA_ARFILE AT C_PIPE INTO WA_ARHEADER-P_RECTYPE
WA_ARHEADER-P_PRCID
WA_ARHEADER-P_SENDR
WA_ARHEADER-P_CDATE
WA_ARHEADER-P_CTIME
WA_ARHEADER-P_OBTYP
WA_ARHEADER-P_SEQNO
WA_ARHEADER-P_FRTXT.
APPEND WA_ARHEADER TO I_HEADER.
ENDIF.
READ TABLE I_ARFILE INTO WA_ARFILE INDEX v_LIN.
IF SY-SUBRC EQ 0.
SPLIT WA_ARFILE AT C_PIPE INTO WA_ARTRAILER-P_RECTYPE
WA_ARTRAILER-COUNT
WA_ARTRAILER-TOBAL
WA_ARTRAILER-TODIS.
APPEND WA_ARTRAILER TO I_TRAILER.
ENDIF.
* FIRST DELETE TRAILER THEN GO FOR HEADER
READ TABLE I_ARFILE INTO WA_ARFILE INDEX V_LIN.
DELETE I_ARFILE INDEX SY-TABIX
READ TABLE I_ARFILE INTO WA_ARFILE INDEX 1.
DELETE I_ARFILE INDEX SY-TABIX.
LOOP AT I_ARFILE INTO WA_ARFILE.
SPLIT I_ARFILE AT C_PIPE
INTO WA_ARITEM-P_RECTYPE
WA_ARITEM-p_xblnr
WA_ARITEM-p_bldat
WA_ARITEM-p_budat
WA_ARITEM-p_blart
WA_ARITEM-p_awkey
WA_ARITEM-p_kunnr
WA_ARITEM-p_xref1
WA_ARITEM-p_xref2
WA_ARITEM-p_xref3
WA_ARITEM-p_wrbtr
WA_ARITEM-p_zterm
WA_ARITEM-p_zuonr
WA_ARITEM-p_rstgr
WA_ARITEM-p_wskto
WA_ARITEM-p_sgtxt.
APPEND WA_ARITEM TO I_ITEM.
ENDLOOP.
aRs -
Pipe Delimited file with comma
Hi Guys,
I have a pipe '|' delimited csv file. One of the field contains ',' (comma) for few records. The data loads fine uptill the PSA but when I load the data in the cube, that field is coming empty as well as some other feilds which donot have a comma in it.
The delmiter in IP and DS is used '|' pipe.A pipe within quotes? I don't think you can do that with regex. But you can simply itearate through the chars of the String with an "isInsideQuotes" boolean flag and do a manual replacement using StringBuffer.
-
Converting an XML file to a DAT pipe delimited file
Hi
I'm trying to create an SSIS Package which converts an XML file into a dat file which is pipe delimited.
I want the package to be generic so that once that minimal modification is needed when using for different files.
I've so far had no luck with this and need some help/assistance.
All help fully appreciated.
Thank you
Umar JavedThe XML file can vary from fixed to variable.
for Fixed, i've done the same thing as you've suggested and parametrized the flat file connection manager.
For The XML source is there any way we can parametrize the location of the XML or XSD files?
For Variable, unfortunately due to restrictions we can not create an intermediate table and then export.
is there any other way?
Thanks
Umar Javed
XSD path can be made dynamic as below
http://picnicerror.net/development/sql-server/define-xsd-file-for-ssis-xml-source-using-expression-2012-04-21/
For variable you can even add them to configurations and then pass them from a file using xml configuration option.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
ODI -- PIPE Delimited file loadig
We are introducing ODI tool for the first time.
We have successfully imported fixed format UNIX file into ODI and loaded data.
We have second set of files in PIPE Delimited format, when we are trying to reverse engineer and import them as Delimited file, we are getting error message.
If someone can share their thoughts and experience it is well appreciated.How do I post screen shots --that will explain clearly
Maybe you are looking for
-
Using firefox 14.0.1. Loading a link using right-click and "Open Link In New Window", results in new window opening but address bar does not show URL. However, if I right click on a link and select "Open Link In New Tab", the Tab shows URL in address
-
Connection pooling in RFC adapter..
Hi folks I have a requirement to use connection pooling in RFC adapter.I understand we can use JCO.Client class parameters in the advanced tab of RFC adapter..Does that mean I can use <b>JCO.addClientPool()</b> function.??? (I guess not,as it is not
-
What is the best method to have multiple string limits in a single test
Hello All, I need a little advice I have two strings that need to be evaluated as a pass criteria for a single test test step (Numeric String limit test). What would be the best approach to this? The strings are "00000000 00000010" and "00000000 000
-
"SOAP header Action was not understood."
Guys , I am trying to get the UserProfile Details from a SharePoint Server that is configured to use https and NTLM authentication. I am doing this within a Windows Form Application on MS Visual Studio 2010. I am using the following custom binding: <
-
have an i phone 3 g . i want to udate it to latest os . can i update from other pc also ?, if answer is yes then if after getting update from other pc i will switch to my older pc then latest softer which i have updated will remain or it will switc o