Query on context change

Hi,
i am getting small problem in the context change..
i have input as
1
2
3
[3]context change
4
5
[5]conext change
6
7
8
[8]context change
i want out put as
2
3
[3]conext change
5
[5]context change
7
8
[8]context change
my requirement is the element after context change in the input sholud be deleted.
Thank you,
Madhav.

Hi Madhav,
Try This
for(int i=0;i<a.length;i++)
if(a<i>.equals(ResultList.CC))
result.addValue(ResultList.CC);
i++ ;
else
result.addValue(a<i>);
"if(a.equals(ResultList.CC))" it should be a(i) but in rect bracket ,Dont know why it is not showing the same in above code
Thanks
Sunil Singh
Edited by: SUNIL SINGH on Nov 19, 2008 5:57 AM
Edited by: SUNIL SINGH on Nov 19, 2008 5:59 AM

Similar Messages

  • Mapping query for context change without UDF

    Hi,
    My requirement is as below:
    Input queues are
    4319, 4319,4320,4321,4321
    M1,M1,M1,M2,M2,M2
    Required output is
    4319,4320,CC,4321
    COntext change is to be inserted when there is a change in value in second queue.
    regards, Anirudh.

    Hi,
    Have you tried using the formatByExample as specified?
    input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> substring (2..6) --> formatByExample (1) --> Target
    input2-->removeContext--> /
    input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> substring (0..2) --> splitByValue:ValueChanged -->formatByExample (2)
    input2-->removeContext--> /
    code explanation
    input1 and input 2 when concatted outputs M12319,M12319,M12320,M22321,M22321,M22321
    The upper part of the code does this: M12319,M12320,M22321, when you use the substring it outputs now 2319,2320,2321
    The lower part of the code does this: M12319,M12320,M22321, when you use the substring it outputs
    M1,M1,M2, then you use splitByValue. The output is now M1,M1,CC,M2.
    When you input the code from the upper part and lower part into a formatByExample node, the output becomes
    2319,2320,CC,2321
    Hope this helps,

  • Error message: "Querying or saving changes to the database failed."

    Hi all,
    I can sense I'm becoming a regular on this particular forum - the problem of spending 8 hours a day trying to get this software working!
    _*The problem*_
    When i try and setup a new device, or modify an existing one, I get an error message when i get to the Transcode Settings page. The error message is "Querying or saving changes to the database failed." After this I get a blank screen and can no longer see my settings.
    No amount of restarting has fixed this. And I cannot see a way to create a device through the client software and add transcode settings.
    Help?
    Thanks in advance,
    Ben

    Ah very good!
    Ok - it seems then that this works absolutely fine as a work around. I can create a device and then assign the device to transcode settings through the client adminsitration panel (which is indeed what I meant).
    So, there is a work around. Far less pressing now, but I would like to know why I'm getting the error message all the same - I'm now concerned about the integrity of the database...
    Thanks Tony!
    B

  • Context change by DOM parsing Java Mapping in XI

    Hi Team,
    I would like to know that how can I handle Context Change by DOM Parser Java Mapping in XI.?
    Suppose  the source XML structure I have like below:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Header xmlns:ns0="urn:bp:xi:hr:edm:test:100">
       <FileName>
          <filesub>
             <subname>a</subname>
             <subname>b</subname>
             <subname>c</subname>
          </filesub>
       </FileName>
       <FileName>
          <filesub>
             <subname>d</subname>
             <subname>e</subname>
             <subname>f</subname>
          </filesub>
       </FileName>
    </ns0:Header>
    Where the field FileName can occur maximum thrice(0...3) but the subname field is (0....unbounded) but in the target source I would like to have as given below:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <MT_Test4 xmlns="urn:bp:xi:hr:edm:test:100">
    - <Header>
      <FileName>a</FileName>
      <FileName1>d</FileName1>
        </Header>
    - <Header>
      <FileName>b</FileName>
      <FileName1>e</FileName1>
       </Header>
    Header>
      <FileName>c</FileName>
      <FileName1>f</FileName1>
       </Header>
    </MT_Test4>
    That means the first value from every context of the source field is forming my first and second value in my target first context.Thensecond value from every context is forming my 1st and 2nd value of my target 2nd context and finally 3rd value of every context is forming my 1st and 2nd value of my target 3rd context.Is this possible to done through DOM parsing or we have to do it by UDF only?

    Hi Atanu,
        In my last post I gave an alogorithm to solve the mapping problem. Here is the complete program for the mapping.
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class DOMParser1  implements StreamTransformation{
         public void execute(InputStream in, OutputStream out)
                   throws StreamTransformationException {
              try
                   DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
                   DocumentBuilder builderel=factory.newDocumentBuilder();
                   /input document in form of XML/
                   Document docIn=builderel.parse(in);
                   /document after parsing/
                   Document docOut=builderel.newDocument();
                   TransformerFactory tf=TransformerFactory.newInstance();
                   Transformer transform=tf.newTransformer();
                   Element root,child,child1=null;
                   Node textChild;
                   NodeList l;
                   int i,n1,j,div,k;
                   String s[];
                   root=docOut.createElement("MT_Test4");
                   root.setAttribute("xmlns","urn:bp:xi:hr:edm:test:100");
                   l=docIn.getElementsByTagName("subname");
                   n1=l.getLength();
                   s=new String[n1];
                   for(i=0;i<n1;++i)
                             s<i>=l.item(i).getFirstChild().getNodeValue();
                   l=docIn.getElementsByTagName("filesub");
                   div=l.getLength();
                   j=n1/div;
                   for(i=0,k=0;i<j;++i)
                        child1=docOut.createElement("Header");
                        root.appendChild(child1);
                        child=docOut.createElement("FileName");
                        textChild=docOut.createTextNode(s[k]);
                        child.appendChild(textChild);
                        child1.appendChild(child);
                        child=docOut.createElement("FileName1");
                        textChild=docOut.createTextNode(s [ k + j ]);
                        child.appendChild(textChild);
                        child1.appendChild(child);
                        ++k;
                   docOut.appendChild(root);
                   transform.transform(new DOMSource(docOut), new StreamResult(out));     
              catch(Exception e)
                   e.printStackTrace();
         public void setParameter(Map arg0) {
         public static void main(String[] args) {
              try{
                   DOMParser1 genFormat=new DOMParser1();
                   FileInputStream in=new FileInputStream("C:/Apps/my dw/sdnq/apps.xml");
                   FileOutputStream out=new FileOutputStream("C:/Apps/my dw/sdnq/tgt1.xml");
                   genFormat.execute(in,out);
              catch(Exception e)
                   e.printStackTrace();
    source ->  apps.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:Header xmlns:ns0="urn:bp:xi:hr:edm:test:100">
    - <FileName>
    - <filesub>
      <subname>a</subname>
      <subname>b</subname>
      <subname>c</subname>
      </filesub>
      </FileName>
    - <FileName>
    - <filesub>
      <subname>d</subname>
      <subname>e</subname>
      <subname>f</subname>
      </filesub>
      </FileName>
      </ns0:Header>
    target structure ->  tgt1.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    - <MT_Test4 xmlns="urn:bp:xi:hr:edm:test:100">
    - <Header>
      <FileName>a</FileName>
      <FileName1>d</FileName1>
      </Header>
    - <Header>
      <FileName>b</FileName>
      <FileName1>e</FileName1>
      </Header>
    - <Header>
      <FileName>c</FileName>
      <FileName1>f</FileName1>
      </Header>
      </MT_Test4>
    Hope this helps
    one more thing  in this line "textChild=docOut.createTextNode(s k + j );"   somehow the the third braces one opening  before k and one closing after j is missing for unknown reasons. Please correct it when you actually run this code.
    regards
    Anupam
    Edited by: anupamsap on Mar 7, 2011 12:47 PM

  • Context change explicitly

    How to apply context change explicitly?

    Hi,
    Refer the section context handling page No 19: Explicit Context selection.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b
    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
    Also u can achieve it by writing the code in UDF.Already provided by experts
    Thnx
    Chirag

  • Context changes

    wat is context and how it changes?

    Hi,
      Assume u have message type as follows.
    i.e MTO_Sample-
           -Data1
              - filed1
              - filed2
              - filed3
          -Data2
              - filed1
              - filed2
              -filed3
        -Data N
              - filed1
              - filed2
             - filed3
    where Data1, Data2 and Date3 are context..
    assume u have Data1 with 2 records, then start of second record nothing but context change.
    please chk the following link.
    http://help.sap.com/saphelp_nw04s/helpdata/en/48/444941db42f423e10000000a155106/frameset.htm
    /people/yukai.shi/blog/2006/06/02/b2b-mapping-techniques-using-the-graphical-mapping-tool
    /people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi
    regards
    mahesh.

  • Context Changes got impact on what?

    Context Changes got impact on what?.

    Hi Ash,
    Context changes have impact on:
    &#56256;&#56452; User-Defined Functions
    &#56256;&#56452; Breaking and inserting of hierarchy levels
    For more see below PPT of SAP:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd</a>
    Regards,
    Subhasha Ranjan

  • Context change

    Hi,
    what is context change?? where it is implemented?
    thanks in advance.

    Hi!
    Context changes take place in Message Mapping when the source structure is processed. for more details about mapping and context change see sap online help - e.g. here http://help.sap.com/saphelp_nwpi71/helpdata/en/49/1ebc6111ea2f45a9946c702b685299/content.htm
    Regards,
    Volker
    Additionally:
    More detailed information about contexts and context changes see here: http://help.sap.com/saphelp_nwpi71/helpdata/en/3d/24e15bf9d79243b45d49b13b03de8f/content.htm
    Edited by: Volker Kolberg on May 25, 2009 10:10 AM

  • User changes in tab strip ui element are not recorded in context change log

    Hi All,
    We are using a tab strip ui element in webdynpro component. But user changes inside tab strip ui element are not getting recorded to the context change log. I have an input field on the same view besides  tab strip ui element. User changes to this input field are getting recorded to the context change log.
    Is there any restriction on context change log usage with tab strip ui element?
    Could you please suggest If there is any way to record changes inside tab strip ui element.
    Thanks,
    Sudheer.

    I think there are some limitations exists, context change logs are not complete when you do value help , i am not sure about tab strip.
    [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a8e5d273b12fe2e10000000a42189d/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a8e5d273b12fe2e10000000a42189d/content.htm]

  • How I check in group by query the group change

    How I check in group by query the group change
    Hi master
    Sir I have master detail table
    This is my query
    select rownum,chartofacc.accid,title,nvl(drbal,0),nvl(crbal,0),
    (select case when nvl(sum(debit),0)-nvl(sum(credit),0)>0 then
    nvl(sum(debit),0)-nvl(sum(credit),0)
    else
    0
    end mfadrttt
    from voudetail where voudetail.accid=chartofacc.accid) as mfadr,
    (select case when nvl(sum(credit),0)-nvl(sum(debit),0)>0 then
    nvl(sum(credit),0)-nvl(sum(debit),0)
    else
    0
    end mfacrttt
    from voudetail where voudetail.accid=chartofacc.accid) as mfacr
    ,nvl(debit,0),nvl(credit,0),voumaster.entdate,voumaster.vno from chartofacc ,accbal,voudetail,voumaster where chartofacc.accid=accbal.accid(+) and chartofacc.accid=voudetail.accid(+) and voumaster.vno=voudetail.vno order by chartofacc.accid,voumaster.entdate,voudetail.VNO;
    Sir I need add opbal from master section to debit in detail section when new group start only after adding I use that column for accumulative total or running balance
    If I get any method when group change system give me any key or indication then I use
    Please give me idea in both field oracle sql and oracle report 6i
    Thank
    aamir

    Hi,
    Please send tables structures and sample data from that tables. And, of course what should be the output. :) Just sending your query won't help us to find a solution.
    Peter D.

  • Add a context change after a set of values in a context

    Dear experts,
    My requirement is as follows:
    Scenario: Idoc to Idoc. I need to check if there are line items > 5- I need to do a split. The split is happening properly via my mapping but I have a problem at the header record level on the target- I do not get the values populated correctly. I need to add a context change after 5 values in the queue.
    eg:
    Say there are 2 Idocs at the source with following unique IDs: called Journal ID:
    My source:
    Idoc 1: Journal ID 123
    Line Itme 1
    Line Item 2
    Idoc 2: Journal ID 124
    Line item 1
    Line item 2
    Line item 3
    Line item 4
    Line item 5
    Line item 6
    Line item 7
    So I need to get total of three Idocs in my target:
    Idoc 1: Journal Entry 123
    Line Item 1
    Line Item 2
    Idoc2: Journal Entry 124
    Line item 1
    Line item 2
    Line item 3
    Line item 4
    Line item 5
    Idoc3: Journal entry 124
    Line item 6(new 1)
    Line item 7(new 2)
    The split in the target Idoc is working perfectly. But inside the header record the journal ID field(taken from Item record level) is not populating correctly. I am getting this output:
    Idoc 1: Journal Entry 123
    Header Record-->JournalID Field value= '123'
    Line Item 1
    Line Item 2
    Idoc2: Journal Entry 124
    Header Record-->JournalID Field value= '124'
    Line item 1
    Line item 2
    Line item 3
    Line item 4
    Line item 5
    Idoc3: Journal entry 124
    Header Record-->JournalID Field value= Null
    Line item 6(new 1)
    Line item 7(new 2)
    So please suggest a UDF/standard function to populate the right values inside header record--->Journal ID field.Something like the below...
    public void calculate(String[] var1, ResultList result, Container container) throws StreamTransformationException{
      for ( int i = 0; i < var1.length; i++ )
         if( var1[i].length() > 5) //here var1 I am passing the Journal ID
           result.addContextChange();
    Apparently this doesnt work.

    The first Idoc has two line items and the second idoc has 7 line items. As the split is per 5 line item- the target has 3 Idocs.
    Now the problem is that the header value in the target: REF_DOC_NO has to be created as per the number of line items and doesnt come from header record directly.

  • Transport of Query successful, but changes not appeared in the report

    Hi All,
    I have 2 Queries(Normal and Total stock reports on the same InfoProvider) in Prd.
    For that User asked me to add one characteristic to Free characteristics.
    I added one characteristic in Free Characteristics to both Queries in Dev and i collected the Transport requests for both the queries in RSA1->TRANSPORT CONNECTIONS and gave it to basis guy, he transported successfully to PRD and for both the reports the changes reflected in the
    query designer, while executed the Normal stock report the characteristic added in free characteristics appeared and while drill down the data is coming, but for the Total stock report the changes appeared in Query designer but on executing the report even  the characteristic added to Freecharacteristics is not appearing in Navigation Pane.
    Also with the same technical name of total stock report there are 2 reports appearing in query designer. what to do now.
    Help me here asap..
    Thanks,
    Chaitu.
    Edited by: chaithu218 on Jun 21, 2011 10:37 AM
    Edited by: chaithu218 on Jun 21, 2011 10:40 AM

    Hi Chaithu,
    As you mentioned that you can see 2 versions by the same technical name in designer for total stock report, it is highly probable that the query you are changing and the query you are executing are different.
    2 versions of a query can exist with the same technical name as the system identifies the queries by their UIDs, which would be different for both these versions of queries.Following are the things you need to check:
    1) In development system too, do you have 2 versions?
    2) In production system, check the UID for both verions of the query
    3) In Dev system, make sure you modify the query with UID which is being executed, if it is available there. Else, you need to replace the query in prod with the one you have in Dev system.
    2 versions by same technical name can exist if:
    1) Someone created a query directly in Prod, and transported a query by same technical name from Dev system
    2) or due to system refresh, copy, etc.
    Hope it helps.
    Thanks,
    Abhishek.

  • Where can i find RSRT query propertis Last changed by user details

    HI All,
    Some one has changed the RSRT qurery properties and we want to know Where can i find RSRT query propertis Last changed by user details.
    thanks in advance.

    Hello,
    Please check the screen shot
    In the Query Designer, General Tab Page showing the details as required at your end.
    Regards
    NS

  • Message Mapping - Initialize counter every context change

    Hi all,
    is there any way to develop a counter customer function in a graphical message mapping so every context change of a field the counter initializes?
    Imagine i have the following structure:
    1 DATA
    1.1 DETAIL
    1.2 DETAIL
    2 DATA
    2.1 DETAIL
    2.2 DETAIL
    and i wanna count DETAIL fields but initialize the counter every DATA field. Is there any way to do it?
    Thanks a lot.

    Hi,
    If your Source structure is
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_DATA xmlns:ns0="http://yash.com.YH1309">
       <DATA>
          <DETAIL/>
          <DETAIL/>
       </DATA>
       <DATA>
          <DETAIL/>
          <DETAIL/>
          <DETAIL/>
       </DATA>
    </ns0:MT_DATA>
    and You want the Target as
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_DATA xmlns:ns0="http://yash.com.YH1309">
       <DATA>
          <DETAIL>COUNTER=1</DETAIL>
          <DETAIL>COUNTER=2</DETAIL>
       </DATA>
       <DATA>
          <DETAIL>COUNTER=1</DETAIL>
          <DETAIL>COUNTER=2</DETAIL>
          <DETAIL>COUNTER=3</DETAIL>
       </DATA>
    </ns0:MT_DATA>
    Create the below UDF with one argument (DETAIL)  and select Execution type all values of a Context
    for (int i =1;i<=DETAIL.length;i++)
    result.addValue("COUNTER=" + i);
    but if you want Your Target as
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_DATA xmlns:ns0="http://yash.com.YH1309">
       <DATA>
          <DETAIL>1</DETAIL>
          <DETAIL>2</DETAIL>
       </DATA>
       <DATA>
          <DETAIL>1</DETAIL>
          <DETAIL>2</DETAIL>
          <DETAIL>3</DETAIL>
       </DATA>
    </ns0:MT_DATA>
    So please Follow abhishek salvi's reply

  • Context Change & Explicit Context Change

    Hi
           i need some info about Context Change and Context Handling, explisit context change how can we r defineing
    Thanks&Regards
    rajashekar

    Hi Raja,
    Please refer these:
    http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
    Pages 62-74
    http://www.riyaz.net/blog/index.php/2007/12/08/xipi-introduction-to-context-handling-in-message-mapping/
    http://help.sap.com/saphelp_nw70/helpdata/en/bd/ca1105c81c6742a0f8c8d49f8834bf/frameset.htm
    Refer section: Structure Mapping by Setting the Context
    Thanks ,
    Shweta

Maybe you are looking for