Need help in UDF
Hello Gurus,
Could you please help me if v need any UDF for splitting or can i do it with graphical mapping.
Below is the source structure
<header>id123</header>
<item>item123</item>
<data>abd1232011
^^efg4562011
^^hij7892012</data>
Required target structure
<header>id123</header> 1:1
<item>item123</item> 1:1
<content> 1:1
<data> 1:unbounded
<char>abd</char>
<num>123</num>
<date>2011</date>
</data>
my requirement is to break the 1 source field "data" into 3 target fields "char","num","date". Field data is of type string and received as a raw string. The new line is determined by "^^" in the string. fields are separated by "~"
Kindly help
Thanks in advance.
which version of PI u r working on??
In case ur version is PI7.1 (or greater) then chk this code:
UDF1:
Input will be: var1 of type argument
and add 3 result type with name result1, result2, result3
Execution type: all values of a context
String [] temp = var1[0].split("^^");
for(int i=0;i<temp.length;i++)
String [] split1 = temp<i>.split("~");
result1.addValue(split1[0]);
result2.addValue(split1[1]);
result3.addValue(split1[2]);
result1.addContextChange();
result2.addContextChange();
result3.addContextChange();
UDF2:
String [] temp = var1[0].split("^^");
for(int i=0;i<temp.length;i++)
result.addValue("");
mapping:
Input----UDF2---data
-----char
Input----UDF1 -------num
-------date
Similar Messages
-
Need help on udf by my requirement
Hi folks,
I am working on file to idoc
My input file has 1 field and output Idoc has 5 records.
in my input Account field has length 16. in this length 16. this field is mapping to all the fields of output.
for example account field has 1234 67 86 34 33. I need to map 1234 to field 1
67 to field 2
86 to field 3
34 to filed 4
33 to field 5.
for every space we need to split and need to map output field. after completing this I need to sort the field 1 of output. please explain me. Account data may very
examples input file :
1238 67 86 34 33
1234 66 86 34 33
need output as 1234 67 86 34 33
1238 66 86 34 33
here only first field is sorted i.e 1234 and 1238 ....remainiing fields need to be same
ur help is highly appreciated.
Thanks,
enivassHi,
Since you can have spaces any where in the file/field, use "String Tokenizer" concept, you will not need java mapping, you can use graphical mapping and write UDF by selecting "All values of the Queue/Context"
Here are some useful links:
Re: Split a string with character "+" as separator
http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html
http://www.javafaq.nu/java-example-code-195.html
http://www.devdaily.com/java/edu/pj/pj010006/ - Concept
http://download-llnw.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html - Concept
http://www.java-examples.com/java-stringtokenizer---specify-delimiter-example - with Delimiter
Regards,
Pavan -
Need help on SQL Statement for UDF
Hi,
as I am not so familiar with SQL statements on currently selected values, I urgently need help.
The scenario looks as follows:
I have defined two UDFs named Subgroup1 and Subgroup2 which represent the subgroups dependent on my article groups. So for example: When the user selects article group "pianos", he only sees the specific subgroups like "new pianos" and "used pianos" in field "Subgroup1". After he has selected one of these specific values, he sees only the specific sub-subgroups in field "Subgroup2", like "used grand pianos".
I have defined UDTs for both UDFs. The UDT for field "Subgroup1" has a UDF called "ArticleGroup" which represents the relation to the article group codes. The UDT for field "Subgroup2" has a UDF called "Subgroup1" which represents the relation to the subgroups one level higher.
The SQL statement for the formatted search in field "Subgroup1" looks as follows:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP1] T0 WHERE T0.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod])
It works fine.
However, I cannot find the right statement for the formatted search in field "Subgroup2".
Unfortunately this does NOT WORK:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT $[OITM.U_Subgroup1])
I tried a lot of others that didn't work either.
Then I tried the following one:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT T1.[Code] FROM [dbo].[@B_SUBGROUP1] T1 WHERE T1.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod]))
Unfortunately that only works as long as there is only one specific subgroup1 for the selected article group.
I would be sooooo happy if there is anyone who can tell me the correct statement for my second UDF!
Thanks so much in advance!!!!
Edited by: Corinna Hochheim on Jan 18, 2010 10:16 PM
Please ignore the "http://" in the above statements - it is certainly not part of my SQL.
Please also ignore the strikes.Hello Dear,
Use the below queries to get the values:
Item Sub Group on the basis of Item Group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[U_GroupCod] =$[OITM.ItmsGrpCod]
Item Sub Group 1 on the basis of item sub group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[U_SubGrpCod]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp])
Sub group 2 on the basis of sub group 1
SELECT T0.[Name] FROM [dbo].[@SUBGROUP2] T0 WHERE T0.[U_SubGrpCod1]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp1])
this will help you.
regards,
Neetu -
Mapping Problem . or help in UDF
Hi...
I am having problem in mapping.
I am having 3 messages in the source structure and 1 message in the target structure. 3:1 mapping.
Source Messages:
Message1: Warehouse Details(plant name,warehouselocation)
Message2:Supplier Details(suppid,suppname,leadtime,matname,cost)
Message3:Input(matname,plant,unit,item,itemname,ReqQty,OrderQty,Cost,suppid,suppname,leadtime,date,warehouseloc)
Target Message:
Output
If the Availability field in Message3 !=0, then it should map warehouseloc of message 1 to the Output mesage. or else it should map 0 to the warehouse and map message 2 items to the output message.
Source messages are 0:unbounded.
Could you please help me out in this issue. or else can you please tell how to write the userdefined function for that.
Below is the structure.
Source Message:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns1:getWareHouseDetailsResponse xmlns:ns1="http://DefaultNamespace">
<getWareHouseDetailsReturn>
<Plant>
<plantName/>
<wareHouseLocation>W001</wareHouseLocation>
</Plant>
</getWareHouseDetailsReturn>
</ns1:getWareHouseDetailsResponse>
</ns0:Message1>
<ns0:Message2>
<ns2:GetPreferredSuppliersResponse xmlns:ns2="http://tempuri.org/">
<ns2:GetPreferredSuppliersResult>
<ns2:Supplier>
<ns2:SupplierId>S001</ns2:SupplierId>
<ns2:SupplierName>TRW</ns2:SupplierName>
<ns2:LeadTime>1111</ns2:LeadTime>
<ns2:MaterialName>M001</ns2:MaterialName>
<ns2:Cost>1000</ns2:Cost>
</ns2:Supplier>
</ns2:GetPreferredSuppliersResult>
</ns2:GetPreferredSuppliersResponse>
</ns0:Message2>
<ns0:Message3>
<ns3:MT_Output xmlns:ns3="http://BlockTest">
<Material>
<Matname>M001</Matname>
<Plant>P001</Plant>
<Unit>KG</Unit>
<Item/>
<Itemname/>
<ReqQty>5</ReqQty>
<AvailQty>0</AvailQty>
<Cost/>
<Suppid/>
<Supname/>
<LeadTime/>
<Date>12.05.2008</Date>
<OrderQty>0</OrderQty>
<WarehouseLoc/>
</Material>
<Material>
<Matname>M002</Matname>
<Plant>P002</Plant>
<Unit>PC</Unit>
<Item/>
<Itemname/>
<ReqQty>5</ReqQty>
<AvailQty>5000</AvailQty>
<Cost/>
<Suppid/>
<Supname/>
<LeadTime/>
<Date>12.05.2008</Date>
<OrderQty>0</OrderQty>
<WarehouseLoc/>
</Material>
<Pcost/>
<Tcost/>
<Ocost/>
</ns3:MT_Output>
</ns0:Message3>
</ns0:Messages>
Target Message:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns3:MT_Output xmlns:ns3="http://BlockTest">
<Material>M001</Material>
<Plant>P001</Plant>
<Unit>KG</Unit>
<Item></Item>
<Itemname></Itemname>
<ReqQty>5</ReqQty>
<AvailQty>0</AvailQty>
<Cost>1000</Cost>
<Suppid>S001</Suppid>
<Supname>TRW</Supname>
<LeadTime>1111</LeadTime>
<Date>12.05.2008</Date>
<OrderQty>0</OrderQty>
<WarehouseLoc>0</WarehouseLoc>
</Material>
<Material>M002</Material>
<Plant>P002</Plant>
<Unit>KG</Unit>
<Item></Item>
<Itemname></Itemname>
<ReqQty>5</ReqQty>
<AvailQty>0</AvailQty>
<Cost>1000</Cost>
<Suppid/>
<Supname/>
<LeadTime/>
<Date>12.05.2008</Date>
<OrderQty>0</OrderQty>
<WarehouseLoc>W001</WarehouseLoc>
</Material>
</ns3:MT_Output>
</ns0:Message1>
</ns0:Messages>
Edited by: leelaratnam morampudi on Oct 14, 2008 1:13 PMI think there is no need to use UDF, you can achive this by using IF function.
to make your mapping simple, in your message mapping on MT_Output, right click your mouse and click on duplicate subtree. you will now have two structure in your target.
first one is for if AvailQty != 0 then warehouseloc of message 1 to the Output mesage
and second one is for if AvailQty = 0 now map 0 to the warehouse and map message 2 items to the output message.
try this and let us know if you face any issues. -
Need help to develop Pythagoras theorem-
Hi i need help to develop proofs 2,3,4
of pythagoras theorems in java as demonstrations
These are applets can anyone help me with it or give me an idea of how to go about developing it -
the site is the following
http://www.uni-koeln.de/ew-fak/Mathe/Projekte/VisuPro/pythagoras/pythagoras.html
then double click on the screen to make it startPardon my ASCII art, but I've always liked the following, simple, geometric proof:
a b
---------------------------------------+
| | |
a| I | II |
| | |
---------------------------------------+
| | |
| | |
| | |
| | |
| | |
b| IV | III |
| | |
| | |
| | |
| | |
| | |
| | |
---------------------------------------+It almost goes without saying that I+II+III+IV == (a+b)^2, and II == IV == a*b,
I == a*a and III == b*b, showing that (a+b)^2 == a^2+a*b+a*b+b^2.
I hope the following sketch makes sense, stand back, ASCII art alert again: a b
---------------------------------------+
| . VI |
| . . |a
| V . |
| +
| |
| . |
b| . |
| |
| IX |
| . |
| . |b
| |
+ |
| . |
a| . . VII |
| VIII . |
---------------------------------------+
a bThe total area equals (a+b)^2 again and equals the sum of the smaller areas:
(a+b)^2 == V+VI+VII+VIII+IX. Let area IX be c^2 for whatever c may be.
V+VII == VI+VIII == a*b, so a^2+b^2+2*ab= c^2+2*a*b; IOW a^2+b^2 == c^2
Given this fundamental result, the others can easily be derived from this one,
or did I answer a question you didn't ask?
kind regards,
Jos -
I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?
What file format did you export it to?
-
Need help to open audios attached in a PDF file
Hello
I just need help. I have ordered a reviewer online that has audios and texts in a pdf file. I was told to download the latest adobe reader on my computer. I have done the same thing on my ipad mini. I am not so technical with regards to these things. Therefore I need help. I can access the audios on my computer but not on my ipad.
I want to listen to audios with scripts or texts on them so i can listen to them when i am on the go. I was also informed that these files should work in any device. How come the audios doesnt work on my ipad.
Please help me on what to do.
ThanksAudio and video are not currently support on Adobe Reader. :-<
You need to buy a PDF reader that supports them. My suggestion is PDF Expert from Readdle ($US 9.99) -
Need help to open and look for file by name
Hi,
Im needing help to open a folder and look for a file (.txt) on this directory by his name ... The user ll type the partial name of file , and i need look for this file on the folder , and delete it ....
How can i look for the file by his name ?
Thx =)Hi ,
Sry ,, let me explain again ... I ll set the name of the files in the follow order ... Name_Serial_date_chanel.sxc ..
The user ll type the serial that he wants delete ...
I already figured out what i need guys .. thx for the help ^^
I used List Directory on advanced IO , to list all .. the Name is the same for all ... then i used Name_ concateneted with Serial(typed)* .. this command serial* ll list all serials equal the typed , in my case , ll exist only one , cuz its a count this serial .Then i pass the path to the delete , and its done !
Thx ^^ -
I need help, my ipod touch is not recognized by windows as a harddisk
i need help, my ipod touch is not recognized by windows like a memory card or a harddisk.
i would like to transfer the files from pc to my ipod touch without useing itunes.
as i see theres some people here that theires ipod touch are recongnzed as a digitl camra, mine is reconzied as nothing, some help plz.
Message was edited by: B0OmB0Om wrote:
ok but i still dont understed, only my itnes recongnize my ipod, when i go to " my cumputer, it dosent show up there, not even as a digital camra
Your Touch is working correctly. Currently, without unsupported third party hacks, the Touch has NO disc mode. It will only show up in iTunes.
how do i put programes and games in my ipod touch
Right now, you don't. The SDK is scheduled to be released in Feburary. Then developers will be able to write programs that will be loadable. -
Weird error message need help..
SO.. i havent updated my itunes in a while because i keep getting this weird message.. it comes up when im almost done installing the newest/newer versions of itunes. it says
"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"
now when ever i choose a file from the browse box it replies with this message "the file 'xxx' is not a valid installation package for the product iTunes. try to find the installation package iTunes.msi in a folder from which you can install iTunes."
no idea need help thanks
~~~lake
Message was edited by: DarkxFlamexCaster
Message was edited by: DarkxFlamexCaster+it comes up when im almost done installing the newest/newer versions of itunes. it says+ +"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"+
With that one, let's try the following procedure.
First, head into your Add/Remove programs and uninstall your QuickTime. If it goes, good. If it doesn't, we'll just attend to it when we attend to iTunes.
Next, download and install the Windows Installer CleanUp utility:
Description of the Windows Installer CleanUp Utility
Now launch Windows Installer CleanUp ("Start > All Programs > Windows Install Clean Up"), find any iTunes and/or QuickTime entries in the list of programs in CleanUp, select those entries, and click “remove”.
Next, we'll manually remove any leftover iTunes or QuickTime program files:
(1) Open Local Disk (C:) in Computer or whichever disk programs are installed on.
(2) Open the Program Files folder.
(3) Right-click the iTunes folder and select Delete and choose Yes when asked to confirm the deletion.
(4) Right-click the QuickTime folder and select Delete and choose Yes when asked to confirm the deletion. (Note: This folder may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
(5) Delete the QuickTime and QuicktimeVR files located in the C:\Windows\system32\ folder. Click Continue if Windows needs confirmation or permission to continue. (Note: These files may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
(6) Right-click on the Recycle Bin and on the shortcut menu, click Empty Recycle Bin.
(7) Restart your computer.
Now try another iTunes install. Does it go through properly now? -
I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?
Hold down the Option key while you boot your Mac. Then, it should show you a selection of devices. Click your flash drive and it will boot from that.
-
Need help adobe bridge cc output module
I need help. I have an assignment I'm held up on completing because the adobe cc bridge does not have the output modue I need. I followed the adobe instructions page to the letter. I copied and pasted the output module folder to the adobe bridge cc extensions folder in programs/commonfiles/adobe. The only thing is the instructions then say to paste the workspace file into the workspace folder located below the bridge extensions folder. I don't have a workspaces folder there or anywhere. I even tried must making one and adding the file to it, but no go. can someone PLEASE help me with this? I have an assignment due like now that requires the use of the output modue.thanks!
oh,my system is windows 8.1. sorry, lol.
-
Trying to create a Invoice based on Order need help Error -5002
the dreaded -5002 error is haunting me too! and I could not find a matching solution for this in the forum....
I need help quickly on this. I am trying to create invoices for some orders so the Base - Target relationship is retained. The orders I pick are all Open (DocStatus = O and the lines are all Open LineStatus = O)
here is my code
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 0
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00001"
oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
'adding Line
oInvoice.Lines.Add
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 1
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00002"
oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
'adding Line
oInvoice.Lines.Add
lRetCode = oInvoice.Add
If lRetCode <> 0 Then
gObjCompany.GetLastError lErrCode, sErrMsg
MsgBox (lErrCode & " " & sErrMsg)
End IfIndika,
Only set your base types...
(not items & description)
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 0
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00001"
oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
'adding Line (to fill the second item line)
' the 1st line item is there by default
oInvoice.Lines.Add
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 1
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00002"
oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
'DO NOT Add THIS line
' (only if you want to add a 3rd line item)
'''oInvoice.Lines.Add -> Don't add this
lRetCode = oInvoice.Add
If lRetCode <> 0 Then
gObjCompany.GetLastError lErrCode, sErrMsg
MsgBox (lErrCode & " " & sErrMsg)
End If
remember to add :
oInvoice.CardCode = "your BP"
oInvoice.DocDueDate = Now
oInvoiceDoc.CardCode = txtDOCBPCode.Text -
I need help installing update 13.1.2 for Photoshop creative cloud, installation fails with error code: U44M1P7. Could someone please help?
Sorry to bother you.
I could find the answer after searching previous posts about this language problem.
Had to change my language in AAM profile and then download PS CS6 again ( english version ).
Then open the actual Photoshop and in preferences > interface you can besides the Dutch also option for English.
restart application and Voila.
Greetz, Jeroen -
Stored DB Procedure - Need help
Hi. I have a stored database package containing 2 functions. I need help with the function named ret_columns.
If you look at the code below you will see this function has two different FOR loops. The Select statement in FOR loop that is commented out works just fine, but when I try to use the uncommented select statement in it's place the Function returns NULL (or no records). However, if I run the Select statement in plain old SQL Plus it returns the rows I need. I don't get it.
Can anyone help me? I'm really stuck on this one.
-- PACKAGE BODY
CREATE OR REPLACE package body audit_table_info
as
function ret_tables return table_type is
t_t table_type;
i integer;
begin
i := 1;
for rec in (select distinct table_name
from all_triggers
where substr(trigger_name,1,9) = upper('tr_audit#')) loop
t_t(i).tableA := rec.table_name;
i := i+1;
end loop;
return t_t;
end;
function ret_columns return column_type is
c_t column_type;
i integer;
begin
i := 1;
-- for rec in (select distinct table_name column_name
-- from all_triggers
-- where substr(trigger_name,1,9) = upper('tr_audit#')) loop
for rec in (select distinct b.column_name column_name
from all_triggers a, all_tab_columns b
where a.table_owner = b.owner
and a.table_name = b.table_name
and substr(a.trigger_name,1,9) = upper('tr_audit#') and rownum < 5) loop
c_t(i).tableB := rec.column_name;
i := i+1;
end loop;
return c_t;
end;
end audit_table_info;
-- PACKAGE DEFINITION
CREATE OR REPLACE package Audit_Table_Info as
type table_rec is record( tableA all_tab_columns.TABLE_NAME%type);
type table_type is table of table_rec index by binary_integer;
function ret_tables return table_type;
type column_rec is record( tableB all_tables.TABLE_NAME%type);
type column_type is table of column_rec index by binary_integer;
function ret_columns return column_type;
end Audit_Table_Info;
/It works when I do this!!! I'm so confused.
Ok...so I did this:
1 create table test_columns as
2 (select b.column_name
3 from all_triggers a,
4 all_tab_columns b
5 where a.table_owner = b.owner
6 and a.table_name = b.table_name
7 and substr(a.trigger_name,1,9) = upper('tr_audit#')
8* and rownum < 5)
SQL> /
Table created.
Then altered the Function so the Select statement refers to this table:
function ret_columns return column_type is
c_t column_type;
i integer;
begin
i := 1;
for rec in (select distinct column_name
from test_columns) loop
c_t(i).tableB := rec.column_name;
i := i+1;
end loop;
return c_t;
end;
Again, any help would be greatly greatly appreciated!
Maybe you are looking for
-
How can i connect macbook pro to time capsule via ethernet
I just purchased a Time Capsule to backup my MacBook Pro. I tried to back up the files via wifi but it was taking forever. I tried connecting the Time Capsule to the MacBook via an ethernet cable but it won't recognize it. Any suggestions?
-
How can I apply curve fitting to simple BER measurement data?
I am collecting simple BER data from a communications receiver for modulations such as PSK, CPM, etc. The data looks good but has the usual measurement noise, which I would like to spiffy-up for customer presentations. I have tried virtually all of t
-
Why is safari 7.0 so slow
Why is safari 7 so slow google and firefox are screaming past it on searches.
-
Delete, please Message was edited by: Chuck Risher
-
Help! All pictures gone from iPhoto!
I opened iPhoto today and it said zero pictures... none, all gone! I did some hunting around, after catching my breath, and found a bunch of the numbered folders with pictures in them through the my "pictures" in the finder... but iPhoto will not sho