cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed in Dynamic Configuration

Former Member
0 Kudos

Hello Gurus,

I have a requirement where in my input filename is : ABCD#XXX_YYYYMMDD_HHMMSS

I want my output filename as : VN01MMDDYY01

Where VN01 is the companycode which is in the Header field of my input file.

MMDDYY should be extracted from my input filename.

01 is static.

How do I alter my Dynamic Configuration to achieve this?Please guide me...

Thanks in advance..

Regards,

Swathi.Suresh

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hey Praveen..

I got the output.I was stuck up because of the substring function in my UDF.

I was passing the input parameters like this : valueOld.substring(13,2)

Where as i should have passed the parameters like this : valueOld.substring(13,15).

Realized it lately.Nyways thanx for your help:)

Regards,

Swathi.

former_member181985
Active Contributor
0 Kudos

Glad to help you.......:)

Can mark this thread as closed......It will help others.

- Gujjeti.

Former Member
0 Kudos

Hi Praveen,

The UDF that you sent is working,but it does not serve my purpose.

I am just getting the Source Filename as my Target Filename.No changes are being reflected.Neither the Compant Code nor the expected date format is found in the Target Filename.

Regards,

Swathi.

former_member181985
Active Contributor
0 Kudos

Hi,

How you enabled the ASMA in the File Communication Channels.

Hmm ... sorry I forgot to add one more line. I am updating my previous reply.

- Gujjeti.

Edited by: Praveen Gujjeti on Dec 15, 2008 11:32 AM

Former Member
0 Kudos

Hi Praveen..

I tried the UDF that you sent.I am gettin this error when I try to activate.

Source code has syntax error:

: missing return statement } ^ 1 error

Whereas the code is absolutely right.What should I do?

former_member181985
Active Contributor
0 Kudos

Hi,

Try this,


String tmp = null;
try
{
 
	DynamicConfiguration conf = (DynamicConfiguration) 
	container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
	DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
 
	String fileName = conf.get(KEY_FILENAME); 
 
 
        tmp = a + (fileName.substring(fileName.indexOf("_")+5, fileName.indexOf("_")+7)) + (fileName.substring(fileName.indexOf("_")+7, fileName.indexOf("_")+9)) + (fileName.substring(fileName.indexOf("_")+3, fileName.indexOf("_")+5)) + "01";

conf.put(KEY_FILENAME, tmp);
 
	
}
catch (Exception e)
{
	e.printStackTrace();
}

return tmp;

Edited by: Praveen Gujjeti on Dec 15, 2008 11:22 AM

Edited by: Praveen Gujjeti on Dec 15, 2008 11:33 AM (try this now)

former_member181985
Active Contributor
0 Kudos

Hi,

VN01(From Source) >UDF>output field

try
{

	DynamicConfiguration conf = (DynamicConfiguration) 
	container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
	DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

	String fileName = conf.get(KEY_FILENAME); 


	String tmp = a + (fileName.substring(fileName.indexOf("_")+5, fileName.indexOf("_")+7)) + (fileName.substring(fileName.indexOf("_")+7, fileName.indexOf("_")+9)) + (fileName.substring(fileName.indexOf("_")+3, fileName.indexOf("_")+5)) + "01";

	return tmp;
}
catch (Exception e)
{
	e.printStackTrace();
}

- Gujjeti.