cancel
Showing results for 
Search instead for 
Did you mean: 

Collapse Context

prabhu_s2
Active Contributor
0 Kudos

Hi

I'd read couple of doc's on collapse context but not much clear. Could anyone let me know why need collapse context.

I'd checked on help.sap. Pls no links.

thkx

Prabhu

Accepted Solutions (0)

Answers (2)

Answers (2)

prabhu_s2
Active Contributor
0 Kudos

thkx raj.

justin_santhanam
Active Contributor
0 Kudos

Most welcome, does the above example makes sense prabhu!!

Best regards,

raj.

prabhu_s2
Active Contributor
0 Kudos

def yes raj

Former Member
0 Kudos

Hi

Try this

refer here /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

Using collapseContexts() puts the first values of all contexts into a context. Empty contexts are replaced with an empty string

http://help.sap.com/saphelp_nw04/helpdata/en/58/cd834014d26f1de10000000a1550b0/content.htm

You use removeContexts() to delete all the top contexts for an element. This removes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue

http://help.sap.com/saphelp_nw04/helpdata/en/9d/308c4024d26e1de10000000a1550b0/content.htm

Thanks

prabhu_s2
Active Contributor
0 Kudos

thkx sridar. i did check on those link but maybe i'm not clear with the explanation given there? i'm looking for a kind of a simple mapping scenario on how it is useful and how it differs from removecontext

justin_santhanam
Active Contributor
0 Kudos

Prabhu,

In this thread go to page 2 and see my reply. I gave the soln with Collapse context with results too. Have a look.

Best regards,

raj.

prabhu_s2
Active Contributor
0 Kudos

thkx raj. i did see over the image on collapse context but could figure out how it works and the result of collapse context in a queue

Former Member
0 Kudos

Hi Prabhu..

Go through this its give along with an example..

http://help.sap.com/saphelp_nw70/helpdata/en/79/2835b7848c458bb42cf8de0bcc1ace/frameset.htm

vasanth

justin_santhanam
Active Contributor
0 Kudos

Prabhu,

Did u got the logic from the above example or u want me to explain.

Best regards,

raj.

Former Member
0 Kudos

Hi

Below is only Difference between Remove Context and Collapse Context

XML File Input:

?xml version="1.0"

encoding="UTF-8" ?>

<Test_Out_Remove>

<header name=“A">

<item>A.one</item>

<item>A.two</item>

<item>A.three</item>

</header>

<header name="B">

<item>B.one</item>

<item>B.two</item>

</header>

</Test_Out_Remove>

After Using Remove Context Output:

<?xml version="1.0"

encoding="UTF-8" ?>

<Test_In_Remove>

<item>A.one</item>

<item>A.two</item>

<item>A.three</item>

<item>B.one</item>

<item>B.two</item>

</Test_In_Remove

Cpllapse Context

xml instances ( pARSE ---> ) tAG

Item(1,2,3,4,5,6)

Using

&#8595;Collapse Context

Tag (Result Tag and Item see side)

Item ( no values)

Above XML file after parser for Tag and Item number,After That Using Collapse Context It Gives The result like Tag as it is and Item as a Empty value.

Might be useful

Message was edited by:

sridhar bommireddy

Message was edited by:

sridhar bommireddy

prabhu_s2
Active Contributor
0 Kudos

yes sure with a simple example.

justin_santhanam
Active Contributor
0 Kudos

Prabhu,

Consider my source structure looks like

<EmployerInfo>

---<Location>

-


<Region>Trichy</Region>

-


<Region>Bangalore</Region>

-


<Region>Madurai</Region>

---</Location>

</EmployerInfo>

<EmployerInfo>

---<Location>

-


<Region>Andhra</Region>

-


<Region>Delhi</Region>

-


<Region>Mumbai</Region>

---</Location>

</EmployerInfo>

In my target structure I want only the first region for each employerinfo.

So what happens if you give Region->CollapseContext->SplitByValue--->Region

Then u will get the target structure as

<EmployerOrg>

-


<Region>Trichy</Region>

</EmployerOrg>

<EmployerOrg>

-


<Region>Andhra</Region>

The purpose of CollapseContext is to take the first value from the queue in the same context level.

Trichy

Bangalore

Madurai

<b>[Context Change]</b>

Andhra

Delhi

Mumbai

Results after collapse context

Trichy

<b>[ContextChange]</b> ---Bcoz I gave SplitByValue.

Andhra

I hope it clears a bit!!!

Best regards,

raj.