XML to flat file conversion using file content conversion in reciever CC

Hi,
Iam working on Idoc to File scenario.
Iam having a problem in the communication channel of reciever.
Iam using File content conversion in Reciever Adapter.
My xml format is asfollows:--
- <Header>
  <FILLER1>KTP</FILLER1>
  <YEAR_IDOC>YEAR 2006</YEAR_IDOC>
  <FILLER2>FIRSTWEEKNUMBER</FILLER2>
  <WEEK_IDOC>51</WEEK_IDOC>
  <FILLER3>NUMBER WEEKS 26</FILLER3>
  <PLANT_CODE>FACTORYM019</PLANT_CODE>
  </Header>
- <Record>
  <First_material>731000</First_material>
  <First_quantity>0000.0</First_quantity>
  <First_quantity>0001.9</First_quantity>
  <First_quantity>0000.0</First_quantity>
  <First_quantity>0000.0</First_quantity>
  <First_quantity>0020.0</First_quantity>
  <First_quantity>0000.0</First_quantity>
  <First_quantity>0000.0</First_quantity>
  <First_quantity>0000.0</First_quantity>
  <First_quantity>0018.0</First_quantity>
  <First_quantity>0000.0</First_quantity>
  <Second_material />
  <Seond_quantity>000000</Seond_quantity>
  <Second_quantity>0011.0</Second_quantity>
  <Seond_quantity>000000</Seond_quantity>
  <Seond_quantity>000000</Seond_quantity>
  <Seond_quantity>000000</Seond_quantity>
  <Seond_quantity>000000</Seond_quantity>
  <Second_quantity>0049.0</Second_quantity>
  <Seond_quantity>000000</Seond_quantity>
  <Seond_quantity>000000</Seond_quantity>
  <Second_quantity>0067.0</Second_quantity>
  <Third_material />
  <Third_quantity>000000</Third_quantity>
  <Third_quantity>000000</Third_quantity>
  <Third_quantity>000000</Third_quantity>
  <Third_quantity>0008.0</Third_quantity>
  <Third_quantity>000000</Third_quantity>
  <Third_quantity>000000</Third_quantity>
  </Record>
The file format should be as follows:--
KTP   YEAR 2006 FIRSTWEEKNUMBER 51   NUMBER WEEKS 26  FACTORYM019
731000  0000.0 0001.9 0000.0 0000.0 0020.0 0000.0 0000.0 0000.0 0018.0 0000.0
        0000.0 0011.0 0000.0 0000.0 0000.0 0000.0 0049.0 0000.0 0000.0 0067.0
        0000.0 0000.0 0000.0 0008.0 0000.0 0000.0  
Could some one help me in resolving this issue.
Regards
Praveen

Hi Praven,
couldn't you simply modify your target DATA type so it will be easier to handle?
For example something like:
<Header>
</Header>
<Record>
<Material>
<Number>..</Number>
<quantity>..</quantity>
<quantity>..</quantity>
</Material>
In this way file content conversion will be easier (easy)!
Regards,
Sergio

