on 08-28-2009 2:40 PM
Hi Experts,
I am doing IDOC to JDBC scenario, My IDOC is ISU_DL_NOTIF, with in this idoc there is nod called E1ISU_NOT_TASK, this node is 1 to unbounded, so multiple nodes are coming from ISU, but i need to take the last node and map it to database table field, because databse side they dont need all the values coming from ISU.
can anyone please suggest me how to map the last node value to database field.
Kind Regards,
Praveen.
Hi
you can use and UDF
String res = "";
if (list.length() > 0) {
res = list[list.length()-1];
}
else {
res ="";
}
result.addValue(res);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
in my source message The node E1ISU_NOT_TASK occurs four times.
<E1ISU_NOT_TASK SEGMENT="1">
<MNKAT>2</MNKAT>
<MNGRP>ZNEWCON2</MNGRP>
<MNCOD>Z1</MNCOD>
</E1ISU_NOT_TASK>
<E1ISU_NOT_TASK SEGMENT="1">
<MNKAT>2</MNKAT>
<MNGRP>ZNEWCON2</MNGRP>
<MNCOD>Z103</MNCOD>
</E1ISU_NOT_TASK>
<E1ISU_NOT_TASK SEGMENT="1">
<MNKAT>2</MNKAT>
<MNGRP>ZNEWCON2</MNGRP>
<MNCOD>Z1</MNCOD>
</E1ISU_NOT_TASK>
<E1ISU_NOT_TASK SEGMENT="1">
<MNKAT>2</MNKAT>
<MNGRP>ZNEWCON2</MNGRP>
<MNCOD>Z105</MNCOD>
</E1ISU_NOT_TASK>
I need to take the last occurance of E1ISU_NOT_TASK node and i need to take the MNCOD value(Z105) and map it to target field (TASK_CODE) of database.
Can anyone suggest me how can i do this requirement????
Edited by: Praveen Kumar on Aug 31, 2009 8:51 AM
Hi,
Refer any of the above code and create the UDFs, then you need to map it with all the fields
E1ISU_NOT_TASK --> TestUDF -->
<MNKAT> ---> TestUDF -->
<MNGRP> ---> TestUDF -->
<MNCOD> ---> TestUDF -->
PS note : May be based on context change you need to RemoveContext/SplitBy value APIs along with TestUDF.
Thanks
Swarup
Hi
I am getting this error when i use those UDF
/usr/sap/CXD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapf85b5220960911deb28200144f2b5900/source/com/sap/xi/tf/_MM_SAPIsuToJW_NewConnection_.java:139: cannot resolve symbol symbol : method length () location: class java.lang.String[] if(a.length() > 0)
/usr/sap/CXD/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapf85b5220960911deb28200144f2b5900/source/com/sap/xi/tf/_MM_SAPIsuToJW_NewConnection_.java:140: cannot resolve symbol symbol : method length () location: class java.lang.String[] result.addValue(a[a.length() -1]); ^ 2 errors
Can anyone suggest me what was the problem?????
use
MNCOD--->removeContext-->UDF....>TASK_CODE
UDF choose context while creating the UDF
result.addValue(a[a.length-1]);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use the following UDF to take only the last value.
if(a.length() > 0)
result.addValue(a[a.length()-1]);
Use that in your message mapping.
Regards
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.