cancel
Showing results for 
Search instead for 
Did you mean: 

Complex Mapping - Reset context

Romerito
Explorer
0 Kudos

Hi everybody,

I have to transform one scenary RFC to FILE, but I had many problems becouse the contexts level of each structures is very different.

In my RFC I have two tables, T_HEADER and T_ITEM like:

1- RFC

1.1- T_HEADER

1.2-T_ITEM

and in my FILE I have:

1-FILE

1.1-Recordset (occor 1 to many)

1.1.1-T_HEADER (occor 1 to 1)

1.1.2-T_ITEM (occor 1 to many)

For each T_HEADER (on RFC) I need one other Recordset (on FILE). And for each T_ITEM (on RFC) I need one other T_ITEM (on FILE) comparing the key field on T_HEADER. In other words I need to group the recordsets by the key founded in both structures, using the header structure as the main structure.

I need samething like this:

RFC-T_HEADER

Key = 1, 2 and 3.

RFC-T_ITEM

Key = 1, 2, 1, 3, 3

Result:

FILE-Recordset

FILE-Recordset-T_HEADER

Key = 1

FILE-Recordset-T_ITEM

Key = 1, 1

FILE-Recordset

FILE-Recordset-T_HEADER

Key = 3

FILE-Recordset-T_ITEM

Key = 3, 3

FILE-Recordset

FILE-Recordset-T_HEADER

Key = 2

FILE-Recordset-T_ITEM

Key = 2

Do you have many ideas to help me?

Accepted Solutions (0)

Answers (3)

Answers (3)

Romerito
Explorer
0 Kudos

Hi everybody, I found the solution.

I need use an UDF that I call "changeQueue".

If anyone will have the same problem, you can use this UDF:


->Vnode - String (Context item with the values to check the key and add in diferent queue)
->Knode - String (Context header with the key values used to define the queue where the item will be add)
->Nnode - String (Context item with the key values to check and add into queue of context header)
<-result - ResultList (Vnode context into the diferent queue)
 
 
for(int i=0; i < Knode.length; i++){
 
	if(Knode<i>.equals(ResultList.CC))
		result.addContextChange();
	else{
 
		for(int j=0; j < Nnode.length; j++){
 
			if(Nnode[j] == Knode<i>){
				result.addValue(Vnode[j]);
			}
		}
 
	}
}

nabendu_sen
Active Contributor
0 Kudos

Hi,

Create 'T_Header' and 'Key of File like below:

T_Header(RFC)----> removeContext -


> sort -


> SplitByValue (Value Changed) -


> T_Header (File)

-


Same----


> Key (File)

T_Item(RFC)----> removeContext -


> sort -


> SplitByValue (Value Changed) -


> T_Item (File)

It should work.

Thanks,

Nabendu.

Edited by: Nabendu Sen on Nov 29, 2010 11:57 PM

stefan_grube
Active Contributor
0 Kudos

I recommedn to change the code inside the RFC, so that header and items come sorted.

If the come sorted, you can easily align the items to header with

item_key - removeContexts - Splitbyvalue(value changed) -

If it is not sorted, you have to write complex UDFs. With help of Java class Vector you can align heade and items.

Find exaples for use of Vector class with google.