Summarize prices for INVOIC02 in Message Mapping

Hello,
I have to summarize prices in the INVOIC02 IDOC. In the invoice there is
header items and kit order items. The prices is found in the field BETRG
in the Y_E1EDP05 segment. It is only the prices with KSCHL = IV01 that
should be summarized. The link between header and kit items is found in
the field UEPOS, so the prices should be calculated to the correct header.
To only show the header items I can use this function:
UEPOS -> exists -> not -> createIf -> removeContext -> E1EDP01
So that is ok, but to get the correct prices to the header I guess one would need
some kind of UDF. I am a bit lost at this mapping, so I hope anyone can help.
I have provided the corresponding structures:
Here is the source message:
          <E1EDP01 SEGMENT="1">
               <POSEX>000010</POSEX>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
          <E1EDP01 SEGMENT="1">
               <POSEX>000020</POSEX>     
               <UEPOS>000010</UEPOS>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>2.00</BETRG>
                    <KRATE>1.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
          <E1EDP01 SEGMENT="1">
               <POSEX>000030</POSEX>
               <UEPOS>000010</UEPOS>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>2.00</BETRG>
                    <KRATE>1.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
          <E1EDP01 SEGMENT="1">
               <POSEX>000040</POSEX>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
          <E1EDP01 SEGMENT="1">
               <POSEX>000050</POSEX>     
               <UEPOS>000040</UEPOS>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>12.00</BETRG>
                    <KRATE>1.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
          <E1EDP01 SEGMENT="1">
               <POSEX>000060</POSEX>
               <UEPOS>000040</UEPOS>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>20.00</BETRG>
                    <KRATE>1.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
This is how the target message should look:
          <E1EDP01 SEGMENT="1">
               <POSEX>000010</POSEX>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>4.00</BETRG>
                    <KRATE>0.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
          <E1EDP01 SEGMENT="1">
               <POSEX>000040</POSEX>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>IV01</KSCHL>
                    <BETRG>32.00</BETRG>
                    <KRATE>0.00</KRATE>
               </Y_E1EDP05>
               <Y_E1EDP05 SEGMENT="1">
                    <ALCKZ>+</ALCKZ>
                    <KSCHL>MWST</KSCHL>
                    <BETRG>0.00</BETRG>
                    <KRATE>0.000</KRATE>
               </Y_E1EDP05>
          </E1EDP05>
Kind regards,
Per Rune

Hi.
I was review your questions.  let me see if i understand.
You need to summarize when KSCHL = IV01 and when UEPOS  exist. 
You should be check the context for the field  BETRG. and use the same logic. on the segment header.

