cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name configuration issue

former_member238007
Contributor
0 Kudos

Hi,

My scenario is Idoc to multiple file scenario..

I need to drop 2 files at the target with the file names to be configured dynamically, at present i have used dynamic UDF to drop the files with the dynamic name. but i am getting the output files with the same name i mean the name which i used in the second structure.

eg: Input -- IDOC

ouput: i need to have abc.idocnumber.sysdate.xml & xyz.idocnumber.sysdate.xml

But now we are getting as xyz.idocnumber.sysdate.msgid.xml & xyz.idocnumber.sysdate.xml

so correct me if i am wrong .. i should not use 2 dynamic UDF in a single scenario..

else can i use variable substitution for one structure and Dynamic UDF for another structure..

please suggest some solution

Thanks,

--Kishore

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

when say "Idoc to multiple file scenario", could you clarify:

IDOC to multiple files of same type or

IDOC to multiple files of different types ?

Regards

Liang

former_member238007
Contributor
0 Kudos

Hi Liang,

Let me expain the complete scenario..

Source is Idoc.. of DESADV type and at the target side we have 2 differient structures, so for the 2 different structure we need to configure dynamic file naming configuration. i mean the out put file naming convention should be dynamically configured.

I have used the dynamic UDF for both the structures as a result i am getting the 2 output files at the target directory with the same name. ( for the first file the messageid is getting appended and for the next 2nd file drops as we required) with same extension type.

But as i am dropping 2 different structure of files how could i configure.

will variable substitution resolves my issue. But when i use variable substitution can i append system date for the output file, reason being system date is not coming in the input file. how to capture the system date using variable substitution.

Request you to throw some light to solve this issue..

Thanks,

--Kishore

Former Member
0 Kudos

Hi Kishore,

you can append the system date to the filename of the receiver.

Try the below code:

SimpleDateFormat simpledatFormat = new SimpleDateFormat("yyyyMMdd");

Date date = new Date();

String datewithYear = simpledatFormat.format(date);

SimpleDateFormat simpledatFormat1 = new SimpleDateFormat("HHmmss");

Date date1 = new Date();

String datewithMs = simpledatFormat1.format(date1);

DynamicConfiguration conf = ((DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION));

DynamicConfigurationKey key = DynamicConfigurationKey.create("http:/""/""sap.com""/""xi""/""XI""/""System""/""File" , "FileName");

String oldFileName=conf.get(key);

String valueNew;

if( oldFileName == null){

valueNew = "HRXML"datewithYeardatewithMs+".xml";

}

else{

valueNew =oldFileNamedatewithYeardatewithMs+".xml";

}

//set the new filename

conf.put(key, valueNew);

Are you using multi-mapping? If so Dynamic configuration does not work.

former_member238007
Contributor
0 Kudos

Hi Hareen,

I am using multi-mapping? so by dynamic configuration i am unabe to get the multiple files, is there any workaround..

Thanks,

--Kishore

Former Member
0 Kudos

We can go ahead with Variable substitution but you have some other requirement like getting the systemdate. For this you need to have an additional field that need to used in the variable substitution.

Thanks,

Former Member
0 Kudos

Hi, Kishore:

Sorry to get back to you late.

Just wonder if the issue solved or not.

I did very similar scenario recently, here I share with you.

When I design targe strucuture, I created a additional node, let us called "Tail"

Under Node Tail, I create a sub-node called "Filename", this value will be used as variable substitution in receiver adapter.

Now you can map any value to node "Filename" now based on your requirements, include your system date.

In Receiver FCC, you do not want "Tail" structure it create a line, or even blank line, you use following in FCC:

Tail.fieldFixedLengths 0

Tail.fixedLengthTooShortHandling Cut

Tail.endSeparator '0'

It worked for me.

Regards

Liang

Shabarish_Nair
Active Contributor
0 Kudos

for multimapping scenario, dynamic configuration will not work.

you will have to go for variable substitution.

former_member238007
Contributor
0 Kudos

Hi Shabarish,

Can i use Dynamic configuration for one structure and Variable substitution for another structure.

and the another clarification was In variable substitution is it possible to capture sysdate, sysdate is not in payload. the required output file should be as below..

abc.IDOCNUM.SYSDATE.XML

As the sysdate is not in payload how to capture this field when we add timestamp whichis available in communication channel the requirement doesnot require the time, the requirement is only i need to drop the file with the sysdate. could you please throw some inputs to drive towards solution..

Thanks,

--Kishore

former_member238007
Contributor
0 Kudos

Hi Shabarish,

Having an issue when i use variable substituion .. can u clarify this..

When i use variable substitution the value i can populate from the target structure but the idoc number i am not getting anywhere in the target structure.. in this case how to get this idoc number..

Thanks,

--Kishore