on 05-21-2008 11:13 AM
Hi Experts,
In my file to idoc scenario,
the requiremnt is like in mapping i have to give condition like if file name is name1 then one target filed is 40 and if file name is name2 then that target field is 60.
how can we achieve this ?
Regards,
rohit
Hi Rohit
mughdha is right but you can do it through graphical mapping easily
give condition in fix value under category conversion like this
1) source-> FIX VALUE ->if value is true then map FIX value
else nothing
double click on first FIX VALUE function and assign your input values for file (for ex 40 or 60,......) in the key field and in the value field assign TRUE
if this condition will be true the it willl map second FIX VALUE
else assign a constant with empty value
in second fix value assign values (for ex 40 or 60,......) which you have checked in first FIX VALUE function in key field and assign corresponding name which you required in the value field
hope this will solve your problem
Thanks
sandeep
if helpful reward points
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Follow this blog to get filename in mapping
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
you can write UDF as
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
//here check if ourSourceFileName = name1 then return 40 else return 60
map it to corresponding target field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Mugdha,
i have put this code in the UDF but what should be the input parameter for the UDf.
also when i tried to check this in message mapping test , its giving me run time exception.
RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Messages/ns0:Message1/ORDERS05/IDOC/EDI_DC40/MANDT. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_EDI_HospitalsToORDERS05_ method filename$[com.sap.aii.mappingtool.tf3.rt.Context@545f545f]
Regards,
Rohit
my code is like this
public String filename(Container container){
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
}
and in graphical mapping i did like this
UDF---->targetField
what else should be done..
actually i need file name in the output and then i have to use value mapping for some reason.
can we check output here in message mapping test ? because when i am testing i am getting runtime exception ?
i have also put my code in the previous post.
pls see and let me know what else to be done.
can we check output here in message mapping test ? because when i am testing i am getting runtime exception ?
-
>
you can test it runtime only as it is a dynamic configuration. Test the scenario end to end
Also you have to select adapter specific message attributes in sender file adapter as mentioned in the blog.
Hi rohit,
Chk dis link...
http://www.saptechnical.com/Tutorials/XI/Variable/substitution.htm
reward points if helpful....
PrashaNt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Follow this links
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
or
In the receiver determination we mention the condition according to our requirement.
Follow this link
http://www.saptechnical.com/Tutorials/XI/FileToIDoc/FiletoIDocScenario.htm
Edited by: Venkataramesh Boppana on May 21, 2008 3:52 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.