cancel
Showing results for 
Search instead for 
Did you mean: 

Variable substitution: (delete leading zeros from file name)

Former Member
0 Kudos

Hi All,

I am configuring an IDOC to FILE (fcc scenario) with a requirement of using the IDOC number in the output file name.

Using variable substitution, I manged to get the IDOC number from incoming Idoc-control record but it comes in its entitre length with a few leading zeroes like '00000001234'.

So my output file name looks like 'Output_000000001234.txt' . I want it to be like 'Output_1234.txt'.

Is it possible to achieve it ?

Thanks

Shirin

Accepted Solutions (1)

Accepted Solutions (1)

former_member537867
Active Contributor
0 Kudos

Hi Shirin,

First supress the leading zeros of IDOC number by using the following code:

Create a user defined funciton zerosuppress and take the cache as value and take one argument input. Then put the code below:

//write your code here

String output = input.replaceFirst("^0+","");

return output;

Then use variable substitution for generating ur IDOC number in the out put file name.

Regards,

Vinod.

Answers (2)

Answers (2)

former_member194786
Active Contributor
0 Kudos

Hi Shirin,

Why dont you use ASMA and get the filename in mapping. Then you can delete the preceding 0's using a UDF in the mapping.

Regards,

Sanjeev.

Former Member
0 Kudos

Hi Sanjeev,

Apologies, but what is ASMA.

Could you explain. I am a newbie in XI.

Thanks

Shirin

former_member194786
Active Contributor
0 Kudos

Hi Shirin,

ASMA stands for Adapter Specific Message Attribute aka Dynamic Configuration.

If you select the option Use Adapter Specific Message Attribute in the Configuration Channel, you can use a UDF to access the dynamic configuration parameters.

For further information have a look into this blog:

Regards,

Sanjeev.

Former Member
0 Kudos

Hi,

Try to use the trim which will solve your problem,

Regards,

Nithiyanandam

Former Member
0 Kudos

Hi,

The variable substitution is used in the File name field and not in message mapping area. So I am not sure how do I use 'trim' in the File name field.

Appreciate if you could explain how to use it.

Thanks

Shirin

Former Member
0 Kudos

Hi Shirin,

'Output_000000001234.txt' . I want it to be like 'Output_1234.txt'.

as metoined above u wan the output and this is file i want to just known that it same as mentioned above or some else is added is it preceed by zero or some other data

if we add the time stamp to file then we get the output as mentioned above

remove the time stamp and do chk

update further

Thnax

Sampath