cancel
Showing results for 
Search instead for 
Did you mean: 

[RFC to File]Problem about Changing file name in message mapping.

Former Member
0 Kudos

Hi,

my problem:

Type:RFC to File

I change the file name in message mapping.

when I call the RFC to send the data twice at the same time, both of the output file names are changed while I only want to change the second output file name.

thanks

Sam

Accepted Solutions (1)

Accepted Solutions (1)

madanmohan_agrawal
Contributor
0 Kudos

Since you have changed the file name in MM so the file name is going to be changed every time you send the data.

But you can put some condition in MM while changing the file name (the condition can be based on some input fields).

Regards,

Madan Agrawal

Answers (2)

Answers (2)

Former Member
0 Kudos

I had added the condition before changing the file name.

according the condition, the first output file name shouldnot be changed but using the file name setted in communication channel. I only want to change the second output file name.

MM's detail:

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

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

if( var1[0].equals(var2[0]) )

{

try

{

conf.put(key, var3[0] );

trace.addWarning("NEW NAME" + var3[0] + " " + var1[0] );

}

catch( Exception e )

{

}

}

Regards,

Sam

Edited by: YONGHE ZHOU on Apr 14, 2009 9:01 AM

madanmohan_agrawal
Contributor
0 Kudos

if( var1[0].equals(var2[0]) )

