SUM in CASE in mapping

Hi Guys!
I am loading data from Oracle to Essbase and have a question for you.
Can i do something lika that in ODI mapiing:
CASE
WHEN (select sum(DataSource.value) from DataSource where Account like 'K410%') >= 0
THEN 'Profit'
WHEN (select sum(DataSource.value) from DataSource where Account like 'K410%') < 0
THEN 'Loss'
END
Best regards,
Grzegorz

Hi Greg
If you perform the aggregations and filter on the source you should be able to achieve what you want, check out the illustration below;
https://blogs.oracle.com/warehousebuilder/resource/ODI11g/odi_aggregation_illustration.jpg
This shows how to define the aggregation expressions.
Cheers
David

Similar Messages

  • Sum quantities in message mapping

    Hello there.
    I'm trying to map a xml message with items (material/quantity) into another one with exact same structure but collecting the lines by material.
    The XML's structure is like:
    header_fields ...
    <items>
      <item>
        <matnr>1</matnr>
        <qty>1</qty>
      </item>
      <item>
        <matnr>2</matnr>
        <qty>10</qty>
      </item>
    <item>
        <matnr>1</matnr>
        <qty>5</qty>
      </item>
    </items>
    When mapping <item> tag, I used a user-defined function Like this:
    public void addMaterial(String[] material,ResultList result,Container container){
    Vector vMats = new Vector();
    for (int i = 0; i < material.length; i++ ){
       if (!vMats.contains(material<i>)){
          vMats.addElement(material<i>);
    for (int i = 0; i < vMats.size()-1; i++){
         result.addValue("");
    This is working well (I think) because i only get different materials in output queque in mapping.
    Now, I want to actually calculate quantities, mapping qty tag, collected by material, and i'm trying something like:
    public void sumQuantities(String[] material,String[] units,ResultList result,Container container){
    Vector vMats = new Vector();
    Vector vQuant = new Vector();
    for (int i = 0; i < material.length; i++ ){
       if (!vMats.contains(material<i>)){
          vMats.addElement(material<i>);
          vQuant.addElement(units<i>);
      else {
    for (int i = 0; i < vQuant.size()-1; i++){
         result.addValue("");
    I'm creating a vector vMats to have an array with not repeated material, and a vQuant array to sum quantities. There is the ???? part ...
    I'm sorry for the SIMPLE question but i'm an abaper trying a bit in the java workd
    The needed result is:
    header_fields ...
    <items>
      <item>
        <matnr>1</matnr>
        <qty>6</qty>
      </item>
      <item>
        <matnr>2</matnr>
        <qty>10</qty>
      </item>
    </items>
    Regards,
    Valter Oliveira.

    Hello VJ.
    Thanks for your input. There were some problems in the type convertion in your code, but using your idea with small changes found in java foruns I got one of the possible solutions (probably not the best one). I've tryied it with several complex combinations and so far so good ... always got what we need.
    The code for the 3 UDF's that I created is:
    For <Item> (non-repeated materials)
    public void additem(String[] material,ResultList result,Container container){
    Vector vMats = new Vector();
    for (int i = 0; i < material.length; i++ ){
       if (!vMats.contains(material<i>)){
          vMats.addElement(material<i>);
          result.addValue("X");
    For <matnr> (non-repeated materials)
    public void addmaterial(String[] material,ResultList result,Container container){
    Vector vMats = new Vector();
    for (int i = 0; i < material.length; i++ ){
       if (!vMats.contains(material<i>)){
          vMats.addElement(material<i>);
          result.addValue(material<i>);
    For <qty> (collected by material)
    public void sumQuantities(String[] material,String[] units,ResultList result,Container container){
    Vector vMats = new Vector();
    Vector vQty = new Vector();
    for (int i = 0; i < material.length; i++ ){
       if (!vMats.contains(material<i>)){
                  vMats.addElement(material<i>);
                  vQty.addElement(units<i>);
      else {
                  int p = vMats.indexOf(material<i>);
                  int actual = Integer.parseInt(units<i>);
                  String[] aux = (String[])vQty.toArray(new String[vQty.size()]);
                  int previous = Integer.parseInt(aux[p]);
                  int sum = actual + previous;
                  String strsum = Integer.toString(sum);
                  vQty.set(p, strsum);
    String[] end = (String[])vQty.toArray(new String[vQty.size()]);
    for (int i = 0; i < vQty.size(); i++){
         result.addValue(end<i>);
    After the UDF's, to achieve <matnr> and <qty> in output XML, I had to use SPLIT by VALUE.
    I'll keep this open for a while to see if anyone has a better solution.
    Regards,
    Valter Oliveira

  • Sum but cases

    hi i'm using oracle 10g r2
    i have a data like this
    ITEM-------------LINETYPE--------------DEBIT------------------CREDIT
    A010-------------LIABILITY---------------0---------------------------3000
    A010--------------LIABILITY-------------0----------------------------2000
    A010--------------TAX----------------------0---------------------------200
    A010----------------CHARGE---------------5200-----------------------0I want to show my data like this
    ITEM-------------LINETYPE--------------DEBIT------------------CREDIT
    A010-------------LIABILITY---------------0---------------------------5000
    A010--------------TAX----------------------0---------------------------200
    A010----------------CHARGE---------------5200-----------------------0I WANT to sum but if linetype = 'LIABILITY' how to achieved this by query?

    If some of the linetypes other than 'LIABILITY' did have multiple rows for the same item, and you didn't want to combine them, then you could add a CASE expression to the end of GROUP BY clause, somthing like this:
    YES frank i want to like this
    in case which column i have to set primary key
    if my data like this
    ITEM---------LINE_TYPE-----------DR---------------CR
    B1---------------LIABILITY-----------0-----------------5000
    B1---------------LIABILITY-----------0------------------2000
    B1----------------TAX------------------0------------------1000
    B1---------------TAX------------------0---------------------800
    B1---------------CHARGE----------5000
    B1---------------CHARGE-----------3800i want like this
    ITEM---------LINE_TYPE-----------DR---------------CR
    B1---------------LIABILITY-----------0-----------------7000
    B1----------------TAX------------------0------------------1000
    B1---------------TAX------------------0---------------------800
    B1---------------CHARGE----------5000
    B1---------------CHARGE-----------3800ONLY sum in liability case
    please help
    Edited by: BluShadow on 17-Oct-2011 15:43
    fixed {noformat}{noformat} tags.  the word "code" has to be lower case in the tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Combine greatest, sum, and case when

    All,
    I have the following view
    Select table1.field1,
    greatest(sum(table1.field3) - case when table1.oneorzerocolumn=1 then table1.field2 else table1.field4 end,0) as NetAbove0
    from table1
    group by table1.field1;
    I seem to be having trouble figuring out the best way to accomplish this, though, as whenever I try to execute this query I get not a valid group by expression. How can I combine the greatest function and the aggregate sum function without creating a separate view?
    Thanks in advance.
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE     11.2.0.2.0     Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Edited by: 929933 on Mar 14, 2013 1:32 PM

    929933 wrote:
    @ sb92075 would you care to elaborate on exactly what was missing?If you would care to read the link sb92075 posted you will understand by yourself:
    What is particularly important in that FAQ is:
    6) Tables/Indexes
    7) Sample Data
    8) Expected Output
    9) Formatting with {noformat}{noformat} Tags
    You have posted an unformatted code and did not provide proper input.
    Coming to your problem the issue is quite clear. If you use a GROUP BY clause then all field which are not returned as aggregated function shall be included in the GROUP BY clause.
    And this has a logic.
    Your initial query (formatted in a decent way):SELECT table1.field1
    , GREATEST (SUM (table1.field3)
    - CASE
    WHEN table1.oneorzerocolumn = 1 THEN
    table1.field2
    ELSE table1.field4
    END, 0) AS netabove0
    FROM table1
    GROUP BY table1.field1;
    is not correct.
    The column used in the query table1.oneorzerocolumn, table1.field2 and table1.field4 are not part of the GROUP BY and not used in aggregation functions.
    So how could you determine the value, i.e. table1.oneorzerocolumn, if for the same value of table1.field1 you have different values of table1.oneorzerocolumn?
    You are aggregating by field1 so which value do you want to use for non aggregated columns?
    Everything will be easier to understand if you can post some sample data, explain the logic you want to apply and post the expected output for the sample data you have posted.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • A sum and case query help

    I need help please with the following query.
    I have a table that contains a currency, voucher, start_date and a value.
    Data in the tables looks like this:
    GB, 31/05/2010, A, 100
    GB, 31/05/2010, B, 250
    GB, 31/05/2010, A, 72
    GB, 12/12/2009, A, 1000
    GB, 12/12/2009, B, 72
    LX, 12/05/2010, A, 90
    This is where it gets complicated, I need to show the total(SUM) value when the start_date < 60 days from sysdate and also when the start_date > 61 days AND only if the voucher = A and partioned by the currency.
    So, in other words I need my results like this.
    GB, 31/05/2010, A, 100, *172, 0*
    GB, 31/05/2010, B, 250, *0, 0*
    GB, 31/05/2010, A, 72, *172, 0*
    GB, 12/12/2009, A, 1000, *0, 1000*
    GB, 12/12/2009, B, 72, *0, 0*
    LX, 12/05/2010, A, 90, *90, 0*
    The bold columns are what I need, one called less_than and one more_than.
    A big big thank you and any advice I appreciate.
    S

    Please make a habit of posting sample data we can work with right away by using CREATE TABLE and INSERT INTO statements, or use the WITH clause as shown below:
    SQL> with t as ( -- generating sample data:
      2  select 'GB' currency, to_date('31/05/2010', 'dd/mm/yyyy') start_date, 'A' voucher, 100 value from dual union
      3  select 'GB', to_date('31/05/2010', 'dd/mm/yyyy'), 'B', 250 from dual union
      4  select 'GB', to_date('31/05/2010', 'dd/mm/yyyy'), 'A', 72 from dual union
      5  select 'GB', to_date('12/12/2009', 'dd/mm/yyyy'), 'A', 1000 from dual union
      6  select 'GB', to_date('12/12/2009', 'dd/mm/yyyy'), 'B', 72 from dual union
      7  select 'LX', to_date('12/05/2010', 'dd/mm/yyyy'), 'A', 90 from dual
      8  )
      9  --
    10  -- actual query:
    11  --
    12  select currency
    13  ,      start_date
    14  ,      voucher
    15  ,      value
    16  ,      sum(case
    17               when  trunc(sysdate-start_date)< 60
    18               and  voucher = 'A'
    19               then value
    20               else 0
    21             end) over (partition by currency, voucher, start_date) sum_val1
    22  ,      sum(case
    23               when trunc(sysdate-start_date)> 61
    24               and  voucher = 'A'
    25               then value
    26               else 0
    27             end) over (partition by currency, voucher, start_date) sum_val2
    28  from   t;
    CU START_DAT V      VALUE   SUM_VAL1   SUM_VAL2
    GB 12-DEC-09 A       1000          0       1000
    GB 31-MAY-10 A         72        172          0
    GB 31-MAY-10 A        100        172          0
    GB 12-DEC-09 B         72          0          0
    GB 31-MAY-10 B        250          0          0
    LX 12-MAY-10 A         90         90          0
    6 rows selected.

  • Problem in using sum with distinct in case

    Hi all,
    I want to use a sum function with distinct and also with case.
    below is the format i am using.
    Sum( distinct case when a.value='TOOL' then e.value else 0 end)
    This is working but i don't get distinct records.
    SO i tried using in this way
    Sum( case when a.value='TOOL' then distinct e.value else 0 end)
    But I am getting missing expression error.
    Please help me to resolve this issue
    Thanks
    Priya

    STEP -2
    SQL>
    SQL> commit;
    Commit complete.
    SQL> ed
    Wrote file afiedt.buf
      1  Select Sum(Value)
      2  From (
      3          Select Distinct Case when value='TOOL'
      4                               then value
      5                          else
      6                              0
      7                          end Value
      8          From Blah
      9*      )
    SQL> /
                                0
    ERROR at line 6:
    ORA-00932: inconsistent datatypes: expected CHAR got NUMBERRegards.
    Satyaki De.

  • Help on converting query with case into decode

    Hi Can anyone help me to revise my plsql query? Below is a portion og the procedure I am changing to meet Oracle 8i.
    SELECT SUM(NVL(CASE WHEN (weeks='wk1' ) THEN qty END, 0)) wk1,
    SUM(NVL(CASE WHEN (weeks='wk2' ) THEN qty END, 0)) wk2,
    SUM(NVL(CASE WHEN (weeks='wk3' ) THEN qty END, 0)) wk3,
    SUM(NVL(CASE WHEN (weeks='wk4' ) THEN qty END, 0)) wk4
    FROM TABLE1
    Thanks in advance.

    pls try this....(code not tested as no create table etc provided).
    select dt
    from (select decode(is_tbd,
    'yes',
    decode(is_tbd_order,
    'no',
    'tbd',
    decode(sign(ex_fac_date - (v_asofdate + 131)),
    1,
    'tbd',
    null),
    decode(sign(ex_fac_date - (v_asofdate + 131)),
    1,
    'tbd',
    null)),
    null) dt
    from dual
    union all
    select decode(sign(ex_fac_date - (v_asofdate - 1)),
    1,
    decode(sign(ex_fac_date - (v_asofdate + 5)),
    0,
    decode(is_tbd, 'no', 'wk1', null),
    null),
    null)
    from dual
    union all
    select decode(sign(ex_fac_date - (v_asofdate + 6)),
    1,
    decode(sign(ex_fac_date - (v_asofdate + 12)),
    0,
    decode(is_tbd, 'no', 'wk2', null),
    null),
    null)
    from dual
    select decode(sign(ex_fac_date - (v_asofdate + 13)),
    1,
    decode(sign(ex_fac_date - (v_asofdate + 19)),
    0,
    decode(is_tbd, 'no', 'wk3', null),
    null),
    null)
    from dual
    union all
    select decode(sign(ex_fac_date - (v_asofdate - 1)),
    0,
    decode(is_tbd, 'no', 'past_due', null),
    null)
    from dual
    where dt is not null
    Regards

  • How to use XSLT for mapping feild names one by one to array element

    I have a XSLT case to map all the attributes feild name(not value) which has no child to the target, which is array loop.
    I give an sample below.
    source:
    <Items xmlns="http://www.example.org/sample">
    <SourceSystem>SourceSystem2573</SourceSystem>
    <TimeStamp>2010-01-17T20:54:08.234</TimeStamp>
    <Item>
    <ID>2574</ID>
    <Type>2575</Type>
    <Name>2576</Name>
    </Item>
    </Items>
    source XSD like:
         <element name="Items" type="tns:ItemsType"></element>
         <complexType name="ItemsType">
              <sequence>
                   <element name="SourceSystem" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="TimeStamp" type="dateTime" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Item" type="tns:ItemType"
                        maxOccurs="unbounded" minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    <complexType name="ItemType">
              <sequence>
                   <element name="ID" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Type" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    <element name="Name" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    target need to be like:
    <ns1:AttributesCollection>
    <ns1:Attributes>
    <ns1:fieldname>SourceSystem</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>TimeStamp</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>ID</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Type</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Name</ns1:fieldname>
    </ns1:Attributes>
    </ns1:AttributesCollection>
    target XSD:
    <xs:element name="AttributesCollection" type="AttributesCollection"/>
    <xs:complexType name="AttributesCollection">
    <xs:sequence>
    <xs:element name="Attributes" type="Attributes" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Attributes">
    <xs:sequence>
    <xs:element name="fieldname" minOccurs="0">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="100"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    I know we can use local-name() to get the tag/field name,
    but I have not idea how to get these leaf field names one by one and then mapping to every array elements.
    I tried whole day but no successful
    Does anyone have some idea?
    Thanks very much!
    Keith
    Edited by: user1065212 on 17-Jan-2010 22:50
    Edited by: user1065212 on 17-Jan-2010 22:53
    Edited by: user1065212 on 17-Jan-2010 22:59

    can you paste source xsd and the correct xml output, the current one isn't really valid
    <ID>2574</TotalNumOfItems>

  • How to reset drill-down column-chart based on map-chart?

    Hi guys,
    I'm facing pritty common issue while designing one of my dashboards.  Let me describe a little bit  more:
    1. I have some data extracted from BW using Query as WebService into my Xcelsius spreadsheet.
    2. I have map-chart - regions for some country.
    3. I have a drill-down column-chart, which displays data for a selected region.
    At the beginning column-chart displays results for entire country (which, in fact, is not exactly drill-down). The issue I'm fasing is, that in case I select any region and the data is drilled-down into my column-chart, I have no option to show data for the entire county in the column-chart anymore (the only one way is to restart the report).
    Are there any possible way to do this, or am I doing a design error while displaying data, which is not drilled-down, into a chart which is intended to display drill-down data only?
    Any help would be highly appreciated.
    Thanks in advance.
    Ivaylo Mutafchiev
    Varna Business Services
    Project Manager BOBJ

    Ivaylo Mutafchiev,
    I understand your problem now. So your column chart data which is coming from the QAAWS query should be having a prompt which is bound to some cell in excel. and your map might be passing the values for prompt isn't it? in your case the map might be passing a region.
    All you need to do is put the prompt in the web service for region as a optional prompt. Now pull in a check box or a Push button(name it as reset or something.). while binding the data to the check box or push button (source data) bind it to a blank cell. when user clicks on it , it passes a blank vlaue to the region(this is ur input for region) which will inturn makes the prompt optional for the region web service. which should pull all the data for all the region.
    The whole idea lies in somehow passing a blank cell to your  web service whose region prompt is optional.
    Thanks,
    Karthik

  • How to restore a deleted built-in app (Maps)?  App disappeared: IOS 4 & 3GS

    Does anyone know how to restore a deleted built-in app?
    In my case the Maps app disappeared. According to other posts in this forum you cannot delete a built-in app such as Maps but it has happened on my iPhone 3GS.
    I'm running IOS 4.
    Morrow

    If you are unable to locate the Maps app you can still access it from the Spotlight search window. Just type in Maps, look for the familiar interstate 280 icon, tap there and you will enter the Maps app. This will work for you until you can locate the icon, which hopefully you will.

  • MAPPING

    Hi guys,
      plz help me.plz tell me about MESSAGE-MAPPING,JAVA-MAPPING,ABAP-MAPING,XSLT-MAPPING.
    with warm regards.
    vikash

    Hi,
    XI provides 3 standard ways of interface mapping between source and target.
    Graphical mapping
    Java Mapping
    XSLT Mapping
    Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
    ABAP mapping
    XSLT mapping with ABAP Extensions
    Graphical Mapping
    Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
    ABAP Mapping
    A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
    Java Mapping
    Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
    SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
    XSLT Mapping
    One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
    A few example cases in which an XSLT mapping can be used:-
    When the required output is other than XML like Text, Html or XHTML (html displayed as XML)
    When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
    When data is to be filtered based on certain fields (considering File as source)
    When data is to be sorted based on certain field (considering File as source)
    When data is to be grouped based on certain field (considering File as source)\
    Advantages of using XSLT mapping
    XSLT program itself defines its own target structure.
    XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
    XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
    File content conversion at receiver side can be avoided in case of text or html output.
    Multiple occurrences of node within tree (source XML) can be handled easily.
    XSLT can be used in combination with graphical mapping.
    Multi-mapping is also possible using xslt.
    XSLT can be used with ABAP and JAVA Extensions. 
    Disadvantages of using XSLT mapping
    Resultant XML payload can not be viewed in SXMB_MONI if not in XML format (for service packs < SP14).
    Interface mapping testing does not show proper error description. So errors in XSLT programs are difficult to trace in XI but can be easily identified outside XI using browser.
    XSLT mapping requires more memory than mapping classes generated in Java.
    XSLT program become lengthier as source structure fields grows in numbers.
    XSLT program sometimes become complex to meet desired functionality.
    Some XSL functions are dependent on version of browser.
    Reward points if it helps......
    Thanks,
    Madhu

  • Debug ABAP Multi Mapping in a BPM

    Hi Guys,
           My scenario is as follows.
    1) Send IDOCS from SAP.
    2) Loop start
    3) Collect in BPM based on some correlation
    4) append to a multi line container
    5) Loop ends at certain condition
    6) Transform using interface mapping which is in this case ABAP mapping.
    7) Send the merged message
    I am facing a mapping error, but could not figure out what it is, it says
    "Parsing error after mapping: unexpected symbol: '<' (line 0, column 53)"
    My question is how to debug ABAP Mapping when it is BPM.
    Things already done and did not work
    1) HTTP break point does not work as BPM is run by WF-BATCH user and it is not a dialog user, so debug window does not appear when the mapping is running
    2) I cannnot use SXI_MAPPING_TEST transaction as any of BPM cannot be selected on the first screen, without which it does not allow you to debug.
    Please help me how to go into a debugger when my Multi ABAP mapping is executed in the system.
    Thanks in advance,
    Regards
    Sujan

    Hi Sujan,
    Try debugging with this approach if possible.
    1. Unregister your queue from TC SMQR
    2. Execute your scenario
    3. Check the Queue and Debug your LUW by pressing Debug LUW.
    4. Set the breakpoint at your mapping program and test.
    5. After completion Register your queue again.
    Pls see the document more more details.
    https://websmp102.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000582377&
    How -To debug XI Applications
    Hope it helps,
    Regards,
    Satish

  • HTTP- XI- SOAP(webservice) - error in outbound mapping

    Scenario is HTTP(request)->XI->SOAP(webservice) ->XI->HTTP(response)
    2 messsage mappings for request and response (syncronous)
    1 interface mapping
    HTTP payload reaches XI from there it appears problem translating request data to webservice external URL "http://webservices.imacination.com/distance/Distance.jws". 
    Message mappings when tested with sample xml in intergration repository results in success. Meaning source populated data gets copied to target in IR testing (both for request and response).
    Here is the log from SXMB_MONI
    - - - - SystemError synchronous 034E60D2-1D22-6B44-B424-E7A4527B7375 54F73912-E6A9-A741-A815-1F623FC79293 2007-01-23T14:50:58Z - vservice4 mi_inb_ws - vservice4 mi_out mi_out - BestEffort - Application <b>EXCEPTION_DURING_EXECUTE</b> com/sap/xi/tf/_mm_ws_ java.lang.NullPointerException During the application mapping com/sap/xi/tf/_mm_ws_ a <b>java.lang.NullPointerException was thrown</b>: N - - HTTP
    server-protocol HTTP/1.1 user-agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) host <xiapp>:8050 content-length 230 remote-addr 10.20.40.120 <b>COMMIT is expected by application</b> !
    SAP_CENTRAL - - - - R E C E I V E R - D E T E R M I N A T I O N Cache Content is up to date - - - - I N T E R F A C E - D E T E R M I N A T I O N Cache Content is up to date - - - - number of receivers: 1 Single-receiver split case - - - - Interface Mapping urn:
    vmyvendor.org\http2webservice im_ws RuntimeException during appliction Java mapping com/sap/xi/tf/_mm_ws_ java.lang.NullPointerException at com.sap.aii.mappingtool.tf3.AMappingProgram.exceptionCaught$(AMappingProgram.java:59)
    Any pointers would be greatly appreciated. Thanks

    From XML request message->SOAP Header->Trace & using XML spy problem is in <b>CL_XMS_MAIN-CALL_PLSRV</b>. The log also talks about message persist processing, is it valid for sync webservice?
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Trace xmlns:SAP="http://sap.com/xi/XI/Message/30">
    + <Trace level="1" type="B" name="CL_HTTP_PLAIN_INBOUND">
      <Trace level="1" type="T">server-protocol HTTP/1.1</Trace>
      <Trace level="1" type="T">user-agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)</Trace>
      <Trace level="1" type="T">host xiapp:8050</Trace>
      <Trace level="1" type="T">content-length 229</Trace>
      <Trace level="1" type="T">remote-addr 10.20.40.101</Trace>
      </Trace>
      <Trace level="1" type="T">COMMIT is expected by application !</Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-ENTER_XMS" />
    - <!--  ************************************
      -->
      <Trace level="1" type="B" name="CL_XMS_MAIN-SET_START_PIPELINE" />
    - <!--  ************************************
      -->
      <Trace level="1" type="B" name="SXMBCONF-SXMB_GET_XMB_USE" />
      <Trace level="1" type="B" name="CL_XMS_TROUBLESHOOT-ENTER_PLSRV" />
      <Trace level="1" type="T">****************************************************</Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_UC_EXECUTE" />
    - <!--  ************************************
      -->
      <Trace level="1" type="T">Message-GUID = 69CB2C55A02E1048AC67316A17FD109D</Trace>
      <Trace level="1" type="T">PLNAME = CENTRAL</Trace>
      <Trace level="1" type="T">QOS = BE</Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PIPELINE_SYNC" />
    - <!--  ************************************
      -->
      <Trace level="1" type="T">Get definition of external pipeline CENTRAL</Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-LOOKUP_INTERNAL_PL_ID" />
      <Trace level="1" type="T">Corresponding internal pipeline SAP_CENTRAL</Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_LOG_TO_PERSIST" />
    + <Trace level="1" type="B" name="PLSRV_RECEIVER_DETERMINATION">
    - <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV">
    - <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV_LOCAL">
    - <Trace level="1" type="B" name="CL_RD_PLSRV-ENTER_PLSRV">
      <Trace level="1" type="T">R E C E I V E R - D E T E R M I N A T I O N</Trace>
      <Trace level="1" type="T">Cache Content is up to date</Trace>
      </Trace>
      </Trace>
      </Trace>
      </Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_LOG_TO_PERSIST" />
    + <Trace level="1" type="B" name="PLSRV_INTERFACE_DETERMINATION">
    - <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV">
    - <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV_LOCAL">
    - <Trace level="1" type="B" name="CL_ID_PLSRV-ENTER_PLSRV">
      <Trace level="1" type="T">I N T E R F A C E - D E T E R M I N A T I O N</Trace>
      <Trace level="1" type="T">Cache Content is up to date</Trace>
      </Trace>
      </Trace>
      </Trace>
      </Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_LOG_TO_PERSIST" />
    + <Trace level="1" type="B" name="PLSRV_RECEIVER_MESSAGE_SPLIT">
    - <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV">
    - <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV_LOCAL">
    - <Trace level="1" type="B" name="CL_XMS_PLSRV_RECEIVER_SPLIT-ENTER_PLSRV">
      <Trace level="1" type="T">number of receivers: 1</Trace>
      <Trace level="1" type="T">Single-receiver split case</Trace>
      </Trace>
      </Trace>
      </Trace>
      </Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_LOG_TO_PERSIST" />
      <Trace level="1" type="B" name="PLSRV_MAPPING_REQUEST" />
    - <!--  ************************************
      -->
    + <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV">
      <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV_LOCAL" />
    - <!--  ************************************
      -->
      <Trace level="1" type="B" name="CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV" />
    - <!--  ************************************
      -->
      <Trace level="1" type="T">Interface Mapping urn:
    vendor\http2webservice im_ws</Trace>
      <Trace level="1" type="T">RuntimeException during appliction Java mapping com/sap/xi/tf/_mm_ws_</Trace>
      <Trace level="1" type="T">java.lang.NullPointerException at com.sap.aii.mappingtool.tf3.AMappingProgram.exceptionCaught$(AMappingProgram.java:59) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:182) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:149) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0.processFunction(MappingServiceObjectImpl0.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy176.processFunction(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:100) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:157) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)</Trace>
      <Trace level="1" type="T">Runtime exception occurred during execution of application mapping program com/sap/xi/tf/_mm_ws_: java.lang.NullPointerException; null</Trace>
      <Trace level="1" type="T">com.sap.aii.ibrun.server.mapping.MappingRuntimeException: Runtime exception occurred during execution of application mapping program com/sap/xi/tf/_mm_ws_: java.lang.NullPointerException; null at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:73) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0.processFunction(MappingServiceObjectImpl0.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy176.processFunction(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:100) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:157) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Root Cause: java.lang.NullPointerException at com.sap.aii.mappingtool.tf3.AMappingProgram.exceptionCaught$(AMappingProgram.java:59) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:182) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:149) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0.processFunction(MappingServiceObjectImpl0.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy176.processFunction(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:100) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:157) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)</Trace>
      <Trace level="1" type="E">CL_XMS_PLSRV_MAPPING~ENTER_PLSRV</Trace>
      </Trace>
      <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_TO_PERSIST" />
    - <!--  ************************************
      -->
      </SAP:Trace>

  • Mapping - Questions

    Hi,
       I have few basic questions regarding mappings.
       1)  I think we can do everything by using Graphical Mapping. Then what is the purpose for Java, XSLT and ABAP mapping? Please give me an example for this...
       2) Which mapping will give better performance? Is there any comparison document available in SDN?
      Appreciate your help!
    Thanks,
    Vivek

    hi,
    Mapping Techniques
    XI provides 3 standard ways of interface mapping between source and target.
    Graphical mapping
    Java Mapping
    XSLT Mapping
    Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
    ABAP mapping
    XSLT mapping with ABAP Extensions
    Graphical Mapping
    Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
    ABAP Mapping
    A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
    Java Mapping
    Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
    SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
    XSLT Mapping
    One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
    check these links too..
    Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/b78d406b305537e10000000a1550b0/frameset.htm
    For Java Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    For XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    Error handling in XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/8a/7672f7d7e444439fd7024f806221a4/frameset.htm
    You can also refer some How to guides:
    XI New Mapping Features article,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi%203.0%20new%20mapping%20features%20article.evn
    Generic XSLT Mapping and Sample Code,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi%20code%20samples/generic%20xslt%20mapping%20and%20sample%20code.pdf
    How to use ABAP-MApping in XI3.0,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
    Thanks,
    Vijaya.

  • Mapping objects

    hi expects,
    can any body tell me about mapping objects .and what is use of message mapping,java mapping ,xslt mapping,abap mapping.
                                                                             thank you

    Hi Rohit,
      XI provides 3 standard ways of interface mapping between source and target.
         1)Graphical mapping
         2)Java mapping
         3)XSLT mapping
    Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
         1)ABAP mapping
         2)XSLT mapping with ABAP Extensions
          Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception – User defined functions).   But sometimes with graphical mapping it is difficult to produce required output. For example … text/html output, namespace change, sorting or grouping of records etc. A person comfortable with Object Oriented ABAP can go for ABAP mapping instead. One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
    A few example cases in which an XSLT mapping can be used:-
    1)When the required output is other than XML like Text, Html or XHTML (html displayed as XML )
    2)When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
    3)When data is to be filtered based on certain fields (considering File as source)
    4)When data is to be sorted based on certain field (considering File as source)
    5)When data is to be grouped based on certain field (considering File as source)
    >>>Advantages of using XSLT mapping
    1)XSLT program itself defines its own target structure.
    2)XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
    3)XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
    4)File content conversion at receiver side can be avoided in case of text or html output.
    5)Multiple occurrences of node within tree (source XML) can be handled easily.  
    6)XSLT can be used in combination with graphical mapping.
    7)Multi-mapping is also possible using xslt.
    8)XSLT can be used with ABAP and JAVA Extensions.
    >>>Disadvantages of using XSLT mapping
    1)Resultant XML payload can not be viewed in SXMB_MONI if not in XML format (for service packs < SP14).
    2)Interface mapping testing does not show proper error description. So errors in XSLT programs are difficult to trace in XI but can be easily identified outside XI using browser.
    3)XSLT mapping requires more memory than mapping classes generated in Java.
    4)XSLT program become lengthier as source structure fields grows in numbers.
    5)XSLT program sometimes become complex to meet desired functionality.
    6)Some XSL functions are dependent on version of browser.
    Regards,
    Prasanthi.

Maybe you are looking for