Similar Messages

  • I need this file "How to Use the Content Conversion Module in JMS Adapter"

    Can someone send me this file:
    "How to Use the Content Conversion Module in JMS Adapter"
    I am not able to find it.
    Thanks
    Antonello

    pls refer guide
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-adapters/how%20to%20use%20the%20content%20conversion%20module%20with%20xi%203.0%20j2ee%20jms%20adapter.pdf
    Regards,
    Swetha.

  • File-Sender: Probl. with Content conversion - Read whole line in singleTag

    Hello,
    I have a flat file that i read with the sender file adapter.
    After content conversion I get not the result i wished to have...
    The source flat file looks for example like this:
    ABC;DEF;GHIJ
    KLM;NOP;Q
    RSTU;VW
    After the Content Conversion I would like to have this result:
    <Recordset>
         <Data>
              <Row>ABC;DEF;GHIJ
               <Row>KLM;NOP;Q
              <Row>RSTU;VW
              <……>
    What sounds very similar but didn’t work for me yesterday….
    I defined a data type that looked like this:
    DT_TEST (Complex Type)
         Recordset (0..unbounded)
              Data (1)
                   Row (type string / 0..unbounded)
    During the file content conversion I just did this:
    Recordsetname: Recordset
    Recordset structure: Data, 1
    Data.fieldNames = Row
    Data.fieldSeparator = ‘nl’
    This was also described in blog:
    /people/sravya.talanki2/blog/2005/08/16/configuring-generic-sender-file-cc-adapter
    But my result is always like this:
    <Recordset>
         <Data>
              <Row>ABC;DEF;GHIJ
         </Data>
    </Recordset>
    <Recordset>
         <Data>
              <Row> KLM;NOP;Q
         </Data>
    </Recordset>
    <Recordset>
         <Data>
              <Row> RSTU;VW
         </Data>
    </Recordset>
    ….And not like I wished….
    Can anybody help me…?
    Greetings
    Tobias

    Hi,
    I just gone thru the blog and as per the structure defined I have no idea how this works this way.
    But if you modify the structure to
    RecordSet - occurs 0-1
    Data - occurs 0-n
    Row - occurs 0-1
    And in the Content conversion mentions Data,* instead of Data,1.
    In this case you will be getting a output like
    <Data>
      <Row>ddf,sdfsd,sdf</Row>
    </Data>
    <Data>
      <Row>fff,sdfsd,sdf</Row>
    </Data>
    You can achieve this but I don't have any idea how to generate that kind of output with the Structure and the conversion parameter mentioned in the blog.
    Thanks,
    Prakash

  • Problem with reciver file adapter in the content conversion.

    I have starnge situation where the fileds in the file created after the content conversion are center aligned.
    Can someone let me know how to make it right aligned?
    For eg, i have a field with Char(6) in the file it looks as follows:
    1.23 ->    | 1.23 |
    10.23 ->  |10.23 |
    100.23-> |100.23|
    I want it to be like this :
    1.23 ->    |  1.23|
    10.23 ->  | 10.23|
    100.23-> |100.23|
    Please let me know ASAP as its a critical issue for the customer.
    Warm Regards,
    Nilesh Kumar

    Hi Nilesh,
    if You are using file content conversion on Sender Adapter, then do you java mapping between your two interfaces(sender and receiver)
    use java.text methods for formatting the values according to your requirement.
    first check the java API 1.4.2....
    with in that check java.text.* methods
    Also there will be lot of examples availble on internet on this. Check online.
    Also check this link this will definitely solve issue
    [http://www.iro.umontreal.ca/~vaucher/Java/tutorials/Formatting.html]
    Sample code on this link
       double x = 1.0 / 7;
       for (int n = 1; n<5; n++)
          System.out.println( "1/7 : "  + format( x, n, -6)
                                        + format( x, n, 10));
    Thanks
    Gujjeti
    Edited by: Praveen Gujjeti on Apr 16, 2008 6:16 AM

  • Upload file without using file upload UI Element

    Hi all.
    I need upload a .txt file without using file upload UI Element because filename is not insert by user. The filename is generated by program. I try to use 'GUI_UPLOAD' and 'WS_UPLOAD' but don't work.
    Many thanks in advance.

    As you correctly pointed out we cannot use the gui_upload and gui_download fm's in webdynpro because they require sap gui and WD Components generally run in a HTML or Portal environment.
    The only option available is File Upload Element

  • How to read MS-Excel file by using file Adapter

    hi friends,
    I have an issue on read Operation by using file Adapter.
    It is necessary to read excel file by using file adapter. But in the native format of file adapter there is no option to read excel type of files.
    So friends, please help me how to solve this problem?
    Thanks in Advance..

    See also this post:
    Read Excel File Using FileAdapter in SOA 11g
    It might help you

  • Hoe to logical file name using "FILE" transcation

    I want to create a logical file name using  "FILE" transaction , i have file path '/xfer/OUT/IDD0230 ' that cureently hard coded in program but i want to avoid hard code .

    You need to go to FILE transction, create new entry.
    You need to specify Physical name i.e value hardcoded in your program
    and corresponding new Logical Path which enduser will be entering.
    In code u ned to decode Logical path to physical path as its actual path.
    Award points if helpful.
    Shital

  • Query regarding file content conversion using file adapter

    Hi All
    I have a question regarding file content conversion in file adapter.
    I have a file coming in the following format.
    AA,111,222,333
    BB,444,555,666
    CC,777,888,999
    My incoming message structure has a hierarchy. The CC record is a structure part of BB record. BB record is a structure part of AA record. It is like this:
    AA,111,222,333
    <<BB,444,555,666>>
    <<<<CC,777,888,999>>>>
    After file content conversion, in the resulted xml, i am getting a flat hierarchy instead of nested hierarchy.
    Is it possible to get a nested hierarchy as a result of file content conversion?
    Please let me know
    Thanks
    Chandra

    Hi Udo
    According to your suggestion, I am trying to use mapping.
    I am getting a flat file and i am reading it.
    This is my source structure:
    AA,11,22,33
    BB,44,55,66
    CC,77,88,99
    This is my required targer structure:
    AA,11,22,33
    <<BB,44,55,66>>
    <<<<CC,77,88,99>>>>
    To explain this, BB record can have multiple records of CC records.
    AA records can have multiple records of BB record.
    I am using removecontext node function.
    CC (Source)  (removecontext)-> CC (target structure)
    But here, when i rightclick on source CC field in the mapping editor, i cannot see any other context except root node. So, how can i proceed here??
    Many Thanks
    Chandra

  • Error in Receiver File adapter using File content Conversion

    Hi,
    I am getting the following error in the receiver file adapter.
    Conversion initialization failed: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: Parameter 'statement.fieldFixedLengths' or 'statement.fieldSeparator' is missing
    I am using the below parameters for FCC:
    Recordset Structure - statement
    statement.endSeparator - 'nl'
    statement.fieldSeparator - '0X09'
    statement.fieldNames -xblnr,wrbtr,newbs,kostl,newko,prctr,xref1,rke_wwfud,rke_wwst3,blart,bukrs,bldate,budat,gjahr,monat,ctype,waers,bktxt,posnr,wbs_element,mwxkz,businessplace,businessplace,c_waers,c_wrbtr,g_ctype,g_waers,g_wrbtr,h_ctype,h_waers,h_wrbtr,trade_id,lob,sgtxt,zuonr,reason_rev,ldgrp,tcode,lifnr
    ignoreRecordsetName - true
    Please let me know where i am going wrong.
    Thanks,
    Aparna

    Hi Aparna,
    I feel the problem in your content conversion parameters is with
    statement.fieldNames and ignoreRecordsetName
    When you are confirguring receiver file adapter for file content conversion the above one is not required. Please refer below link for details on configuring content conversion in file adapter
    [http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm]
    Hope this helps !!
    Regards,
    Amit

  • Reading XML file to use its content

    Hi, I'm trying to read from a XML file that contents the following:
    <conf>
    <address>some address</address>
    <body>some body message</body>
    </conf>
    I'm using the following code to try to read it:
    import java.io.*;
    import javax.xml.parsers.*;
    public class XMLReader {
    public static void main(String[] args) throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    try {
    DocumentBuilder parser = factory.newDocumentBuilder();
    Document documento = parser.parse(new File("C:/salida.xml"));
    Element elemento = documento.getDocumentElement();
    System.out.println(elemento.toString());
    catch (Exception elemento) {
    elemento.printStackTrace();
    I though it was good, but it gives me compilation error, it says it 'cannot resolve symbol' on "DocumentBuilder parser = factory.newDocumentBuilder();", I already added the following libraries: jaxp-api.jar, sax.jar, dom.jar, xalan.jar, xercesImpl.jar, xsltc.jar (all from JAXP API). So, I don't know what else do I need to make it work, what is it?, thanks in advance.

    try this:
    File f = new File("....");
    FileInputString fis = new FileInputStream(f);
    DOMParser parser = new DOMParser();
    InputSource iSource = new InputSource(fis);
    parser.parse(iSource);
    Document doc = parser.getDocument();

  • File sender adapter and content conversion with polish character

    We are loading a csv file with PI 7.0 file sender adapter using "content conversion" - all fields go through EXCEPT a special character hex '208C' (space in front) looks like "Æ" is converted to hex 'C28C'.
    We are using code page UTF8
    We are using:
    enclosuresign "
    enclosuresignescape ""
    fieldcontentformatting nothing
    enclosureconversion NO
    Hope some one can help

    Hi Bohamo,
    Hope you have set the following for your file sender adapter :
    1. Transfer Mode is set to Binary,
    2. File Type Text,
    3. Encoding ISO-8859-1( for Western European Latin ).
    Inorder to recognize Polish Character, try as follows :
    Your sender file after coming into Pi has XML encoding declaration 'UTF-8'.
    Write a simple XSLT mapping to change the value of the attribute "encoding" to "ISO-8859-1" in the output XML of message mapping . Include this XSLT map as the second mapping step in your interface mapping.
    First step in your interface mapping will be your already existing message mapping.
    An example of the XSL code :
    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method='xml' encoding='ISO-8859-1' />
    <xsl:template match="/">
    <xsl:copy-of select="*" />
    </xsl:template>
    </xsl:stylesheet>
    or you can also do java mapping if you are comfortable with java code !
    Cheers,
    Ram.

  • File to IDOC with content conversion

    Hi
    I am trying to do a file content conversion scenario. This is a fixed length file which needs to be converted to idoc.
    I have configured IR and ID (FCC parameters added). While testing the end-end scenario we are able to see that sender adapter has successfully read the message , but we are not able to see any message in SXMB_MONI.
    Please help

    Following is the file structure
    "RecordType HeaderField2 HeaderField3"
    "RecordType LineItem2 LineItem3"
    "RecordType TrailerField2 TrailerField3"
    Following are content conversion Parameters [KeyFieldName -> RecordType]
    HeaderRow.beginSeparator -> '"'
    HeaderRow.fieldFixedLengths -> 10,20,10 (for ex)
    HeaderRow.fieldNames -> RecordType,HeaderField2,HeaderField3
    HeaderRow.keyFieldValue -> 01 (COnstant)
    HeaderRow1.endSeparator -> '"'
    Similar for line item and trailer
    Is there any way to check our input file against the content conversion parameters to make sure that they are correct
    Thanks

  • File formatting using File adapter

    Hi we are using a sender / receiver file adapter to recive file from source and post file to the target location
    This is the expected format in the target system
    <?xml version="1.0" encoding="utf-8"?>
    <YYY_TIME_XML>
    <YYY_TIME_DATA>
    <CLIENTID>1</CLIENTID><EMPLID>7454</EMPLID><EMPL_RCD>1</EMPL_RCD><SEQNO>2</SEQNO><COMPANY>765</COMPANY><BUSINESS_UNIT/><DEPTID/><LOCATION/><JOBCODE/><PAYGROUP>XI1</PAYGROUP><OFF_CYCLE>Y</OFF_CYCLE><PU_TXN_TYPE>R</PU_TXN_TYPE><MANUAL_CHECK>S</MANUAL_CHECK><ERNCD>KEG</ERNCD><DATEWORKED>19970303</DATEWORKED><EARNS_BEGIN_DT>20050624</EARNS_BEGIN_DT><EARNS_END_DT>20040630</EARNS_END_DT><OTH_HRS>5</OTH_HRS><ADDL_PAY_SHIFT/><ADDL_SEQ>0</ADDL_SEQ><COMPRATE>10</COMPRATE><DISABLE_DIR_DEP>R</DISABLE_DIR_DEP><AMT>80</AMT><CREATION_DT>20070401101234</CREATION_DT><BATCH_ID>200777251</BATCH_ID><STATE> </STATE><LOCALITY> </LOCALITY><GB_GROUP_ID> </GB_GROUP_ID>
    </YYY_TIME_DATA>
    <YYY_TIME_DATA>
    <CLIENTID>1</CLIENTID><EMPLID>127454</EMPLID><EMPL_RCD>3</EMPL_RCD><SEQNO>5</SEQNO><COMPANY>149</COMPANY><BUSINESS_UNIT/><DEPTID/><LOCATION/><JOBCODE/><PAYGROUP>SW1</PAYGROUP><OFF_CYCLE>T</OFF_CYCLE><PU_TXN_TYPE>Q</PU_TXN_TYPE><MANUAL_CHECK>S</MANUAL_CHECK><ERNCD>BEG</ERNCD><DATEWORKED>20050707</DATEWORKED><EARNS_BEGIN_DT>20050624</EARNS_BEGIN_DT><EARNS_END_DT>20040630</EARNS_END_DT><OTH_HRS>52</OTH_HRS><ADDL_PAY_SHIFT/><ADDL_SEQ>0</ADDL_SEQ><COMPRATE>8</COMPRATE><DISABLE_DIR_DEP>Q</DISABLE_DIR_DEP><AMT>90</AMT><CREATION_DT>20070401106784</CREATION_DT><BATCH_ID>200788851</BATCH_ID><STATE> </STATE><LOCALITY> </LOCALITY><GB_GROUP_ID> </GB_GROUP_ID>
    </YYY_TIME_DATA>
    But we are getting the data in a line string format.
    <YYY_TIME_XML><YYY_TIME_DATA><CLIENTID>1</CLIENTID>......................
    Any ideas on how to fix this.
    Thanks,

    Hi Nandini !
    As far as I understand, the "CRLF" characters (Hexa 0D and 0A for carriage return and line need) are not needed for the XML parser to understand the target file structure as a unique line...maybe your target system is parsing manually the file reading it line by line instead of using an XML parser.
    If you try to open your received xml file in Internet Explorer? are you seeing it correct?
    An XML file with all info in one line is still a valid XML file.
    Regards,
    Matias.

  • Custom File name using File Adapter

    Hello All,
    Is it possible to name the file based on a particular XML tag? may be use an xpath expression? My requirement is to create a file name something like PO_<PO-NUM>.xml rather than using any sequence or time stamp.
    Thanks.

    Should i change anything in the file adapter's .jca file? possibly this property?
    <property name="FileNamingConvention" value="PO%SEQ%.xml"/>

  • How to get full path of a file uploaded using file control on a jsp ?

    Hi all...
    I have a jsp on which i am using a file element (input type="file") to upload files present on the physical file system.. Thats working fine.. But i want to retrieve the full path of the file uploaded for further computation.
    What are the possible ways which can give me the full path ?? (e.g. "D:\data\text\Output.txt" )
    Thanks all for attending the question..
    Regards
    Prasad

    Some browsers send the full path. Some do not.
    You can not affect this in any way shape or form.
    All you can count on receiving is a filename - no path information.
    So you will have to have some other way for the user to pass along this information.
    If they are uploading to a "remote web site" they could specify a folder to put the uploaded file in.
    You could classify it and put all image files in "images" and all script files in "scripts" etc etc by default, and let the user deal with it in their own HTML.
    Hope this helps,
    evnafets

Maybe you are looking for