on 12-23-2010 4:43 PM
Hi Experts,
I have a mapping problem in my object.
I have two filelds coming from the Control record of an IDoc CREDAT and CRETIM. Now, I need to concate them and put them in a target field DateandTimeCreated in the format: YYYYMMDDHHMMSS
Is their an UDF or message mapping for this. Messge mapping will be better for me.DateTrans will work over here??
Please reply.
Thanks and regards,
Aniruddha
If Doc fields CREDAT and CRETIM gives output in this format respectively YYYYMMDD and HHMMSS, then use concat to concatenate the string as below.
map CREDAT and CRETIM fields to concat -> concatenated output
otherwise we have to convert CREDAT data to YYYYMMDD and cretim data to HHMMSS first, and then use concat function.
Note: To convert date and time to the required pattern we have to use UDF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Aniruddha,
This is a very easy requirement. just use the standard function "CreateDate" if you need to send the system generated date.
you can select both day and time formats by double clicking the "createDate".
If you need to send data from the IDOC (creation time and date idoc created) then use the concat function followed by DateTrans standard functions to manipulate the Date format.
Regards,
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sample UDF code:
Execution Type: Single Values
Date UDF
a)if your input date field declared as string then,
public String dateValue(String value, Container container) throws StreamTransformationException{
String input =value;
String strDate ="";
if (input !=null)
{
Date date1 = new java.util.Date(Long.parseLong(input));
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
strDate = formatter.format(date1);
}
return strDate;
}
Time UDF
a) if your input time field declared as string then,
public String timeValue(String value, Container container) throws StreamTransformationException{
String input = value;
String strTime="";
if (input !=null)
{
Date date = new java.util.Date(Long.parseLong(input));
SimpleDateFormat formatter = new SimpleDateFormat("HHmmss");
strDate = formatter.format(date);
}
return strTime;
}
Note: include import statement
import java.text.*
If you have question, let us know. This code will work for sure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks a lot for you reply, can I have a sample UDF for this which I may require for this mapping. I am new to Java.
Regards,
Aniruddha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.