{

try

{

conf.put(key, var3[0] );

What is var1, var2 and var3 ??

regards,

Madan Agrawal

former_member181985
Active Contributor
0 Kudos

How you are filling values for var1[0], var2[0])........etc....Is it from RFC XML input.......

explain your requirement in general using the RFC XML tag values and how you want to change the file name.

Edited by: Praveen Gujjeti on Apr 14, 2009 12:40 PM

Former Member
0 Kudos

Hi, Madan

What is var1, var2 and var3 ??

--> They are paramaters of the user define funtions.

I have checked the logic of the message mapping. It's OK as I have tested in other test cases.

The problem wasnot happened when I wasnot call the RFC twice to send data at the same time.

former_member181985
Active Contributor
0 Kudos

Can you elaborate more on your requirement in detail..........

Former Member
0 Kudos

In my option, the problem maybe is:

I call the RFC twice almost at the same time, the two files were output almost at the same time.

the second message mapping change the file name before the first output file was output. So the first output file name was also changed.

output file names:

END_FIFC002920090413-171534-053.dat

END_FIFC002920090413-171533-928.dat

the output file that I hope is

FIFC002920090413-171534-053.dat

END_FIFC002920090413-171533-928.dat

Best regards

Sam

former_member181985
Active Contributor
0 Kudos

We cannot send two messages at same time which almost impossible. Definitely there will be some time delay.

And regarding these two messages in XI, XI will create a message ID for each message and the messages are independent.

tell us the logic based on what RFC XML tag values you want to change the filename.........

madanmohan_agrawal
Contributor
0 Kudos

YONGHE says..

The problem wasnot happened when I wasnot call the RFC twice to send data at the same time.

When you call the RFC second time then all values are reset so it treats the message as first message again. So you need to send the both data (1st RFC and 2nd RFC) in one RFC call and handle the mapping accordingly.

Regards,

madan Agrawal

Former Member
0 Kudos

Hi, Praveen

Thanks for your reply~

if the source data is normal ,

the output file is named as "FIFC0029" , with setting of add time stamp;

else if the source data is dummy data ,

the output file is renamed as "END_FIFC0029" in message mapping, with setting of add time stamp;

Best regards

Sam

former_member181985
Active Contributor
0 Kudos

can you provide sample payloads for

"if the source data is normal & else if the source data is dummy data" cases

Former Member
0 Kudos

normal data :

- <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">

- <T_ZIFCTS82100010>

- <item>

<ZZCOMBI>G000002G000002</ZZCOMBI>

<ZZKYKBN>*</ZZKYKBN>

<ENAME_VE />

<ENAME_Z5 />

</item>

</T_ZIFCTS82100010>

</rfc:Z_IFCFR821_ZIFCTT82100010>

dummy data:

- <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">

- <T_ZIFCTS82100010>

- <item>

<ZZCOMBI>G499999</ZZCOMBI>

<ZZKYKBN />

<ENAME_VE />

<ENAME_Z5 />

</item>

</T_ZIFCTS82100010>

</rfc:Z_IFCFR821_ZIFCTT82100010>

if ZZCOMBI equals G499999, change the output file name as END_FIFC0029

Best regards

Sam

former_member181985
Active Contributor
0 Kudos

pass <ZZCOMBI> tag value as input to the below UDF, Change your code accordingly

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
if( a.equals("G499999") )
{
try
{
conf.put(key, "END_FIFC0029" );
trace.addWarning("FileName Prefixed with END_" + );
}
catch( Exception e )
{
}
}

Edited by: Praveen Gujjeti on Apr 14, 2009 4:24 PM

Former Member
0 Kudos

Hi,Praveen

Thks 4 ur reply.

the logic of UDF now in my MM is the same as yours except that I pass by parameter.

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

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

if( var1[0].equals(var2[0]) )

{

try

{

conf.put(key, var3[0] );

trace.addWarning("NEW NAME" + var3[0] + " " + var1[0] );

}

catch( Exception e )

{

trace.addWarning("..." );

throw new RuntimeException("...");

}

}

Best regards

Sam

Edited by: YONGHE ZHOU on Apr 14, 2009 1:31 PM

former_member181985
Active Contributor
0 Kudos

I am not able to understand how or from where you are passing values to these variables var1[0], var2[0] and var3[0] etc...

what are input parameters to your UDF & Can you paste your entire UDF code.?

Former Member
0 Kudos

Hi,Praveen

Here is the source code :

public void HANS01_changeFileName(String[] var1, String[] var2, String[] var3, ResultList result, Container container) throws StreamTransformationException{

for(int i=0; i<var1.length; i++)

{

result.addValue(var1<i>);

}

MappingTrace trace = container.getTrace();

if( ( var2 == null ) || ( var2.length == 0 ) )

{

trace.addWarning( " Getting of dummy code from propety file failed: there is not the field in propety file " );

return;

}

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

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

if( var1[0].equals(var2[0]) )

{

try

{

conf.put(key, var3[0] );

trace.addWarning("NEW NAME" + var3[0] + " " + var1[0] );

}

catch( Exception e )

{

trace.addWarning("..." );

throw new RuntimeException("...");

}

}

}

Best regards

Sam

former_member181985
Active Contributor
0 Kudos

So your UDF is expecting array variables values as input.

provide us a sample array input values to these variables (var1, var2 and var3) from source RFC XML .

Is there any other generating UDF which is providing input to var2 by reading a properties file.

Former Member
0 Kudos

In my MM, the input values to these variables (var1, var2 and var3) are (<ZZCOMBI>array,G499999,END_FIFC0029) ,

var1 is an array of input <ZZCOMBI> item list;

var2 is get from a property file by call another UDF;

var3 is constant value.

the test input data :

I send the data for the first time:

- <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">

- <T_ZIFCTS82100010>

- <item>

<ZZCOMBI>G000002G000002</ZZCOMBI>

<ZZKYKBN>*</ZZKYKBN>

<ENAME_VE />

<ENAME_Z5 />

</item>

</T_ZIFCTS82100010>

</rfc:Z_IFCFR821_ZIFCTT82100010>

so the input values to these variables (var1, var2 and var3) are (G000002G000002,G499999,END_FIFC0029)

the output file name(File1) :END_FIFC002920090413-171534-053.dat

output record: G000002G000002

because the data what I send is the last record, the system send the dummy data for the second time by program.

- <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">

- <T_ZIFCTS82100010>

- <item>

<ZZCOMBI>G499999</ZZCOMBI>

<ZZKYKBN />

<ENAME_VE />

<ENAME_Z5 />

</item>

</T_ZIFCTS82100010>

</rfc:Z_IFCFR821_ZIFCTT82100010>

so the input values to these variables (var1, var2 and var3) are (G499999,G499999,END_FIFC0029)

the output file name(File2) :END_FIFC002920090413-171533-928.dat

output record: G499999

I find that File2(20090413-171533-928) was ouput before File1(20090413-171534-053 ) from the time stamp.

I am not sure about that "XI will create a message ID for each message and the messages are independent." as you mentioned above.

Best regards

Sam

Edited by: YONGHE ZHOU on Apr 15, 2009 3:59 AM

former_member181985
Active Contributor
0 Kudos

Hi Sam,

Are you using any BPM for your scenario?

>I find that File2(20090413-171533-928) was ouput before File1(20090413-171534-053 ) from the time stamp.

It can happen for the below possible reasons.

1. the delay between 2 RFC triggers might be in the order of milli seconds or seconds

2. the payload size of normal case might be greater than dummy data case.

3. the processing time in XI server for these messages at OS level cannot be predicted.

What you can do is provide some delay in between two RFC triggers say for example 10 seconds.

Regds,

- Gujjeti.

Former Member
0 Kudos

Hi,Gujjeti

thanks a lot for your analysis and suggestion:)

I'm not using any BPM for my scenario.

>1. the delay between 2 RFC triggers might be in the order of milli seconds or seconds

-->Yes it is. The second RFC trigger begins after the first RFC data being send.

>2. the payload size of normal case might be greater than dummy data case.

-->Yes. It's hard to make a conclusion only by the time stamp.

But the two output files both have only one record.

>3. the processing time in XI server for these messages at OS level cannot be predicted.

>What you can do is provide some delay in between two RFC triggers say for example 10 seconds.

-->I'll make an attempt.

Best regards.

Sam