cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Context Changes

Former Member
0 Kudos

Hi,

**********

Please read the Forum's Rules of Engagement,

i.e.,

[/thread/117188 [original link is broken];

i.e.,

-


"Step 1: Finding An Answer

Rule number one: Try to find the answer first. There are tons of resources out there, show that you have tried to find the answer. A question that shows that the person is willing to try and help themselves is more likely to be answered than one which simply demands information. Tell us what you have done to try and solve the problem yourself - often we can learn from that too!

Obviously you should check SAP's online help, and if you have not looked for SAP Notes you should make the readers aware of this. Many SDNers are very helpful and will even search for SAP Notes for you if you don't have that possibility yourself, but many will assume that you have already searched for SAP Notes.

Search the forums, the articles, the blog posts and the Frequently Asked Questions (FAQ) in the Wiki for your topic.

Step 2: Asking Your Question

Once you have verified that no resources are available for solving your problem, ask your question. Do the following:

- Use a Good Subject Line

The subject header is your golden opportunity to attract qualified experts' attention in around 50 characters or less. Don't waste it on babble like "Workflow question". We all have busy jobs, often we just skim through the list headings and read those that interest us. Also, DO NOT reply to an unrelated post to ask a different question. This confuses those reading the thread and may lose people that would be interested in your question. Always start a new topic with a new mail.

Bad subject: Urgent problem with workflow

Good subject: Error after transport: "Inconsistent workflow definition"

Do not use words in capital letters and any of the words: urgent, quickly, burning, etc in your message. Especially not in the title! This just irritates and does not help you get to your goal. From our side, we definitely do not answer faster when we see these words.

The same goes for such things as ??? or !!! in appends. In the English language one ? or ! is sufficient to terminate a sentence.

- Only One Question Per Posting

For each question that you have, make a separate posting. Don't ask multiple questions in one posting, this is confusing for people and might not get answered, since the subject line does not reflect all your problems. If a new and unrelated question comes up during a thread, start a new thread.

- Provide Enough Information."

----


SDN PI/XI Forum Moderator

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2171] [original link is broken] [original link is broken] [original link is broken];

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2792] [original link is broken] [original link is broken] [original link is broken];

Thanks,

Kiran.

Former Member
0 Kudos

Hey,

these are the node functions that handles context.

1. remove context:

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.

Advanced user-defined functions can import either just one context into the input arrays, or complete queues. Make your selection by selecting or deselecting the Save Entire Queue in Cache checkbox in the function editor.

2. split by value:

The SplitByValue() function is the counterpart to removeContexts(): Instead of deleting a context, you can insert a context change in the source value queue. You then receive this element for each inserted context change instead of a top node element. However, for this to be possible, the top node source field must be assigned a top node target field and minOccurs must be >0. You can insert a context change in the queue after each value, after each change to the value, or after each tag without a value.

3. collapse context:

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

This can be useful if an upper-level node is to be created each time a lower-level node exists, for example. The function is useful in combination with the SplitByValue function.

Example:

removeContext:

We use remove context to remove the context of a queue

A ->removeContext-> A

B B

C C

here each line under an alphabet denotes context change.

One thing about context change is it will not show you null values coming in input.

A ->removeContext-> A

C

C

in above example -- represents only context change no value in this place(null).

Collapscontext :

It works very much same way of removecontext but it also considers null values and gives [] for null values (if Context of Field is on its Preceeding parent otherwice it will work as remove context)

A ->CollapsContext-> A

[] (Blank value)

C C

One more chane is if there are multiple values in a context then it will only select first value from that queue

A ->CollapsContext-> A

D B

B C

C

As you can see in above example A & D falls under one context hence D is Removed

Split ByValue :

Used to Chnage the Context of Input

it has three options in it

1)each value

2)value change

3)emptyValue

The link given by Rohit is Self Explanatry for this .

FormateByExample :

it changes the Context of input1 as per the Context of Second input but the number of values in both the input must be same .

eg.

Input1 Input2 ->FormateByExample-> Out

A P A

B Q B

C R C

ou can also refer to this blog.

Message context change.

reward points if useful.

regards,

Milan

Former Member
0 Kudos

Hi,

Context Changes you need to do to get all the nodes of all occerences.

EX:

SOURCE

<GS> -


0-unbound

<ST> -


1-unbound

<name/> 0-1

</ST>

</GS>

Here if you set context to name if you duplicate st node it wont take all the names in 2 occurences it will take only first occurence name.

If you set Context to ST it will the all the names in all the occurences of ST segments.

It is the main concept of Context Change.

Reward points if neeedful.

Thanks,

RamuV

Former Member
0 Kudos

Hi,

Context Handling

Context handling you use when you want to group elements in different node from source into the single node of target with multiple occrance of element( remove context) and if you want to do rever of it the use function split by value .

For more details refer following blog

Refer

SAP Network Blog: Introduction to Context Handling in Message Mapping

/people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping

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

SAP Exchange Infrastructure: Mapping Patterns - Understand Context Handling in Message Mapping - Webinar Powerpoint

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f...

Thanks

swarup