Idoc to flat file conversion: problem with mapping

Dear experts,
I have the following scenario: SAP (idoc) -> XI -> 3rd party
The idoc has s structure like this:
. ZSCX001 (idoc name)
... IDOC
..... ORDERHEADER
....... ORDERLINE
......... DELIVERY LINE
......... DELIVERY LINE
..... ORDERHEADER
....... ORDERLINE
......... DELIVERY LINE
......... DELIVERY LINE
etc
The flat file has this structure:
. FILENAME
... RECORD
..... FIELD1
..... FIELD2
... RECORD
..... FIELD1
..... FIELD2
etc
Now, per IDOC I need to create 1 file. For each delivery-line in the IDOC I need to create 1 record in the outputfile (flat file).
In message mappings, I did the following:
- messages-tab: Occurrence of the Idoc and inbound message type for flatfile: both 1
- design-tab: I linked IDOC to the FILENAME (so for each Idoc I create 1 flat file)
- design-tab: I linked the tag "Delivery line" to "RECORD" (I expected 1 record per delivery line)
When I test it, I only get 1 resulting record in the flat file, even if I test with 3 ORDERHEADER->ORDERLINE->DELIVERY LINE segments.
Can anybody tell me what I am doing wrong?
Thanks in advance,
William

Hi,
First make sure occurence of Record is 0..unbounded.
Second use the blow mapping rule..
Delivery line --->RemoveContext ---> RECORD
Regards,
Sarvesh

