cancel
Showing results for 
Search instead for 
Did you mean: 

Problem RFC2FILE: Filename generation problem

Former Member
0 Kudos

Hi, well first i have to say that the filename is properly created and the file is well written with the exact filename as done in the mapping. So i use an UDF for generating the filename.

But now I am confused, because the filename is also inside of the payload - of course.

Inside the Mapping from RFC to File I have configured an element in the target datatype called <FILENAME>. This is used to give me the right filename for using in file receiver communication channel.

So i am using the tab in the cc for getting the Variable FILENAME with the following expression: payload:MT_Account_SCI_BA,1,FILENAME,1,filename,1

Also I activated the "Adapter specific Message attribute" triggering the first three boxes including "Filename".

Is this the right configuration?! It seems to be because file is created well.

But the Filename is also written inside the payload so how can i get rid of this?!

br

Accepted Solutions (1)

Accepted Solutions (1)

former_member206760
Active Contributor
0 Kudos

in case u need to remove the filename from the content of the file you can use FCC parameter

Record.fieldnames ......,......,filename

Record.fieldlengths .......,......,0

Record.fixedlengthtooshorthandling Cut

This would cut the filename from the content of the file

Answers (2)

Answers (2)

former_member9864
Participant
0 Kudos

Well the wiki in the link also mentioned that you should map it into the root element

Good to hear it works.

former_member9864
Participant
0 Kudos

Hallo Fritz,

variable substitution and adapter specific message atrribute(ASMA) are two different ways to set the target filename dynamically.

I have come accross your case before. After reading dotzens of sdn blogs I decided to use the ASMA, while ASMAs are coming from a special portion of the XML message header called "Dynamic Configuration", which has nothing to do with the payload and will not cause any results in your target file.

1) You should create an UDF to generate the filename in the Dynamic Configuration during the mapping. Check out the following sample of UDF:

http://wiki.sdn.sap.com/wiki/display/Snippets/UsingDynamicConfiguration

2) Disable the mapping of the field "FileName" in your target field mapping

3) Disable the variable substitution in the communication channel

4) Activate the adapter specific message atrribute and select the checkbox of Filename

Hope this helps.

Cheers,

Chen

Former Member
0 Kudos

Hi Chen, thanks for your support.

1. The UDF i have implemented already.

2. i disabled the field in target mapping

3. disabled variable substitution

4. activated adapter specific message attribute and selected the checkbox of Filename

BUT now the CC is giving me an error in RWB saying that

"The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header"

I already checked the spelling of "FileName" in UDF.

What might be wrong?!

br

former_member9864
Participant
0 Kudos

Hi Fritz,

that is because the UDF is not working properly and you are not having any results in the dynamic configuration. Have you adjust the UDF to matching your requirement?

Try to test the UDF in your message mapping. Check the queue.

mfg,

Chen

former_member187339
Active Contributor
0 Kudos

Hi Fritz,

Check the DynamicConfiguration sectuion in SOAP Header of the message in SXMB_MONI. Are you able to see the filename (this will come only when you set the adapter specific identifier in the sender adapter.)

If yes then because you are disabling the target field the mudf code was not invoked and hence there is an error.

I would suggest you to use the udf with the root (topmost) node of the target field. Since its occurrence is 1..1 it will always be created. In message mapping provide the output of the udf code to this target node and re-test

Regards

Suraj

Former Member
0 Kudos

Hi again,

ok i checked the Queue and...is giving me nothing. Therefore i used constants for input parameters, also giving me nothing.

Comparing the code snippet of your previous post i can not see any error. Therefore i am posting me code here, maybe you have a look! br

edit: note that all var are string's.

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

try{

	myFileName = var1 + var2 +  var3 + var4 + var5 + ".txt";
	conf.put(key, myFileName);
}
catch(Exception e){
//*In case advance UDF */
//*result.addValue(e.toString());*/

//* else in case of simple UDF*/
String exception = e.toString(); 
return exception; 
} 

return myFileName;

Former Member
0 Kudos

Hi Suraj,

your hint is last step of what has to be done!!

I mapped the UDF to the root node and now the UDF is used properly.

br to you two!!

thx Fritz!