on 01-05-2007 7:26 PM
My Source has tructure like this
Source 1..unbounded
stCode
product
cost
expDate
Target 1:unbounded
Division
product
cost
expDate
Basically I need to get Divisions for the given state Code. For each Division I should repeat target structure.
for example if Source has structure (<b>WA</b>,123,12.20,12/12/2006) I should create 4 target structures like ( <b>(001</b>,123,12,20,12/12/2006), (<b>002</b>,123,12,20,12/12/2006), (<b>003</b>,123,12,20,12/12/2006), (<b>004</b>,123,12,20,12/12/2006) )
Is these any standard function to achive this? Or do I have to write advanced user defined function? If UDF can you please explain how to achive this ?. Thanks a bunch in advance.
<i>Basically I need to get Divisions for the given state Code. For each Division I should repeat target structure</i>.
>>>Is it for each statecode , you need to create multiple target structures or how?
How you will get know, how many divisons are there in the source side ?If your Statecode is able to provide this details, then , it is easy with java mapping
But you can try out with user defined functions also. But need to know, is it for each Statecode or based on statecode value etc..
hope this gives some hints
rdgs,
Moorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Krishna Moorthy, thanks for quick response. I need to code in UDF as I know for each state there are fixed number of divisions. So StateCode will be input to UDF and should return multiple divisions.
I have to use advanced UDF right ?. So for the given state code I get multiple divisions out of the UDF. I have to use Context or Queues ?..Will you please guide me steps I need to take within UDF and after UDF returns values ?
SO it is predetermined, that, for each state code, that many divisions. So you need to hardcode these values in the user defined like AB =4 , BC =5 etc...
So as per the given state code , you need to generate that many target structure right ?
yes, you need to use advanced UDF. to simplify, write a logic to get one target for each one records. Once you do this, then extend this logic with division no.s with condition
rgds,
Moorthy
I'm still having probelm.. Again
Source 1..unbounded
stCode 0..1
product 0..1
cost 0..1
expDate 0..1
Target 1:unbounded
Division 0..1
product 0..1
cost 0.1
expDate 0..1
UDF( Convert) takes StCode as Input and returns variable number of Divisions.
My Mapping as follows:
StCode -
> (Convert) -
> Target
StCode------> (Convert) -
> Division
product -
> Product
cost -
> cost
expDate -
> expDate
With the above mapping Target structure does not have the number of Divisions returned from UDF. It has only 1 node genrated.
I looked at DisplayQueue for Target Node and Division there are many divisions with context change. My Target Structure should look like 4 nodes as (001,123,12,20,12/12/2006), (002,123,12,20,12/12/2006), (003,123,12,20,12/12/2006), (004,123,12,20,12/12/2006)
WHat I'm doing wrong?. Can someone please explain ?
Hi,
Your target node Division has an occurence of 0..1.
Therefore you can have a maximum of 1 node created in the target.
Even if the queue shows the correct values, the target node that can be created is only one, and the remaining 3 values in the queue are ignored.
You could change the occurence of the target field 'Division' to 0..unb and you will get the expected result.
Regards,
Smitha.
Hi Smitha,
Target Node is 1..unbounded
Within this structure Individual fields are 0..1
Is it wrong ?
Please look at earlier message in this posting how I need my target structure.
If mys source is
<b>WA</b>,123,12.20,12/12/2006)
I should create 4 target structures like ( (<b>001</b>,123,12,20,12/12/2006), (<b>002</b>,123,12,20,12/12/2006), (<b>003</b>,123,12,20,12/12/2006), (<b>004</b>,123,12,20,12/12/2006) )
With UDF I will derive values of Divisons in target structure for the given StCode
I'm sorry would you please eloborate on using splitbyvalue. I really need help here.
I used this mapping but no use.. stil lsame result..
StCode -
> (Convert) -
>Splitbyvalue----> Target
StCode------> (Convert) -
> Division
product -
> Product
cost -
> cost
expDate -
> expDate
Message was edited by:
Ram Krish
Hi Ram,
SplitByValue function is used to create a parent for every Division element.
You could use this after the UDF that you have created for the Division node.
SDivision>UDF->SplitByValue--->TDivision.
I donot have access to the repository now, to try this out.
You could refer this link for more information on SplitByValue:
<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/content.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/content.htm</a>
Regards,
Smitha.
Hi,
I am not sure what the convert UDF that you have mapped to the Target node is doing. In any case, it should be returning 4 Target elements. Is it doing that?
The logic for the UDF for 'Target' element must have the following logic:
Take st code as input, determine the number of Divisions there need to be. In this case, I assume 4.
So, write a code, to generate 4 different 'Target' elements using addContextChange() function in the UDF.
Only when there are 4 'Target' elements created, 4 'Division' nodes will be created under them, with the help of SplitByValue function.
This might help you write the code:<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/b1/83a09f668320419dbe00a741e0fe6a/content.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/b1/83a09f668320419dbe00a741e0fe6a/content.htm</a>
Hope this is clear.
Regards,
Smitha.
Hi. I'm already doing that. Please see this mapping
StCode -
> (Convert) -
> Target <i>// This is Node .. I mean to generate as many Target Nodes as Convert UDF returns // </i>
StCode------> (Convert) -
> Division <i>// Same UDF ..see stCode --> Target Mapping //</i>
product -
> Product <i> // Product should be same for all occurances of the node //</i>
cost -
> cost <i> // Cost should be same for all occurances of the node //</i>
expDate -
> expDate <i> // expDate should be same for all occurances of the node //</i>
Example: Here is Source and Target Structures with Examples
Source:
Source 1..unbounded
stCode 0..1 <b>WA </b>
product 0..1 <b>1234</b>
cost 0..1 <b>12.34</b>
expDate 0..1 <b> 12/12/2006</b>
Target:
Target 1:unbounded
Division 0..1
product 0..1
cost 0..1
expDate 0..1
Data in Target should be : Target Structure 1..unbounded
Division,Product,cost,expDate
<b>001,1234,12.34,12/12/2006
002,1234,12.34,12/12/2006
003,1234,12.34,12/12/2006
004,1234,12.34,12/12/2006</b>
Please note Divisions are derived from StCode and node should repeat as many times as UDF returns
All other fields should repeat as many times as Division appears.
When I look at Display Queue for Target and Division I can see as many values I returned from UDF with context change. But when I test it it generates only 1 node with data ( <b>001,1234,12.34,12/12/2006</b> ).
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.