Similar Messages

  • IDOC to Flat FIle Examples

    Hi,
    Can Anyone provide an Example for IDOC to Flat File Conversion using Java Mapping.. Thanks in Advance.

    Hi Sudeep,
    See the IDOC to File Scenario
    https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e07dcaa0-a92b-2a10-3a96-b3d942bd1539
    Modify the receiver with FCC by using below links...
    File content conversion links...
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    /people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    Please see the below links for file content conversion..
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter - FCC
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter - FCC
    Thanks,
    Sriram
    Edited by: Sri Ram Devarapalli on Sep 1, 2009 1:25 PM

  • Problems with mapping after bundling messages into one XML-file

    Hi all,
    Case 1: one DebMas IDoc ==> XI ==> one XML-file : no problems with mapping.
    Case 2: several DebMas IDoc's ==> XI ==> one XML-file : problems with mapping.
    Explanation:
    Incoming DebMas IDoc's:
    Businesspartner 1 : no Customer Master Partner Functions (E1KNVPM).
    Businesspartner 2 : Customer Master Partner Functions (E1KNVPM).
    Businesspartner 3 : Customer Master Partner Functions (E1KNVPM).
    Businesspartner 4 : Customer Master Partner Functions (E1KNVPM).
    After bundling into one XML-file:
    Businesspartner 1 : no Customer Master Partner Functions (E1KNVPM).
    Businesspartner 2 : no Customer Master Partner Functions (E1KNVPM) !!!!
    Businesspartner 3 : Customer Master Partner Functions of Bp 2 (E1KNVPM) !!!!.
    Businesspartner 4 : Customer Master Partner Functions of Bp 3 (E1KNVPM) !!!!.
    All the payloads of the IDoc's are correct.
    In the message mapping we use a Container for the Partner Functions (shown as below)
    Is this a serious bug in the mapping of SAP XI ?
    Does anyone knows how to solve this serious problem.
    E1KNVVM -
    > Partner_Container
    E1KNVPM -
    > Partner
       PARVW -
    > ParnerRole
       KUNN2   -
    > PartnerNumber
    Regards,
    Theo Pijlman

    Hi,
    Example:
    Input idoc has field F1 with occurence 0..unbnd
    My input values for field F1 is
    1
    none
    2
    3
    Say, I have a mapping, F1---->TargetF1
    In the target only 3 TargetF1s will be created for the values 1,2,3 and nothing will be created for the field F1 with no value.
    To overcome this, use collapse contexts.
    F1->collapsecontexts>TargetF1
    This way, the TargetF1 fields created will have the following values:
    1
    blank
    2
    3
    Collapse contexts makes sure that a target is created, even if there is a context change specified at the source.
    Hope this is clear.
    Regards,
    Smitha.

  • Doubts in SAP(Idoc)-XI-Flat file scenario

    Dear All,
    I am sending Delivery Idoc from R/3 and I am able to view the Idoc in XI in transaction IDX5. Also i m able to see the XML structure with the data of the idoc in SXMB_MONI.
    Now as per my scenario I have to download this to a flat file from XI.
    My question is, should I have to do the creation of Data types, message types, mapping interface & interface mapping in IR or should I directly do the designing in the ID.
    waiting for your reply.
    Warm regards,
    N.Jain

    Hi,
    DT, MT, MI  : you will create these things for receiver flat file only.
    First create
    In Integration Repository :
    1.     Import structure of IDOC in your scenario, In imported objects  IDOCs
                  a.     In Interface Objects
    1.     Create Data type for your flat file
    2.     Create Message Type
    3.     Create Message Interface (inbound Asy.)
                  b.     In Mapping Objects
    1.     Message Mapping :  IDOC  to  Message Type of Flat File.
    2.     Create Interface Mapping  : IDOC to Flat file by using Message Mapping which you have created.
    Make activate all these things.
    In Integration Directory :
    1.     Create Communication channel for File Receiver.
    2.     Sender Communication channel is not required.
    3.     Create Receiver Agreement.
    4.     Sender Agreement is not required.
    5.     Interface Determination
    6.     Receiver Determination
    At sender side you will take your IDoc and at receiver side you will take your flat file.
    It can help you,
    Regards,
    Sandeep Kaushik

  • IDOC to flat File----Problem in File Content Conversion at receiver

    hi experts,
    I am doing a IDOC to flat file secnario.
    My requirment is IDOCXI-Flat file
    Format of flat file is like:--
    Every segment in the IDOC will be converted into a single line of file(without any delimiter). So number of lines in flat file will be equal to number of segments in IDOC.
    I am facing problem in File Content conversion. 
    Please help me out..
    Thanks
    Jaideep

    Check this doc...
    [How To...Convert an IDoc-XML structure to a flat file and vice versa in XI 3.0 |https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a]

  • Reoccurring Nodes with IDOC to Flat File

    Hi there
    I am trying to create a comma seperated file from idoc to flat file with FCC.
    My structure looks like this:
    StructureNode - (1TO1)
    --SubNode1     - (1TO1)
    Element1
    --Subnode2     - (1ToMany)
    ElementA
    ElementB
    ElementC
    ElementD
    My FCC is as follows:
    Recordset Structure = StructureNode
    StructureNode.fieldNames = SubNode1, SubNode2
    StructureNode.fieldSeparator = ,
    SubNode1.fieldSeparator = ,
    SubNode2.fieldSeparator = ,
    My problem is the flafile only has the ElementA for each occurence.
    Ex. if my sample source file looks like this:
    <StructureNode>
    <SubNode1>
    <Element1>Test</Element1>
    </SubNode1>
    <Subnode2>
    <ElementA>A001
    <ElementB>B002
    <ElementC>C003
    <ElementD>D004
    </Subnode2>
    <Subnode2>
    <ElementA>A005
    <ElementB>B006
    <ElementC>C007
    <ElementD>D008
    </Subnode2>
    <Subnode2>
    <ElementA>A009
    <ElementB>B010
    <ElementC>C011
    <ElementD>D012
    </Subnode2>
    </StructureNode>
    My output will look like this:
    Test,A001,A005,A009
    Its missing B, C and D?
    Does anyone know how to fix this?
    Regards,
    Jan

    Your content conversion should look like
    Recordset Structure = SubNode1,Subnode2
    SubNode1.fieldSeparator = ,
    SubNode2.fieldSeparator = ,
    As this is receiver content conversion, no need to mention fieldNames.
    Also deault endSeparator is newline. If it is anything else, mention it explicitly

  • IDoc to Flat file scenario - abap mapping

    Hi All,
    I have to do some IDOC to Flat file scenarios. In Order to generate the file in required format I will have to add all segments(Nodes) of Idoc in FCC receiver. We also have other option of doing it through ABAP Mapping which I found in one blog.
    Now my question is : Is it better way of doing it through FCC or ABAP Mapping?
    Ofcourse from development point of view ABAP Mapping looks easier as FCC is very time consuming task.
    Is there and performance issues in either of the approach?
    Thanks and Regards,
    Atul

    Hi VJ and Harald,
    Thanks for your replies.
    I am not having PI7.1 however the given blog was very informative.
    I will try using file port approach as suggested.
    Thanks and Regards,
    Atul

  • Idoc to flat file mapping using XSLT

    Hi,
    i am using XSLT mapping. my requirement is mapping between idoc and flat file(xml to text). as i do not want to use FCC, i have opted for xslt mapping. please let me know any article which would be helpful for this.
    regards,
    Meenakshi

    Hi Meenakshi,
    Two things:
    1. Achieving this functionality  using XSLT is very difficult.
    2. Secondly you may not be able to find a direct document to convert IDoc-XML to flat file using XSLT in sdn. Try google.
    I found one link like that may be you can get some idea from there
    http://www.stylusstudio.com/SSDN/default.asp?action=9&read=6453&fid=48
    Also if you have a XSLT editor like XMLSPY or stylus studio then creating your specific XSLT will b much more simpler
    Regards
    Suraj

  • Conversion of multiple xml idocs to flat file

    Hi,
    I did ABAP mapping to convert xml idoc to flat file by using the reference how to do abap mapping in xi3.0.pdf
    It is working for only one idoc at a time.
    If I have multiple idocs in a single xml file, the above code is not working.
    Please let me know what cchange to be done to work out for this.
    Hope am clear.
    Regards,
    Anil.

    Look For the Occurances of target Field node...It should be 1 to unbounded

  • IDOC to flat file without XML conversion

    Hi,
    I want to implement a scenario like this:
    IDOC --> XI --> flat file
    The flat file has to have the IDOC structure as you have when you write an IDOC to the R/3 file port. But we want to have this process running through XI.
    When you use the IDOC Adapter the IDOC is converted to XML first, which is time consuming. So this I want to skip this step.
    So is it possible to receive the IDOC directly in XI without converting it to XML? How should this process be designed.
    Ron

    Ron
    Looks like you need IDOC tunneling. It is possible by making a configuration parameter.
    You can find more information in http://help.sap.com/saphelp_nw04/helpdata/en/ab/bdb13b00ae793be10000000a11402f/content.htm
    While you try it, I will try to simulate this requirement in our system and let you know the result.
    KK

  • IDOC to flat file and vice versa

    Dear community,
    we should send IDOCs to flat files and read plain files and map them to IDOCs.
    Is there any comfortable way to do this without doing a huge content conversion for
    IDOCs? Exist a SAP standard for such process?
    We receive the IDOC as normal IDOC. Would it be more easy to save the IDOCs
    directly as flat file on ERP file system??
    System PI 7.11
    IDOCS: WHSCON, WHSORD and WMMBXY
    Regards
    Chris
    Edited by: Christian Riekenberg on Feb 1, 2012 2:41 PM

    Hey folks!
    We have a PI 7.31 SPS5 Java-only installation here and are using the module IDOCFlatToXmlConvertor. For single IDocs with one line for the EDC_DC40 header and the others for the IDoc payload the conversion works. But when we want to process multiple IDocs from the same type within one file, we see this error in the log:
    Module Exception 'com.sap.aii.af.idoc.exception.IDOCModuleException: No data segments for DOCNUM = ' found, cause: <null>
    Are there any requirements how the multiple IDocs have to be structured within the file?
    Best regards
    Heinrich
    Update:
    I found out that the module wants each record to contain the corresponding DOCNUM to find the matching records. The non-SAP sender system normally does not set this value. Is there a way to "convince" the module to convert the IDocs nevertheless?

  • How to convert IDOC to flat file in XI

    Hello SDNers
    I have a scenario IDOC --> XI  --> Flat file. My question is how to conver IDOC to flat file. At least there are two ways to do that:
    1) Define a flat structure in PI that reflects the IDOC structure, then using content conversion to convert the flat structure to flat file in hte receiver communication channel.
    2) There is a [document |https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a] talking about using a generic ABAP mapping to map any IDOC to flat file.
    For the option 1, I don't want that way, because I would need to define a flat structure in PI for each IDOC which is too much effort. (I would have dozens of IDOC scenarios)
    The second one is very attractive. However the document is not complete to follow. Basically it does not explain how the inbound flat structure looks like. I guess the generic ABAP mapping is used to map any IDOC_XML structure to a flat structure, then in the file receiver communication channel to convert the flat structure to flat file format. But the document does not mention how the flat structure looks like. Has somebody tried this scenario? If yes, can you please let me know the steps to do in ESR (IR) and ID? Basically what structure the IDOC_XML should be mapped to using the generic ABAP mapping class?
    Or somebody has other ideas on how to convert IDOC to flat file?
    Thank you so much
    Eric

    > 1) You are saying that for Java mapping and abap mapping, the target data type (messag type) is just a dummy one, the real (XML) message the receiver will recieve is the one (stream) produced by the java or abap mapping. Is that correct?
    Definitely yes!
    >
    > 2) For the abap mapping option, I would define a dummy target data type. Do I need to do any content conversion in the receiver adapter (communication channel)?
    None wat so ever.The output of your Java Mapping will be the Native Idoc Format.
    >
    > 3) I tried with a dummy target data type as mentioned in my second post, can you see any clue in the error message what is wrong?
    Dats one thing I cant help much. Just make sure that the ABAP report is valid and take the help of a ABAP'er to debug what is going wrong. Not much of a ABAP guy, can read ABAP code, but cant write one myself
    Try to test the program standalone to see how it works. Maybe take some Idoc XML file as input and then dump the output to a .txt file and so on.
    Regards
    Bhavesh
    PS : All this is from what I have read of this guide. I have not convert Idoc XML to Native Idoc but have used this guide to convert Native Idoc to Idoc XML .

  • Idoc to flat file using Integration process does not show up at all

    Hello All,
    I created a scenario IDOC to Flat File using Integration Process and one without IntegrationProcess. I am able to execute the one without Integration Process easily.
    However when I send the IDOC from SAP then the Integration Process scenario just does not work.
    I Checked SXMB_MONI  There is no entry for the Integration Process.I can see entry for other without Integration Process.
    SXI_CACHE : I can see my Integration Process active
    SWEQADM :  I have activated the Event Queue and Background job
    SWF_XI_ADM_BPE :  ALL BPE is showing green status.
    All syntax check on IP are fine.
    There is no Basis Help for me so  there could be some additional basis steps which need to be configured.  Has anyone faced such an issue with Integration Process?
    Regards
    Prashanta

    Hope this might help you. when u configure an IDoc as Sender with BPM this is how you proceed.
    <b>1<b>. let us split the scenario into two</b>.</b>
    a. <b>Sender to BPM</b> ( Integration Process).
    b. <b>BPM to Receiver</b>.
    <b>2. First let us configure the first Sender to BPM.</b>
    a. Sender Agreement( <b>Not required</b> ).
    b. Receiver Agreement( <b>NOT Required</b>).
    c. Receiver Determination( Sender Service, Outbound Interface, Receiver Service(<b>Integration Process</b>).
    d. Interface Determination( Inbound Interface(Sender Abstract Interface), Message Mapping(NOT Required if your using transformation stepin Integration Process)).
    <b>3. Now let us configure the Second BPM to Receiver.</b>
    a. Sender Agreement( <b>NOT Required</b>)
    b. Receiver Agreement( Sender Service(<b>Integration process</b>), Receiver Abstarct Interface,Receiver service, Inbound Interface).
    c. Receiver Determination( Sender Service(Integration Process), Receiver Abstarct Interface,Receiver Service).
    d. Interface Determination( Inbound Interface, Message Mapping(<b>NOT Required</b>)).
    So Finally we have <b>One Receiver Agreement</b>, <b>Two Receiver Determinations</b>, <b>Two Interface Determinations</b>.
    Please let me know if you have any more queries.
    Regards
    Gopi

  • Flat-File Loading problem

    Hi Friends,
    I am struggling with flat-file loading problem. I am trying to load a .csv file into data target. I took all pre-cautions while loading data. I look into preview and simulate the data. Everything is ok, but when i schedule the data, i found 0 records in the monitor. The following is the STATUS message of the above problem:
       No data available
    Diagnosis
    The data request was a full update.
    In this case, the corresponding table in the source system does not
    contain any data.
    System response
    Info IDoc received with status 8.
    Procedure
    Check the data basis in the source system.
             Can anybody help me what is the problem and procdure to resolve it?
    Regards,
    Mahesh

    Hi Eugene,
    Thanks for the quick reply. The following screen-shot tells you the messages of detail tab;
    OVER ALL STATUS MISSING WITH MESSAGES OR WARNINGS
    REQUEST: MISSING MESSAGES
    EXTRACTION
    EVERYTHING IS OK
    DATA REQUEST RECEIVED
    NO DATA AVAILABLE DATA ELECTION ENDED.
    PROCESSING
    NO DATA
               The above message was shown in details tab. Pls guide me to locate the problem.
    Regards,
    Mahesh

  • Data Extraction  or IDOC to flat file

    hi,
    I have a project to create a flat file from SAP, for an external legacy system. There are 3 requirement.
    What approach should I take. Simple data extraction OR Idoc to flat file.
    There are 4 requirements:
    1. first time extract all data.
    2. on subsequent run, extract only changed & new records
    3. if in SAP table, a record is deleted, then marked deleted in flat file.
    What approach should I take if I use data extraction.
    Thanks.

    I read your question, my first thought would be to look at where the data is going?
    What are the data requirements of the legacy system. IDOCs can speed up the development related to pushing the data out from SAP. Using ALE and change pointers you can automatically pass out the delta with a limited amount of development.
    However, the receiving system then needs to parse the IDOC data. depending on the IDOC you are working with this can be a challenge especially if the legacy developer doesn't get IDOCs.
    Sometimes its easier to collect and write the data from SAP using "simple data extraction". The data is more readily organized into a format the receiving system is expecting.
    You can also pass the idoc to a middleware maping application if one is available and do the SAP to legacy mapping there.
    Cheers

Maybe you are looking for