on 08-15-2007 8:22 PM
Hi -
I have the following question - here is the mapping of an unbounded tag <Line> in the source and a segment TDLINE in the idoc as follows.
Line 1 .. unbounded ( source )
E1EDKT2 0 .. 99999999999
Segment required
TDLINE 0 ..1
TDFORMAT 0 ..1
My problem is I need for each Line tag to write out to a new TDLINE - but as I duplicate the E1EDKT2 to the max of 4 - I get the first <Line> text in each of the TDLINE
Here is a sample of the input and output ...
INPUT
<Message><OrderItemId>27036336</OrderItemId><To>A</To><From>B</From><Line>This is a test message. It should be split up into multiple </Line><Line>lines with a length less than 200 characters. -- Thank you</Line></Message></Messages></OrderHeader>
OUTPUT
<E1EDKT1 SEGMENT="1"><TDID>ZGCD</TDID><TSSPRAS>EN</TSSPRAS><E1EDKT2 SEGMENT=""><TDLINE> </TDLINE><TDFORMAT>*</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT=""><TDLINE>A</TDLINE><TDFORMAT>/=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT=""><TDLINE>B</TDLINE><TDFORMAT>/=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT=""><TDLINE>This is a test message. It should be split up into multiple </TDLINE><TDFORMAT>/=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT=""><TDLINE>This is a test postcard message. It should be split up into multiple </TDLINE><TDFORMAT>/=</TDFORMAT></E1EDKT2></E1EDKT1>
Any help would be greatly appreciated!
It should look exactly like this...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok thanks - mine looks exactly that way, however when I run a check on my map I still am getting the following error. What should the two UDF's look like are my earlier posts correct for those? Do I need to do anything to identify the global variable? The error message says something about a class or interface ...
Check Result for Object MM_xxxxxx_order_XX Source code has syntax error: /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapec19bd704c6511dcc364001125c52e50/source/com/sap/xi/tf/_MM_xxxxxx_order_XX_.java:1066: 'class' or 'interface' expected public String UDFRetrieveText$(Container container){ ^ /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapec19bd704c6511dcc364001125c52e50/source/com/sap/xi/tf/_MM_xxxxxx_order_XX_.java:1070: 'class' or 'interface' expected } ^ /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapec19bd704c6511dcc364001125c52e50/source/com/sap/xi/tf/_MM_xxxxxx_order_XX_.java:1090: 'class' or 'interface' expected ^ 3 errors
copy and paste the code of the function UDFRetrieveText. That's an odd error, I think it would have something to do with the syntax of your UDF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
definately the problem,
right under the design tab in mapping, theres a edit java sections button, in there you can define global variables
Also, if my solution does not work, I would like other people to give you possible solutions. I figured out a way to handle this, but it's a little tedious, and I believe there might be a better solution, but if no one can help you, I'll guide you through it.
Ok I defined the global varialbe in the java section as
String storeText = null;
But I am still getting the following error ...
Source code has syntax error: /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map56034bb04c3011dc91a4001125c52e50/source/com/sap/xi/tf/_MM_order_FC_.java:1065: 'class' or 'interface' expected public String UDFRetrieveText$(Container container){ ^ /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map56034bb04c3011dc91a4001125c52e50/source/com/sap/xi/tf/_MM_order_FC_.java:1069: 'class' or 'interface' expected } ^ /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map56034bb04c3011dc91a4001125c52e50/source/com/sap/xi/tf/_MM_order_FC_.java:1089: 'class' or 'interface' expected ^ 3 errors
You might be able to make my above code work by applying the UseOneAsMany function on the rest of the entries, but I'm not sure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looking at the example you have above for code makes this more complicated than I thought, that code I provided above may or may not work. This is an interesting problem though, I want to look into it more.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Easy solution:
Create global variable: String storeZ;
Create UDFStoreZ with code
public String UDFStoreZ(String a, Container...){
storeZ = a;
return a;
}
Create UDFRetreiveZ with no inputs and code
public String UDFRetreiveZ(Container...){
return storeZ;
}
Map:
line -
> UDFStoreZ -
>E1EDKT2
UDFRetreiveZ---->Segment
UDFRetreiveZ---->TDLINE
points if it works thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanks- I am trying this but seems I am getting a syntax error. Any suggestions - here is the error.
Source code has syntax error: /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map74067fd04c0611dc8609001125c52e50/source/com/sap/xi/tf/_MM_xxxxx_order_FC_.java:1064: 'class' or 'interface' expected public String UDFRetrieveText$(Container container){ ^ /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map74067fd04c0611dc8609001125c52e50/source/com/sap/xi/tf/_MM_xxxxx_order_FC_.java:1068: 'class' or 'interface' expected } ^ /usr/sap/xxx/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map74067fd04c0611dc8609001125c52e50/source/com/sap/xi/tf/_MM_xxxxx_order_FC_.java:1088: 'class' or 'interface' expected ^ 3 errors
Message was edited by:
SA
I think that the problem why this solution will not work is because of the structure - I have to deal with sort of a flat strucure where the number of Line tags is multiple but the Messages is only one. See below :
<OrderHeader>
<OrderID>orderid</OrderID>
<StoreID>storeid</StoreID>
<CustomerID>customreabc</CustomerID>
<Currency>USD</Currency>
<OrderCharges>
<TotalProductPrice currency="USD">675.00000</TotalProductPrice>
<TotalAdjustment currency="USD">0.00000</TotalAdjustment>
<TotalShippingCharge currency="USD">14.95000</TotalShippingCharge>
<TotalSalesTax currency="USD">56.36000</TotalSalesTax>
<TotalShippingTax currency="USD">0.00000</TotalShippingTax>
</OrderCharges>
<BillingAddressInfo>
<AddressLine1>3966 Davila Dr</AddressLine1>
<AddressLine2 xsi:nil="true" />
<AddressLine3 xsi:nil="true" />
<City>Dallas</City>
<StateOrProvinceName>SD</StateOrProvinceName>
<Country>United States</Country>
<PostalCode>77777</PostalCode>
<Telephone>9899899898</Telephone>
<Email>email@emai..com</Email>
<LastName>doe</LastName>
<FirstName>joe</FirstName>
</BillingAddressInfo>
<PlacedDate>2007-03-12</PlacedDate>
<PlacedDateTime>2007-03-12 10:31:57.378</PlacedDateTime>
<Messages>
<Message>
<To>A</To>
<From>B</From>
<Line>this is a string of text that</Line> <Line>must be continued on the next line</Line> <Line> and must write out to the appropriate segments</Line>
</Message>
</Messages>
</OrderHeader>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi thanks to both but I have already tried both of these things. I have duplicated subtree 4 times on my segment containing TDLINE - and I have tried the split by value function between <Line> and TDLINE It continues to only capture the first <Line> Any other suggestions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Can u confirm whether the structure and results are as u expected.
http://www.flickr.com/photo_zoom.gne?id=1130020000&size=o
Best regards,
raj.
Hey,
UDF not needed.
Line 1(Change Context to higher level)--> SplitByValue(Each Value)--> TDLINE
Try this and let us know.
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
If i am notg worng what you want is to map the line to TDLINE.
fo this you will have to replicate the segment E1EDKT2 number of times the line element appears .
so you will map line to E1EDKT2 and also to TDLINE
Hope this helps
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.