Generating target nodes dynamically in message mapping

Hi XI GURUS
I am trying to generate target node using using more then source node. Is it possible to do this.
I need this as in source I have 2 different nodes (0 to unbounded) and in target I want to create corresponding number of target nodes. For e.g if I have 2 + 1 nodes in source then I want to create 3 nodes in target
Source as below
<FIRSTNAME>
     <Raj>
     <Kum>
</FIRSTNAME>
<FIRSTNAME>
     <Naveen>
     <Kumar>
</FIRSTNAME>
<CITY>
<bANGALORE>
</CITY>
Desired output in target as below
<ADDRESS>
<qwerty1>
<ADDRESS>
<ADDRESS>
<qwerty2>
<ADDRESS>
<ADDRESS>
<qwerty2>
<ADDRESS>
Can i follow an alternative approach (using java function) of counting the total number of occurences of  source nodes and generating as many number of the target node
Thanx

If you have a condition check for each of the source node to be mapped to the target node,
use "create if" standard function and pass the boolean result of your Condition check as an input to this standard function. For each "true" a value would be added to the output queue. If you have a simple condition check on some source field value for each correspoding node, use "if without else" or depending on the complexity of the condition you may use a udf to get the boolean outcome.
And for mapping from more than on type of source node, you may duplicate subtree for target node.
Regards,
Suddha

