on 08-23-2007 2:44 PM
Hi guys,
well i am using the standard mapping obejcts given in the editor of the IB.
Because i am getting sick of clicking all these simple functions together i thought of writing the code on my own.
I did but it's not working out for me.
The goal is that when a value occuers in the data-field it should be taken, else it should be free (even no whitespace). At the end, the should be a semicolon when no value occurs because the target is a csv-file.
Simple method looks like:
public String dataExists(String a,Container container){
if (a.length() == 0){
a = "";
return a;
}
else{
return a;
}
}
in Xi-Standard-Mapping i use:
/MT_NC_ART_DELIVER/DELRecordSet/DELDetailsStruct/nQtyProduced=iF
(/ZBC14_ART_DEL/IDOC/ZBC14_ART_DEL/NQTYPRODUCED=, exists
(/ZBC14_ART_DEL/IDOC/ZBC14_ART_DEL/NQTYPRODUCED=), const([value=]))
can somebody give me a hand?! the problem is only that in FCC with standard XI-mapping there is a semicolon written when no value occurs, when i use my UDF the semicolon isn't written.
br Jens
Jens,
Please correct me if i'm wrong. If the input field is empty I mean the node is present but the length is 0 then u want the value to be <b>;</b> am I right? If yes ur code is perfect , but inside string give <b>;</b>
if (a.length() == 0){
a = <b>";"</b>;
return a;
}
else{
return a;
}
}
If I understood ur reqmt wrongly plz reply back.
-raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
well i thought of this solution, but didn't tried it because i do a FCC (write to FTP) and for every present field the adapter writes a semicolon.
Perhaps it will write two semicolons with this solution because the ";" indicates a present value?! Am i rigtht?
Otherwise i will try it....
UPDATE:
Ok i tried ur suggestion but we are both wrong because XI doesn't work like the code assumes...nothing is written not even a semicolon even if i use ur edited code...
What is wrong?!
br Jens
The point is that you mix up an empty node and a not-existing node.
If the node does not exist, the UDF is not invoked at all.
What you can do is using an advanced UDF. Then you can write the code like this:
public String dataExists(String[] a, ResultList result, Container container){
if (a.length == 0){
result.addvalue("");
}
else{
result.addvalue(a[0]);
}
}
Hi Stefan,
well i guess i have to be more familiar with UDFs and the advanced one. Because i am new to this, i have some problems.
I added ur code for testing but cannot activate the MM because of some Syntax-Errors in the UDF.
560: cannot resolve symbol symbol : method addvalue (java.lang.String) location: interface com.sap.aii.mappingtool.tf3.rt.ResultList result.addvalue("");
563: cannot resolve symbol symbol : method addvalue (java.lang.String) location: interface com.sap.aii.mappingtool.tf3.rt.ResultList result.addvalue(a[0]);
Do i have to add some packages?! Imports aren't missing because ResultList comes from class Object?!
can u give me one more advise?!
br Jens
Sorry, there is a typo:
result.addValue(..)
For an advanced UDF, you have to change the attribute Cache = Context
See more details here:
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm
Check this blog also, that should help to find out, which method you can use:
/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
Stefan
Message was edited by:
Stefan Grube
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.