Similar Messages

  • RemovingContext only for One level(Message Mapping)

    Hi,
    Is it possible to remove context only for one level?
    For Eg:If I apply [RemoveContext] function to <Item>
    I will get {A1,A2,B1,B2,C1,C2,C3,C4}
    <SourceRoot>
    <A>
    <Item r="a">A1</Item>
    <Item r="b">A2</Item>
    </A>
    <A>
    <Item r="a">B1</Item>
    <Item r="b">B2</Item>
    </A>
    <A>
    <Item r="a">c1</Item>
    <Item r="b">c2</Item>
    <Item r="c">c3</Item>
    <Item r="d">c4</Item>
    </A>
    </SourceRoot>
    But I need only those coming under a particluar <A> .
    Like {B1,B2}.
    Any way to do this?
    Can anyone help.
    Thanks in Advance
    Message was edited by: Chemmanz

    Hi,
    I was just trying to give an example. In my real case
    SOURCE - INVOIC01 IDoc
    TARGET - cXML Structure for Invoice.
    When it goes to Line item level the complexity comes.
    A similar situation as i explained needs to be solved.
    [REMOVECONTEXT] helped me a lot.
    But I this situation I want to restrict it to a single level.
    For Ex:
    <INVOIC02>
    <IDOC>
    <EIEDP01>
    <EIEDP02 QUALF="001">.. </EIEDP02>
    <EIEDP02 QUALF="002">.. </EIEDP02>
    <EIEDP02 QUALF="0xx">.. </EIEDP02>
    </EIEDP01>
    <EIEDP01>
    <EIEDP02 QUALF="001">.. </EIEDP02>
    <EIEDP02 QUALF="002">.. </EIEDP02>
    <EIEDP02 QUALF="0xx">.. </EIEDP02>
    </EIEDP01>
    </IDOC>
    </INVOIC02>
    1.<EIEDP01>
    <=== mapped directly to ==> <InvoiceDetailOrder>
    Then internal things are organized differently in
    <InvoiceDetailOrder> compared to IDoc element<EIEDP01>
    Ex:
    I want to take all the <EIEDP02>s coming under one line Item <EIEDP01>
    <EIEDP02> cannot be mapped diectly to cXML element. It can be done only after checking it's own attribute QUALF.
    For this I applied [REMOVECONTEXT], but i am getting all the QALF values.
    I need to restrict it to <EIEDP01> level.
    Regards
    Chemmam

  • Failed in Message Mapping for Sender SOAP Adapter

    I am using a synchronous Sender SOAP adapter for sending SOAP messages using HTTP security protocol. I am trying to send SOAP messages to XI and then to RFC-R/3. And Responses back from RFC to XI and then to SOAP. I am getting an error for failed in message mapping in SXMB_MONI for converting SOAP messages to RFC. When I debug it in Message Mapping in Integration Repository, it works fine.
    Any help is appreciated.
    Thanks in advance!
    Mrudula

    Hi,
    try to do a full cache refresh
    regards,
    Jakub

  • Re-use message mapping from within java mapping?

    Hi there,                                                                               
    I have a question regarding java mapping. What I would like to do is to re-use an existing message mapping from within java mapping.
    Technicaly, message mapping is perfomed by com.sap.aii.mappingtool.tf3.AMappingProgram.execute, right? I would like to call that mapping program for a specifc message mapping from within my java mapping.
    Pseudo java code would look like this:
    public void execute(InputStream in, OutputStream out)
      throws StreamTransformationException {
    com.sap.aii.mappingtool.tf3.AMappingProgram.execute(in,out,'SomeMessageMapping');
    SomeMessageMapping is a message mapping that is defined in the integration repository.
    Is it possible? If so, could you provide me with some details?
    Thank you and best regards,
    Wolfgang

    Hi Wolfgang,
    very interesting idea?
    I would activa a dummy message mapping. than I would have a look in the file directory of the java-stack and try to find out the name of the *.class or *.jar file.
    On the other hand you could generate a tpz-transport-file an unpack this file, to explore the name of the *.class or *.jar
    Unfortunately I do not have access to the file system. So I can't explore the name.
    Regards Mario

  • Missing message mapping in SXMB_MONI

    Hi All,
    I am doing a mapping from XI to 2 receivers CRM proxy and JMS adapter.
    When I executed the whole process, I can see success flags in both XI MONI with 2 nodes one for receiver grouping and other for response. The request message mapping node is missing. When i checked CRM MONI for the same message, the inbound message payload is blank. What could be the reason for the missing message mapping IN sxmb_moni.
    Thanks

    Hi,
    Are you copying the source xml from message test tab to trigger the scenario.
    If so you need to remove <messages> <message> node from the input type.
    Always the root of your input xml should be your message type name.
    Regards,
    P.Venkat

  • How to export parameters from Message Mapping

    You can make use of this export parameter only in transformation step of Integration Process. You may use the following "Parameterized Mapping Programs"
    http://help.sap.com/saphelp_nwpi71/helpdata/en/27/db283fd0ca8443e10000000a114084/content.htm
    Regards,
    Prateek

    If you have defined the signature of your UDF then the return value of the UDF must be assigned to the Export paramter of message mapping.
    Basically import parametrs represents the inputs to be passed for that function(message mapping here)
    and export represents the output of that function.
    so in your case if you want toassign the value to Export parameter (ERROR_TEXT) in UDF catch block
    assign the error returned to the ERROR_TEXT field
    http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm
    Check this link
    Hope this is clear
    Rajesh
    Edited by: Rajesh on Mar 13, 2009 5:31 PM

  • Require some complex logic scenario in message mapping

    Hi all,
                 I need some complex logic scenarios for practice in message mapping . Kindly forward some links for message mapping logic scenarios.
    Thank you so much in advance.

    always search sdn first....
    http://wiki.sdn.sap.com/wiki/display/XI/MappingConceptsinSAPXI

  • Message mapping crashes only in INterface Mapping

    hi guys,
    i have an issue with one of my interface mapping. the message mapping crashes when i run the interface mapping. however when i run the message mapping separately it works fine.
    any hints?
    thanks,
    ali.

    Hi Ali,
    If you are using try catch then in case of catch condition if you pass null to substring it will fail.. Either you call the substring inside your udf (so that you can make sure that the filename is available then only substring is called) else handle the null condition in message mapping before calling substring...
    Also you can try looking into the display queue entry for substring in Message Mapping for further analysis. Here also you will not get any filename by dynamic configuration, but i am not sure why it was not failing there.. May be display queue will help you.
    Regards
    Suraj

  • Error in message mapping of IDoC Invoic02

    Hi,
    i have imported the invoic02 idoc into PI system. i have mapped the required field os idoc with standard XSD which is imported through ED. I'm able to most of the fields with idoc and XSD. however, some of the node in xsd are repaeting.
    so here the part of xsd with which i'm mapping.
    (first_node)ListOfTaxSummary                      0..1
    (second_parent_node)TaxSummary                   1..unboubed
    (child_node) tax                                 1..1
    (element)TaxAmount                                0..1
    (element)TaxCategoryCoded                         0..1
    here the i have mapped  ListOfTaxSummary    with the idoc node E1EDS01
    TaxSummary  with E1EDS01
    tax with E1EDS01.
    i tried all possibilities with different mapping. but i'm able to get the tax node under taxsummary with the element. the problem its been repeated as  E1EDS01 idoc repeats.
    please help us in solving this problem.
    Thanks
    Kind regards,
    Lalitkumar.

    Could someone tell me is there any relation for the above error in XML messages and to the message mapping?
    The error mentions that you have used an IDOC in your mapping program which is not found in the ESR....you need to check if the IDOC is present in the ESR and is present under the correct SWCV.
    Once you have done the check do some dummy change to the mapping and activate it (if in DEV) and then check the CACHE.

  • Need user define function for the message  mapping structure

    Hi All
    I am new to XI.I need the java code for Udf for the following structure.
    i have two input and one out put as error.
    order_nos----
    user define function-------error message
    order_details----
    num of orders---- i.e. 10
    order_details------ i.e. whole order records details
    1.i have to compare the 1st  input with 2nd one means if the ist input contain 10 means there are 10 orders in 2nd input.if not then i have to give error message .
    2.then i have to check the fields in 2nd input has no null values.if no values the output will be error message.
    Edited by: Rohit Kumar on Dec 18, 2008 4:43 PM

    Hi Sudhir
    thanks for your continues help.i need some help so that i can fulfill my requirmrnt
    this is my message mapping xml.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:methodCall_MT xmlns:ns0="http://www.dfdsf">
      <num_orders>10</num_orders>
      <test_mode />
    - <order_x>                        ( which is order details)
      <order_id>t78tyu8t</order_id>
      <order_date />
      <mfg_id />
      <catalog_id />
      <first_name />
      <last_name />
      <recipient />
      <message />
      <address1 />
      <address2 />
      <address3 />
      <city />
      <state />
      <zip />
      <country />
      <country_code />
      <phone />
      <subtotal />
      <tax />
      <shipping />
      <total />
      <shopatron_total />
      <fulfiller_total />
      <shipment_id />
    - <additional_info>
      <in_store_pickup />
    - <express_shipping>
      <express_shipping_flag />
      <express_shipping_text />
      <express_shipping_arrival />
      </express_shipping>
      </additional_info>
    - <discount>
      <discount_description />
      <discount_percentage />
      <discount_total />
      </discount>
      <lang_id />
      <currency_id />
      <packing_list />
      <num_items />
    - <items>
      <item_id />
      <quantity />
      <price />
      <part_number />
      <fulfiller_total />
      <shopatron_total />
    - <options>
      <option_x />
      </options>
      </items>
      </order_x>
      </ns0:methodCall_MT>
    this my mapping where under one element number elements are there.when i am excuting the code to check the null value its always giving the there is null val but i have filled evrything.its due to first its checking the order_x and which will be always null.uder this all data will be filled.please suggest what to change in the udf.the code  given by u is working fine but its failing in this scenario because it getting the parent filed is null.

  • User defined function in java for message mapping

    I wrote the following user defined function in java for message mapping and mapped vendor with this. The aim of this function is to write a error file at defined path when i send empty Vendor value from File to RFC-Function module BAPI_PO_CREATE. The "err.txt" error file is not written when i execute in TEST but the value "ERROR" is returned to destination Vendor Field.
    public String  validation(String a, Container container) {
    //write your code here
    if (a.equals("")) {
    try {
    String source = "Vendor cannot be empty";
    char buffer[] = new char[source.length()];
    source.getChars(0, source.length(), buffer, 0);
    for (int i = 0; i < buffer.length; i +=2)
       f0.write(buffer<i>);
    f0.close();
    FileWriter f1 =  new FileWriter("/10.10.0.55/sapmnt/trans/edixiin/err.txt");
    f1.write(buffer);
    f1.close();
    catch (IOException e) {}
    return "ERROR";

    Hi Senthil,
    Check these things :
    1) Whether you have permission to create a file in that directory.
    2) try giving this 
    10.10.0.55
    sapmnt
    trans
    edixiin
    err.txt
    3) Also check for permissions.
    Hope this will help you.
    Regards
    Suraj

  • Java Message Mapping : Dynamic FileName and Directory for ASMA

    How to Put Dynamic FileName and Directory for ASMA Properties of File Receiver adapter in Java Message Mapping ???
    I know How to Do this in UDF , But In Java Type Message Mapping . How to do this ????
    Regards
    PS.

    Hi
    chk this:
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=95093307
    Thanks
    Amit

  • Weblogs for different message mapping needed

    Hi,
    I want to do scenarios using XSLT mapping, ABAP mapping, Java mapping.
    Can you suggest me some weblogs...
    Thanks,
    Ram

    Hi Ram,
    thought i will start of from scratch.Mapping is basically done to convert one form of xml into another form. This can be done using either of them mentioned below.
    - Graphical mapping
    - XSLT mapping
    - JAVA mapping
    - ABAP mapping
    To know more about each of them please go thru the following links. And if you ask me your which is better, it depends basically on the scenario you implementing and the complexity involved. Anyways please go thru the following links:
    Graphical mapping
    /people/bhanu.thirumala/blog/2006/02/02/graphical-message-mapping-150-text-preview
    http://www.sapgenie.com/netweaver/xi/mapping1.htm
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    XSLT mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
    JAVA mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
    ABAP mapping
    /people/r.eijpe/blog
    To know more about the value mapping tools for the SAP Exchange Infrastructure (XI), please go thru the following link:
    http://www.applicon.dk/fileadmin/filer/XI_Tools/ValueMappingTool.pdf
    To get an idea as to what value mapping is, please go thru the following links:
    http://help.sap.com/saphelp_nw04/helpdata/en/13/ba20dd7beb14438bc7b04b5b6ca300/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/f2/dfae3d47afd652e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2a/9d2891cc976549a9ad9f81e9b8db25/content.htm
    most of the links that I have provided also helps you get the step by step procedure of doing the same. And also involves the procedure to implement certain advanced features.
    Hope this clears your doubt fully.
    Also go through this threads...
    Re: Different types of Mapping in XI
    Regards,
    Abhy

  • Different options for message mapping in BPM

    Hey guys
    i m in the learning phase of BPM and am kinda confused with the different ways we can do message mapping in a BPM scenario.
    first of all we can do message mapping before BPM,we can also do after BPM and lastly we can do inside BPM(ofcurse this is not recommended as its too resource consuming)
    i have bene through starters blog on BPM by Krishna moorthy and Arpit seth,and now am wondering how to use the mapping in diff. ways
    suppose i m doing a simple File to File with BPM(just for practise purpose)
    now here is what i have designed in IR
    DT_sender_File                                       DT_receiver_File
    MT_sender_File                                       MT_receiver_File
    MI_Outbound_sender(async,outbound),     MI_Inbound_receiver(async,inbound)
    AI_sender(abstract,async)                        AI_receiver(abstract,async)
    MM_File_File(using MT_sender_File and MT_receiver_File)
    now i want to clear some doubts about interface mapping.my understanding is
    if i do interface mapping between MI_Outbound_sender and AI_receiver,this will be interface mapping before BPM.
    if i do interface mapping between AI_sender and MI_Inbound_receiver,this will be interafce mapping after BPM
    and if i do interface mapping between AI_sender and AI_receiver then it will be mapping inside BPM.
    is my understanding correct?if yes,then does that means we can we any of the above mapping in our scenario.(if we dont consider the performance issue as of now)
    thanx
    saif

    Hi Saif,
    <i>
    is my understanding correct?</i>
    Yes, thts correct
    <i>if yes,then does that means we can we any of the above mapping in our scenario</i>
    Of course, u can use any of them (overlooking the performance issue)
    Regards,
    Prateek

  • Request Message mapping in SXMB_MONI for File - RFC - File without BPM

    Hi ,
    In my File-RFC-File scenario, the messages are processed successfully.
    but when i look into the SXMB_MONI for File to RFC step, the records are present only till the  Message split According to Receiver List and not able to see the records from Request Message mapping step onwards.it contains
    <?xml version="1.0" encoding="UTF-8" ?>
      <ns1:Z_PI_LOTUSNOTES_UNIFORM xmlns:ns1="urn:sap-com:document:sap:rfc:functions" />
    in my mapping for the receiver RFC i have not done the mapping for all the fields. few fields i have disabled. whether this could create a problem in message mapping. pls let me know what needs to be done.

    Is it only for this scenario that the above display issue is occuring or is it for all scenarios?
    If onlt a particular Pipeline steps are displayed then you can check what is the TRACE level set in SXMB_ADM --> Integration Engine Configuration --> and check if the TRACE parameter is set to at least 2 (max is 3 which will ensure that your DB will get full quickly)
    For more information refer: /people/michal.krawczyk2/blog/2005/05/10/xi-i-cannot-see-some-of-my-messages-in-the-sxmbmoni
    Regards,
    Abhishek.

Maybe you are looking for