Similar Messages

  • Creating new nodes dynamically in message mapping

    Gurus,
    Source Structure is
    <Phone></Phone>
    <Phone></Phone>
    And I want to create target structure as for this Node1
    <Phones>
    <Phone1>Has value from first Phone Node in source</Phone1>
    <Phone2>Has value from second Phone Node in source</Phone2>
    </Phones>
    The requirement is that I want to create <Phone1><Phone2> .........<PhoneN> nodes dynamically based on the number of <Phone> nodes in Source Structure. The cardinality of  <Phone> node in Source is 0 to Unbound.
    Any suggestion ...?
    Thanking you all in advance.

    Hi Ivan,
    Since you have enter the xslt mapping in Message Interface mapping and both Message Interfaces (target and source) are tied with the message type. And in message type you have fixed schema, do you think it still possible to use xslt mapping to generate some of the target nodes dynamically (the nodes which are not part of MessageType/DataType)....thx?

  • Generate target filename dynamically / Receiver File Adapter

    Hi Community Members,
    First of all I would like to say hello to everybody, as this is my first post in this forum.
    I start with PI and would like to prepare a simple DEBMAS -> .csv interface.
    In fact it is already done, but the requirement is to name .csv files according to customer number (KUNNR).
    Hence is my question ... how to set CC to be assigning KUNNRs to file names? (like 123456.csv)
    From what I can in the net people are using ASMA, but isn't there any simpler solution?
    What I tried inside message mapping was to bound KUNNR field from my source message to root element of target message.
    In addition I also set Field Name Scheme to *.csv in CC settings. Unfortunately I am receiving a CC error
    The parameter "argument" has the value "/interfaces/PI/inbound/test/.csv", so it contains the character "/interfaces/PI/inbound/test/.csv" which is not allowed
    But anyway if I would like to use ASMA I see I need to write a Java funciton as UDF.
    Example tutorial [http://www.****************/Tips/XI/ASMA/Index.htm]
    But what next? How would I implement it into message mapping, to which xml element should it be assigned and what should be passed as function input, to make java function work?
    Regards,
    bob

    hI bobens ,
    you have to follw bellow steps  because dynamicalluy we had call file name as same as your requirement.
    STEP1:  WRITE dynamic configuratio:
    Public String DynamicConfig(String a, Container container) throws StreamTransformationException{
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    conf.put(key,a);
    return "";
    step2: in mapping
    KUNNR + constant(.CSV) -> Concat -> udf(dynamic configuration) -> target root node
    Configuration objects:
    3. Receiver communication channel:
    file name : ConfiguredDynamically
    in Adavnce mode :
    you have to enable these check boxes: use asma , fail  if asma,  filename.
    thanks,

  • Element/ Node supression in message mapping

    Hi,
    Source Structure
    ID (Mandatory)
    FName (optional)
    Target Structure
    EmpID (mandatory)
    EmpName (optional)
    In my mapping, i mapped FName to EmpName. Since FName is optional,when i have an XML file that does not contain Name element my message mapping fails. So i used "if-then-else" and "exists" to make the mapping work.
    Name --> <b>"exists"</b> --><b>"if-then-else",</b>
         FName--> EmpName (then)
         Constant-->EmpName(else)
    But now i want that my o/p element (EmpName) should not get generated, if Name element does not exist. I mean the element Empname should be supressed in message mapping.
    I know that if a target field is mapped, it is bound to come in the target structure. But i want this target element to be supressed.
    Hope somebody can help me out...
    Cheers,
    Siva Maranani

    Hi Siva,
    If i understand u correctly you want to supress the target field if the mapped source field does not exist:
    Try using IF WITHOUT ELSE
    When the source field exists then you will have the value mapped to the target field and when the source field does not exist, the target field will not be created.
    Regards,
    Sridhar

  • Access current system or target system ID in message mapping

    Hi.
    I have a requirement to map three different constant values to Sales Org field, depending on whether the system is D, Q or Prod.
    This needs to be done in the message mapping section of the Interface along with all the other mapping logic.
    Is there any way how we can access the current system ID or the Target system ID (XI is communicating with target, in this case, ECC, using RFC receiver Communication channel)?
    Please help.
    Thanks.
    Anuradha.

    Hi,
    The key element would be :-
    System.getProperty("SAPSYSTEMNAME");
    Use this in UDF to get System Name ... and then on basis of systemname do whatever you want to perform.
    Regards
    Prabhat Sharma

  • How to use node functions in Message mapping !!

    Hi  Gurus,
    I have got one issue in message mapping, please can any one put some ideas on this !!
    Source Structure
    <Group_ZA>  0..unbound
         <D02_ZA>           0.. unbound
             ZA_01             0..1   - QA
             ZA_02             0..1      20
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1     QD
             ZA_02             0..1     40
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
          iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
         <D02_ZA>          
             ZA_01             0..1     QA
             ZA_02             0..1      20
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1     QD
             ZA_02             0..1     40
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    <D02_ZA>          
             ZA_01             0..1     QA
             ZA_02             0..1      20
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1     QD
             ZA_02             0..1     40
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
    </Group_ZA>
    Target Structure
    ProductActivityNotification                                                       0..unbound
                          ProductActivity                                                             1..1
                                        Item                                                                 1..unbound
                                              Inventory                                                   0..1
                                                     UnrestrictedUseQuantity                    0..1
    The Group_ZA comes 'n' number of times and D02_ZA comes sometimes 5 times and sometimes 6 times etc.,
    ZA_01 field can come with 5 to 6 different values like 'QA','QD','QN' etc., sometimes ZA_01 comes only 3 times QA,QD,QN.
    if ZA_01 = 'QA' then only  we need to pass   ZA_02 value on to ''UnrestictedUseQuantity'' (target side),
    I mapped the fields, the vlaue ZA_02  passing properly on to 'UnrestictedUseQuantity' when D02_ZA comes 5 or 6 times, all the times 'QA'  value comes into ZA_01 field. In case if QA value missed or doesn't come from source, the Target side ' 'UnrestictedUseQuantity' field last value comes into last but one.
    Ex: QA value is in 3 times, but I have 4 source message on top. values comes into target side like
    20
    20
    20
    suppose to come like
    20
    20
    -- (Space)
    20
    Please required your valuable inputs in bit urget !!
    how to map field level please?
    Many Thanks in Advance
    Kind Regards
    San

    Petre:
    If you want to use standard functions then you try this:
    If-->currentdate -OR- Constant(01.02)
    currentdate -OR- Constant(02.02)   --> OR -->
    currentdate -OR- Constant(03.02)
    Then give some output
    Else give some output
    So give the output for the first two conditions to another OR and the result of the third to the same OR. So whenever the condition is true in any of the condition you will get the THEN value else you will get the ELSE value.
    ---Satish

  • Node functions in Message Mapping

    Hi,
    Could someone help me with some good exercises for node functions such as splitbyvalue, collapsecontents, removecontexts.
    I am a newbie to these functions and have absolutely no idea on how to use them. Would appreciate if someone could give very detailed examples to these functions in a step by step manner, so that I can create them just by following your instructions.
    Any links to video presentations are welcome too.
    Cheers,
    S

    Hi ,
    For a fresher, the informationa and examples given in the help.com would be more helpful and it will help you in building string fundamentals. Once your basics and funcdamentals concepts becomes strong then you can go for more complex exmples. Here is help.sap link where you can leran Node functions of MM of PI.
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
    Thanks,
    RK

  • Want to disable a field (1..unbounded) at target side dynamically.

    Hello,
    I want to disable a field (1..unbounded) at target side dynamically in message mapping on the basis of a condition.
    Please help me out. I serached in existing threads but culdnt find it.
    regards,
    Rahul

    Hello,
    I want to disable a field (1..unbounded) at target side dynamically in message mapping on the basis of a condition
    You can't really disable it using normal mapping because at least it will occur once. What you can do is to change the occurrence to 0..unbounded or use XSLT/Java Mapping.
    Hope this helps,
    Mark

  • Message mapping: Passing data at the node level

    Hi,
    I have a question/requirement, XI Message Mapping program need to read the incoming xml and map to a diffrerent target structure. Incoming xml has a parent node called Description and it has a value "Frauen Hemd Shoes", we need to map this value to target LongText Field but message mapping is ignoring this data while mapping.
    A parent node can't hold the value/data while a child node is present. So is there any workaround to read this data to target str?
    <Description>
    <ShortName>Shoes</ShortName>
    Frauen Hemd Shoes
    </Description>
    Expected result:
    <Comments>
    <ShortText>Shoes</ShortText>
    <LongText>Frauen Hemd Shoes</LongText>
    </Comments>
    Please let me any clues to resolve the issue.
    thanks,
    Laxman

    I agree , the soruce structure is not a valid one..
    The source structure should look like the below:
    <Description ShortName='Shoes'>
    Frauen Hemd Shoes
    </Description>
    where ShortName is attribute for the Element "Description".
    You add attribute to the element the same way you add subElement, Just choose attribute instead of subelement.
    In this case the Mapping would be
    Descriprion -
    > LongText (target)
    ShortName -
    > ShortText (target)
    This Should work.
    Regards.
    Jeet.

  • Hierarchical structure message mapping in PI

    Hello All,
    I have a source and target structure in graphical message mapping
    <?xml version="1.0" encoding="UTF-8"?>
    <Material_MT>
       <row>    0..unbounded
          <MATERIAL_ID>1234</MATERIAL_ID>
          <DEL_FLAG>
         </row>
      <row>    0..unbounded
          <MATERIAL_ID>1234</MATERIAL_ID>
          <DEL_FLAG>Y</DEL_FLAG>
         </row>
      <row>  
          <MATERIAL_ID>4567</MATERIAL_ID>
          <DEL_FLAG>N</DEL_FLAG>
         </row>
    <row>  
          <MATERIAL_ID>1234</MATERIAL_ID>   
          <DEL_FLAG>N</DEL_FLAG>
         </row>
    </Material_MT
    Materials can repeat in the source structure but their flags could be different
    Target structure
    <Mat>  1..1
    <Mat_update> 0..unbounded
       <Matid>
               <Matreg>
                     <Matcomplete/>
                     <tuple>
                          <id/>
                      </tuple>    
               </Matreg>
         </Matid>
         <recordind>
                <id>
          </recordind>
    </Mat_update>
    Now, the requirement is
    1) For each <MATERIAL_ID>  in the source, map its corresponding flag <DEL_FLAG> value <Matcomplete/ field in the target ,
    2) For each  <MATERIAL_ID> in the source, take its corresponding value and make a soap  lookup call in mdm to get tuple ids (mutiple value per material possible) and map each to <id> (under <tuple>)
    3) For each <MATERIAL_ID> in the source, take its corresponding value and make a soap lookup call in mdm to get <recordind> (single value per material) and map to <id> under <recordind>
    Now, I have done soap lookup for 2)  and getting multiple tupleIDs for a single material
    For 3) also, I am doing a lookup and getting a single ID back 
    Both 2)   and 3) are achieved using  udf soap lookup  - 2) will return a resultlist and 3 a single string value
    My main question is how to do message mapping for achieving step1, 2 and 3. Pls help...its needed badly
    Thanks
    mike

    Hi Mike,
    Below is the logic as per my understanding.
    1- Direct mapping from DEL_FLAG> value <Matcomplete/ field in the target
    2- After lookup Map multiple Tuple Id's to Tuble node.
    3-After lookup Map  recordind to Id .
    If you want it in detail let me know the sample output structure with values.
    Regards,
    Sudha

  • Message mapping  response error

    Hi..All,
    i am doing RFC-SOAP scenario, in request message mapping i am giving the values at sender side executed, i am getting the fields at target side, in resonse message mapping giving the all fields at sender side,i executed , but in target side not getting any fields, pls suggest me.
    ****for helpful answers i will give points***********
    thanks in advance,
    Pasi

    Hi
    when you do the RFC to SOAP scenario then you have to craete the two message mapping
    one mapping will be b/w both the request messages
    and other mapping will be b/w the response messages.
    in the interface mapping you select the request message mapping in the request tab and response message mapping in the response tab.
    both the message interfaces outbound as well as inbound interface of the synchronous type.
    if u still face the problem please reply me back
    Thanks
    Rinku

  • Target structure generation using GUI mapping

    Hi Experts,
    I have two nodes in source  and one node in target structure .
    Source
    permanentemployee (0..n)
          name
          dept
    contract employee (0..n)
         name
         dept
    Target
    Employee (0..n)
        name
        dept
    If both nodes (permanentemployee  &  contract employee )are present in source then I should get two occurances of target..
    Please watch that I have same subnodes in permanentemployee  &  contract employee .
    Please let me know your thoughts.

    Hi Vamsi,
    Duplicate the target structure.
    then map
    permanentemployee (0..n) node to Employee (0..n) target node and fields should map to the target side fields [like name --> name and dept --> dept]
    and contract employee (0..n) node to Employee (0..n) target node [this is the duplicated node] and map the corresponding fields to tarhet fields. [like name --> name and dept --> dept]
    Regards
    Ramesh
    Edited by: Venkataramesh Boppana on Oct 8, 2009 12:43 AM

  • Message mapping with dynamic node

    Hi,
    I am doing message mapping where my source structure is
    <root>
         <EmpCount>2</EmpCount>
         <Emp>
              <item>
                   <code>1</code>
                   <name>ABC</name>
              </item>
                                     <item>
                   <code>2</code>
                   <name>PQR</name>
              </item>
         </Emp>
    <root>
    If EmpCount is having value 2 then Emp node will have only 2 items
    Target structure is flat structure like (something like fix file format)
    <root>
         <EmpData>EmpDetails</EmpData>      occurrences 0...unbounded
    </root>
    With above sources data following is expected target sturcure…
    <root>
         <EmpData>2ABC</EmpData>
         <EmpData>3PQR</EmpData>
    </root>
    Here my query is how I can create more than one node to target structure with employee details.
    I already tried with following Re: how to create target node a constant number of times
    This help to get all 2 nodes of EmpData in target structure but it is showing only First value in both nodes. Following is output I am getting…
    <root>
         <EmpData>2ABC</EmpData>
         <EmpData>2ABC</EmpData>
    </root>

    Sunil,
    Please see the sample i/p and o/p payload. Also please let me know , is this the same u are looking for
    I/P
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Check xmlns:ns0="urn:hdmc:samplescenarios">
       <EmpCount>2</EmpCount>
       <Emp>
          <Item>
             <Code>1</Code>
             <Name>A</Name>
          </Item>
          <Item>
             <Code>1</Code>
             <Name>B</Name>
          </Item>
       </Emp>
    </ns0:MT_Check>
    O/P
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Check_Out xmlns:ns0="urn:hdmc:samplescenarios">
       <Root>
          <EmpData>2A</EmpData>
          <EmpData>2B</EmpData>
       </Root>
    </ns0:MT_Check_Out>
    Best regards,
    raj.

  • Child element of target node in message mapping getting suppressed

    Hello All,
                      I am having  mapping where i am trying  to generate the target node based on some condition of the source structure ,this is working fine ,I am able to generate the target node once the condition gets satisfied ,but the problem is one of the  child elements of the same node is not getting populated,its getting suppressed,i have some condition for the same
    I checked  the  queues its showing value as
    SUPPRESS
    Value
    Value ( in grey )
    But still element is not getting generated..
    I have added a condition used at the node function and apart from other condition of element..
    If some body have the solution for the same,please help me out
    Thanks in advance
    Rajesh

    Hi Rajesh,
    The Error is mostly cause of that the node and your child are in same context.
    You got to remember that the parent node creates the context, and then the child element puts the value in it.
    Try putting your child element to a higher context then mapwithdefault for your supress and then removecontext.
    This Issue, you got to work it out with the node functions,
    I had the same kind of issue in my mapping, it was rectified with the help of node functions as mapwithdefault, removecontext.
    Further unless one sees the mapping of your issue it is a bit difficult to imagine it and answer it.
    For more clarifications please give the full hierarchy, and the condition. As of now try with the node functions.
    Thanks
    Ashmi

  • PI Message Mapping One Source to create two of the same Target Nodes.

    Hi,
    I have a source node that contacts the following.
    "1234-5678".
    When there is a "-" in the source node then I need to create two target nodes.
    When there is no "-" in the source node then only create one node.
    Since the source structure is a flat structure by on the target side as you can see I am trying to achieve a diep structure.
    Please can you assist in how to do this with PI message mapping.
    Regards
    Willie Hugo

    Hi,
    "1234-5678" only occurs once in the source. There is no source xml node that will occur more that once. The whole structure only occurs once. But on the target side I need one of the node to occur more than once if a hyphen is found in the source field.
    Source Message                      - Always only one data node.
    ==============
    <root>
    <OnceOnlyNode>1234-5678</OnceOnlyNode>                   [1..1]
    </root>
    Target Message                      - Only two text node when "-" in source, else only one text node.
    =============
    <msg>
    <text>1234</text>
    <text>6789</text>
    </msg>
    How can this be done using standard PI message mapping functions. Can it be done?
    Regards
    Willie Hugo

Maybe you are looking for

  • My Apple ID is no longer being recognized after IOS5 update

    My Apple ID is no longer being recognized after upgrading my I-Phone to IOS5.  When trying to update my aps, it asks for the password and doesn't recognize it when I enter it.  I've been through the entire "Forgot my ID" process, but nothing's workin

  • Service error...  tried everything but doesn't work!!  Help please!

    I just got my brand new video ipod, and I can't even download anything!!! I installed the CD that came with the ipod. Ipod IS recognized by the windows, but not in iTunes. I see in the discussion that so many people had these errors... "ipod service

  • Foreign languages on 8220

    I would like to be able to input other European languages (besides French, German, Italian and Spanish) on the phone. Is there a way to download appropriate character support?

  • E55 (& E52?) 33.002 skipping music workaround

    I updated my E55 to 33.002 this morning to solve my bluetooth problems after a hard reset to avoid as many problems as possible.  Unfortunately I swapped an irritating problem for a real showstopper - practically all my music tracks were skipped over

  • Adding gifs to page

    Does anyone know how to add a simple gif animation to an iweb page? I've downloaded some for free on website and tried drag and dropping them on to my page, as I would a picture. The problem is that they are only animated when I click on them. What c