Converting Flat File data into XML
Hi Experts,
Consider the message type of the SENDER system and flat file data
<dt_sender>
<root>
<header1> 0..1
<f1>
<f2>
<f3>
<header2> 0..1
<f4>
<f5>
<f6>
<item> 1..unbounded
<f7>
<f8>
<f9>
<f10>
<f11>
<f12>
</item>
abc def ghi jkl mno pqr
123 123 123 123 123 123
456 456 456 456 456 456
how to convert the flat file data into following XML data. please note that each field value is separated by TAB delimeter...wht parameters shld b used
<root>
<Header1>
<f1>abc</f1>
<f2>def</f2>
<f3>ghi</f3>
</Header1>
<Header2>
<f4>jkl</f4>
<f5>mno</f5>
<f6>pqr</f6>
</Header1>
<item>
<f7>123</f7>
<f8>123</f8>
<f9>123</f9>
<f10>123</f10>
<f11>123</f11>
<f12>123</f12>
<f7>456</f7>
<f8>456</f8>
<f9>456</f9>
<f10>456</f10>
<f11>456</f11>
<f12>456</f12>
</item>
points will be given to the correct answers
Thanks in advance.
FAisal
Edited by: Abdul Faisal on Feb 29, 2008 5:53 AM
Faisal,
When you read the multiple recordset strucutre file then each record in txt file should have an header from which you can identiy which segment it should go.. and you identiy it by using the keyfiledValue in file adapter
<root>
<header1> 0..1
<f1>
<f2>
<f3>
<header2> 0..1
<f4>
<f5>
<f6>
<item> 1..unbounded
<f7>
<f8>
<f9>
<f10>
<f11>
<f12>
</item>
for this input file
abc def ghi jkl mno pqr
123 123 123 123 123 123
456 456 456 456 456 456
abc def ghi can be read using the file adater to header 1 usinfg key field value, but using the same file adapter you cannt put GHI into header2.
else you should read whole row abc def ghi jkl mno pqr in single filed and write an UDF to split data to header1 and Header 2
similarly you have to take care for item records also
if your inout file is something like this
abc def ghi
jkl mno pqr
123 123 123 123 123 123
456 456 456 456 456 456
abc identifies to Header 1
JKL for Header 2 so on...
read the whole line in single field and write UDF to Split to header 1 and header 2 similary for item.
Similar Messages
-
How to convert the flat file data into sap tables . ?
how to upload flat file data into sap table . before upload mapping is also there in some filds . any one can give me some steps how to upload and mapping . ?
Hi
See the sample code
REPORT zmmupload.
Internal Table for Upload Data
DATA: i_mara like MARA occurs 0 with header line
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_mara
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Upload the Data from Internal Table
MODIFY MARA from TABLE i_MARA.
Regards
Anji. -
How to store the flat file data into custom table?
Hi,
Iam working on inbound interface.Can any one tell me how to store the flat file data into custom table?what is the procedure?
Regards,
SujanHie
u can use function
F4_FILENAME
to pick the file from front-end or location.
then use function
WS_UPLOAD
to upload into
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME' "Function to pick file
EXPORTING
field_name = 'p_file' "file
IMPORTING
file_name = p_file. "file
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file1
TABLES
data_tab = it_line
*then loop at it_line splitting it into the fields of your custom table.
loop at it_line.
split itline at ',' into
itab-name
itab-surname.
endloop.
then u can insert the values into yo table from the itab work area.
regards
Isaac Prince -
Load flat file data into ODS in BI
Dear Gurus,
How to load flat file data into ODS?. Please share the article if you have.
advance wishes
Thanks
VenkadeshPlease search the forums before posting :
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60debae1-84dd-2b10-e7bf-bdedf1eabdf9
http://wiki.sdn.sap.com/wiki/display/BI/Beginner+Section -
How to Convert internal table data into xml and xml data into internal tab
Hi Guys,
I have a requirement that i have to convert the internal table data into xml format and viceversa . for my requirement i came to know that i have to use Transformations concept. i done the converting the data from internal table into xml data by using standard Tranformations. My Question is
1) Can i use same Transformation to convert the xml data into abap internal table. if it is possible then how ???
2) Is it possible using the standard Transformation or I have to go for XSLT approach
Please help me out from this guys,
Thanks and Regards
KotiHi Koti,
This is possible. There is a link. With the help of this link you can convert ABAP data to XML and vice versa.
Link: http://www.heidoc.net/joomla/index.php?option=com_content&view=article&id=15:sapxslt&catid=22:sap-xslt&Itemid=31 -
Moving flat file data into a nested xml hierarchy
Post Author: jlpete72
CA Forum: Data Integration
I am working to build data flows which move data from fixed lenght flat files into nested hierarchical xml files. I think I have the transforms mapped correctly but there must be something I'm missing. The data flows validate with no errors, but when executed it appears that they are getting stuck in a loop. My flat source files have around 3000 rows, but the data flows are showing millions of records being processed.
I have only one schema in the source and a variable number of schemas in the target xml files. I am using a query transport and mapping all of the output schema levels in the target xml From tabs.
I have even tried creating separate database tables for each target schema, and I still get a runaway process. When there are more than two schemas in the target xml file, the process eventually consumes all of the servers memory and crashes the system.
I'm not sure if I need to be using a different transport or what but am hoping that someone can shed some insight on what is happening here.
Thanks, JerryPost Author: jlpete72
CA Forum: Data Integration
Thanks for the response. I didn't have a choice but to enter the From statement, but haven't yet seen any results from entering a Where clause. In my case, there is only one input file/schema so the where clause would be something like "cust_inv_1.SldFmCustCd = cust_inv_1.SldFmCustCd".
I would agree that it seems as though I am generating a cartesian product. In the circumstance of having only one input schema mapping to multiple output schemas, I'm not seeing how to properly restrict the rows.
I have been going through the manuals looking for clues, but have not found anything that helped yet.
Any help and/or ideas would be appreciated.
Jerry -
Interface used in loading flat file data into bw
what is the interface used in loading flat files into the bw system.
HI Flat file load is its own interface. It leverages the S-API (Service API), the standard interface that is used to load data in the BI system.
Start from this point:
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03450525ee517be10000000a1553f6/frameset.htm
Thanks for any points you choose to assign.
Regards -
Ron Silberstein
SAP -
FCC on Sender CC to convert flat file to complex xml structure
Hi ,
i need to create a complex xml structure using FCC at the sender communication channel.
the datatype structure is as follows:
Data type Occurrence
DT_SOURCE
SEG_9 1..1
SEG_10 1..1
SEG_20 1..1
SEG_30 0..1
SEG_40 1..2
SEG_50 0..1
SEG_55(loop) 0..1
SEG_55 0..9999
SEG_60-70(loop) 1..1
SEG_60 0..1
SEG_70 0..9999
SEG_90 0..1
Please let me know how this can be acheived.
Regards,
Meenakshi
Edited by: meenakshipradhan on Apr 5, 2010 7:44 PMHi Meenakshi,
Please let us know the Hierarchy of the structure to be created, is it one level only?
Could you please explaing what is the loop meant here?
SEG_55(loop) 0..1
SEG_55 0..9999
SEG_60-70(loop) 1..1
Please specify if there are any delimiters or what is the file format at source.
Or Try reading the whole content of the file then use a XSLT to create the desired structure, i think in XSLT you can easily try out the looping.
Regards,
Srinivas. -
Why we need to conver Context Node data into XML file----Export to Excel
Hi All,
Let me clarify my dought........today i have gone through the concept of "Exporting Context Data Using the Webdynpro Binary cache" in SAP Online Help.
From the SAP Online Help pdf document, i have found that, the context node data has been converted first in to XML file,after that file had been stored in the web dynpor binary cache...bla....bla.........
Here my qtn is why they had converted context node data into XML file. With out doing that can not we export context node data to excel file..?
Regards
Seshu
Edited by: Sesshanna D on Dec 19, 2007 7:25 AMHi Sesshanna,
it is not neccessary to do that but xml has the advantage, that it can be easily transformed into every output format that might occur in later project stages.
If it's simply about blowing out some Excel, I suggest using an OSS library such as jexcelAPI or Jakarta POI and building the Excel how you need it.
regards,
Christian -
Bdc upload file data into internal table problem with gui_upload fm
Hello experts,
my coding is like this ..
data : begin of itab occurs 0 .
field1 like mara-matnr,
field2......
etc,
end of itab.
data: file1 type string.
parameter :file like rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
mask = space
field_name = 'FILE'
CHANGING
file_name = file.
START-OF-SELECTION.
FILE1 = FILE . "HERE I AM PASSING INTO STRING
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FILE1
FILETYPE = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
file structure is same as the internal table.
I stored the file as .txt( ie in notepad).
my file is like this..
10000 200 323 sunndarrr.......
i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
when i am using the ws_upload it is working fine.
please guide me where i have done the mistake.
thank you so much for all the replies.Hi,
Have a look on the following code.
TABLES: kna1.
DATA: BEGIN OF itab1 OCCURS 0,
str(255),
END OF itab1.
DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'D:\ABAP EVE\ffile1.txt'
filetype = 'ASC'
TABLES
data_tab = itab1
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE:/ 'sorry'.
ELSE.
LOOP AT itab1.
SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
APPEND itab2.
ENDLOOP.
IF sy-subrc = 0.
LOOP AT itab2.
WRITE:/ itab2-kunnr,itab2-name1.
INSERT INTO kna1 VALUES itab2.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ 'inserted'.
ELSE.
WRITE:/ 'not inserted'.
ENDIF.
ELSE.
WRITE:/ 'fail'.
ENDIF.
ENDIF.
Flat file:
10001,Sadney
10003,Yogesh
20005,Madan
1.U need to define internal table with one field of max size
2.upload the flat file data into that internal table
3.split that internal table data into another internal table(having fields)
<REMOVED BY MODERATOR>
thanks,
Chandu
Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM -
Conversion_Exit_Cunit_error occured while loading the Flat file data
Hi
Iam tryign to load Flat file data into an ODS, i am getting error like Error Conversion Cunit.
Also we are using 0unit in the ODS for which CUNIT is a conversion rule
Can you please suggest me why iam getting this errorHi Sunil
Hope you can check whether you are loadig the flat file data from application server or Client workstation.
May be if you are loading from Client work station you will face problem of this type.
Try to check if any change in format in the file.
at the end of the file delete the spaces. -
URGENT : Program to convert flat file to XML file.
Hello,
Good Morning. I want an urgent program to convert a flat file seperated by '/' to an XML file format and store that in the the application server. If any one has done such a developement, could you please send me the code.
The flat file format is as below :
72/070414/114147/11973//100-//EA/00000000///04198//RRT0/RC23///////353825001511172/72/070414/123620/11973//1000//EA/00000000///04198//RRT0/RC23///////354762008125236/72/070414/125411/13814//1000//EA/00000000///04198//INV/ID06///////90000000002697/72/070414/140820/11973//1000//EA/00000000///04198//RRT0/RC23///////353057002479718/72/070414/145438/13814//1000//EA/00000000///04198//INV/ID06///////90000000002739/72/070414/145438/11973//1000-//EA/00000000///04198//INV/ID06///////353057002479718/72/070414/150008/13814//1000
It needs to be filtered by removing the '/' and also grouped based on two fields namely store number and transaction number. The sample XML output required is as below :
<?xml version="1.0" encoding="ISO-8859-1"?>
<MT_POLL07 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../MT_POLL07.xsd">
<MessageHeader>
<File>
<Name>C:/kai/perl/storemaster_home/stores/09100/inbound/POLL07.DOS</Name>
<CreatedDate>Wed Feb 7 13:09:15 2007</CreatedDate>
<TotalRecordNo>19</TotalRecordNo>
</File>
</MessageHeader>
<Transaction>
<TransactionHeader>
<TRANSACTION>20070414001559</TRANSACTION>
<STORE_NO>09100</STORE_NO>
<BOFTTP>72</BOFTTP>
</TransactionHeader>
<Item>
<BOFTDT>070414</BOFTDT>
<BOFTTM>114147</BOFTTM>
<BOFSKU>11973</BOFSKU>
<BOFUPC></BOFUPC>
<BOFQTY>100</BOFQTY>
<BOFQTN>-</BOFQTN>
<BOFCST>0</BOFCST>
<BOFCSN>+</BOFCSN>
<BOFUM>EA</BOFUM>
<BOFHRF>00000000</BOFHRF>
<BOFSRF></BOFSRF>
<BOFVND></BOFVND>
<BOFLOC>04198</BOFLOC>
<BOFEQT></BOFEQT>
<BOFEQN>+</BOFEQN>
<BOFRTP>RRT0</BOFRTP>
<BOFREA>RC23</BOFREA>
<BOFCID></BOFCID>
<BOFAUT></BOFAUT>
<BOFCUR></BOFCUR>
<BOFPTP></BOFPTP>
<BOFUPT></BOFUPT>
<BOFUMR></BOFUMR>
<BOFSRN>353825001511172</BOFSRN>
<GMNUMBER>1</GMNUMBER>
</Item>
<Item>
<BOFTDT>070414</BOFTDT>
<BOFTTM>123620</BOFTTM>
<BOFSKU>11973</BOFSKU>
<BOFUPC></BOFUPC>
<BOFQTY>1000</BOFQTY>
<BOFQTN>+</BOFQTN>
<BOFCST>0</BOFCST>
<BOFCSN>+</BOFCSN>
<BOFUM>EA</BOFUM>
<BOFHRF>00000000</BOFHRF>
<BOFSRF></BOFSRF>
<BOFVND></BOFVND>
<BOFLOC>04198</BOFLOC>
<BOFEQT></BOFEQT>
<BOFEQN>+</BOFEQN>
<BOFRTP>RRT0</BOFRTP>
<BOFREA>RC23</BOFREA>
<BOFCID></BOFCID>
<BOFAUT></BOFAUT>
<BOFCUR></BOFCUR>
<BOFPTP></BOFPTP>
<BOFUPT></BOFUPT>
<BOFUMR></BOFUMR>
<BOFSRN>354762008125236</BOFSRN>
<GMNUMBER>2</GMNUMBER>
</Item>
</Transaction>
</MT_POLL07>
Please send me the code : It is urgent. Thanks in advace. Points to be rewarded.hi !
Check with this thread discuss the same
http://www.sap-img.com/abap/sample-xml-source-code-for-sap.htm
Flat file to XML
CONVERTION OF FLAT FILE TO XML : NO OUT PUT FOUND
Converting Idoc flat file representation to XML
how to convert flat file into IDOC-XML
Regds
Abhishek -
Loading of flat file (csv) into PSA – no data loaded
Hi BW-gurus,
We have an issue regarding loading a flat file (csv) into PSA using an infopackage u2013 (BI 7.0)
The infopackage has been used for a while. Prior the consultants with SAP_ALL-profile have run the infopackage. Now we want a few super users to run the infopackage.
We have created a role for the super users, including authorization objects:
Data Warehousing objects: S_RS_ADMWB
Activity: 03, 16, 23, 63, 66
Data Warehousing Workbench obj: INFOAREA, INFOOBJECT, INFOPACKAG, MONITOR, SOURCESYS, WORKBENCH
Data Warehousing Workbench u2013 datasource (version > BW 3.x): S_RS_DS
Activity: All
Datasource: All
Subobject for New DataSource: All
Sourcesystem: FILE
Data Warehousing Workbench u2013 infosource (flex update): S_RS_ISOUR
Activity: Display, Maintain, Request
Application Component: All
InfoSource: All
InfoSource Subobject: All values
As mentioned, the infopackage in question, has been used by consultants with SAP_ALL-profile for some time, and been working just fine. When the super users with the new role are executing the infopackage, the records are found, but not loaded into PSA. The load seems to be stuck, but no error message occurs. The file we are trying to load contains only 15 records.
Details monitor:
Overall status: Missing messages or warnings (yellow)
Requests (messages): Everything ok (green)
-> Data request arranged (green)
-> Confirmed with: OK (green)
Extraction (messages): Errors occurred (yellow)
-> Data request received (green)
-> Data selection scheduled (green)
-> 15 Records sent (0 Records received) (yellow)
-> Data selection ended (green)
Transfer (IDocs and TRFC): Missing messages (yellow)
Processing (data packet): Warnings received (yellow)
-> Data package 1 (? Records): Missing messages (yellow)
-> Inbound processing (0 records): Missing messages (yellow)
-> Update PSA (0 Records posted): Missing messages (yellow)
-> Processing end: Missing messages (yellow)
Have we forgotten something? Any assistance will be highly appreciated!
Cheers,
Anne Therese S. JohannessenHi,
Try to use the transaction ST01 to trace the authorization of the upload with the SAP_ALL.
And the enhance your Profile for the super user.
Best regards
Matthias -
Methods in bapi used to convert data into XML
Methods in bapi used to convert data into XML,
how to implement those also,
points will be rewarded
Thank you,
Regards,
Jagrut BharatKumar ShuklaHi
Check this
http://www.sap-img.com/abap/sample-xml-source-code-for-sap.htm
https://forums.sdn.sap.com/click.jspa?searchID=2889167&messageID=3406594
Reward points for useful Answers
Regards
Anji -
Converting flat file to XML using JMS
Hi,
I want to convert flat file to xml. My sender adapter is JMS,
Can anyone tell me that how to do that conversion ? Conversion is very simple.
Can we use File content conversion in JMS Sender ? any link or blog ? or any other idea to achieve this ?
Regards
KulwinderHi,
The pdf has been removed from that link i suppose.
Anyways, go through the below help, everything that is there in "HowToConveModuleJMS.pdf" has been mentioned in this...
http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm
Hope it would surely help you.
You can go through the below link, for better understanding..
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a05b2347-01e7-2910-ceac-c45577e574e0
Regards,
Swetha.
Edited by: Swetha Reddy on Feb 26, 2009 5:30 AM
Maybe you are looking for
-
Which MacBookPro is best?
I currently have a Powerbook G4 (OSX 10.4.9): Machine Name: PowerBook G4 15" Machine Model: PowerBook5,8 CPU Type: PowerPC G4 (1.5) Number Of CPUs: 1 CPU Speed: 1.67 GHz L2 Cache (per CPU): 512 KB Memory: 2 GB Bus Speed: 167 MHz And I run: Adobe CS2
-
Re: Is it possible to accessing regular Thumbdrive...
Hi All, Is it possible to access regular thumbdrive from Nokia HP just as it is acccessing a memory card? What happens when a regular USB thumbdrive is attached to a N96 using a convertor cable? Have anyone tried this before? Thanks a lot in advance.
-
Udi autosequence diadem 9.1
Hi Updating from Diadem 7 .1 to 9.1 with DAC bundle (because 7 does not work with windows xp) I was expecting that my old autosequences would still work and that I would not have to convert them to the .vbs format. However when attempting to run my
-
In Forms Builder for DS 10.1.2 after subclassing the webutil object I noticed that the webutil data block and all of its items have a red arrow on the icon beside their name. What does this red arrow mean? Thanks, michelle
-
Why would I want to visit other Cafes?
QuestionWhy would I want to visit other Cafes? AnswerVisting other player's cafes allows you to see the decorating skills of your friends! Not to mention, there's something in it for both of you! You (and the cafe owner) earn chips and XP for visiti