cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic filename access

Former Member
0 Kudos

Hi all,

I am trying to do dynamic file renaming for my file to file scenario.

I mapped the filename to an output field and i can see it in Technical Ruoting/Payload in sxmb_moni also. But I am unable to generate the file using the variable substitution method.

In MONI, I can see only upto Call Adapter. After that Response comes..I am unable to find the Outbound message and its payload.

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Rahul,

for more informations what's going on at adapter plz have a look to the adapter monitoring of runtime workbench.

Regards,

Udo

Former Member
0 Kudos

HI

In RWB in my adapter this is the message

Message processing failed: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: file

In the reciever adapter,In file Access Parameters I mentioned my filename as %file%

And I enabled variable substitution. There i put variable name as file and Reference as payload:order,1,fname,1

And down in the adapter specific, I enabled filename

Did i do somethin wrong?

Thanks for the help

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Rahul,

<b>You need not select the option Adapter Specific Identifiers -- FileName in your Receievr File adapter.</b>

if you do this, File adapter will look for the filename from the Dynamic COnfiguration.

Adapter Specific Identifiers is used when you want the Source File name to be passes as the destination filename.

Just remove this from your Receiver File adapter and let us know if it works.

Regards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

Even if that doesn't work, then check my replt to this thread.

Regardsm,

Bhavesh

udo_martens
Active Contributor
0 Kudos

Hi Rahul,

i suggest a mistake by giving the reference. Dont use any space. Your reference means: Root element 'order', under this element 'fname'. May be a bug by spelling?

Regards,

Udo

Former Member
0 Kudos

Hi all,

I am not getting Response Payload in MONI. Only the SOAP Header and Body is there. Also only one of the status flags is shown (in black n white). I cant find any other flag in MONI.

\

In RWB : the sender adapter -

Configured at 2006-07-19 05:42:59 UTC

History:

- 2006-07-19 05:44:45 UTC: Polling interval started. Length: 60.000 s

- 2006-07-19 05:44:45 UTC: Processing finished successfully

- 2006-07-19 05:44:19 UTC: Processing started

Receiver adapter -

Configured at 2006-07-19 05:25:24 UTC

History:

- 2006-07-19 05:44:53 UTC: Processing finished successfully

- 2006-07-19 05:44:46 UTC: Processing started

Former Member
0 Kudos

Hi,

Please make sure that the variable, file is not starting or ending with extra spaces when specifying it in variable substitution table where payload is specified.

Also, enabling adapter specific identifiers is not required, although it wouldnt cause any error.

Also make sure, that the values you are specifying after payload: is correct.

The values are case sensitive.

Regards,

Smitha.

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

<i> am not getting Response Payload in MONI. Only the SOAP Header and Body is there. Also only one of the status flags is shown (in black n white). I cant find any other flag in MONI.</i>

In that case, the message is not even passed to your File adapter.

There should be a chequered flag on both sides, and then , it implies the mesaage is passed to file adapter.

Just check if the message is stuck in the Queue?

Regards,

Bhavesh

Former Member
0 Kudos

Hi Rahul,

Please check if you are using file content conversions to write your file, then your filename field (here fname) should also be written in your target destination.

Regards,

P.Shridhar.

Former Member
0 Kudos

Hi all,

Thanks for the help. My file is produced with the new name. Think some problem with Queue was there. THe Basis guy took care of it

And now I am trying to do my Dynamic File rename using FTP adapter. What I need to do is just to pick the file from the source, rename it ( Using adapter Specific Atrributes ) and put it in target directory. I dont require any mapping or validation inside.

So if I am using FTP, what about the Data Type Message Type and Mappings..can I do without any mappings? Also I need to change the file name..fo rthat can I still do the coding in the Message Mapping?

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

If you want to use XI as a mere FTP, check this blog,

/people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp

Create a Dummy Datatype, Message Type and use the same Message type in your Inbound and Outbound Interfaces.

No message mapping is needed.

To change the file name using Adapter Specific Identifiers, this code in a UDF will do,

String newfilename="";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
 
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
// Get Sourcefilename
String oldfilename=conf.get(key);
String newfilename="FILENAME";
conf.put(key, newfilename+".txt");

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh

I went through the blog. Will this be a good solution for very large files? Here what is done is we are copying everyline to the output file (my understanding)..

And thanks for that code...

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Rahul,

<i>Here what is done is we are copying everyline to the output file (my understanding)..</i>

think you have got it wrong.

These are the steps you need to do,

1. Create a Dummy Datatype.

2. create corresponding message Type.

3. Create 2 message interfaces -- one inbound and one outbound with the same messagetype created in step 2.

No Message mapping and Interface mapping.

Now, as you have the same message type in the Source and Target message Interface , you do not need to have a message mapping.

So, you file adapter will pick up the file --> Receiver determiantion will take place --> Interface Determiantion --> ( No Interface mapping ) --> Technical Routing --> Message (file) sent out of XI.

I dont think a huge file should cause any issue. The file is not read line by line.

Regards,

Bhavesh

Former Member
0 Kudos

Thanks for that

But If we are not creating any Message Mapping where shall I create the UDF for renaming the file using the code you gave earlier? Im still in the learning process ple bear with me

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

I didn't think of that..!! One option, write an Adapter Module, not sure how feasible though.

Another, use Adater Specific Indetifiers in the Sender and Receiver File adapter.

In the receiver file adapter, you have options like AddCounter, AddTimestamp, etc.You can use them to add them to the Source Filename when the target file is being created.

Regards,

Bhavesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Rahul,

Did you give the variable substitution parameters in filename scheme like <b>%filenamevar%</b> and referred the same in Variable name as <b>filenamevar</b> and reference as payload:root,1,str1,1,tag,1 ?

Did you check your adapter status in RWB -Adapter monitoring?

Regards,

Ananth

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

1. In SXMb_MONI, can you see the response payload?

Is there a chequered flag on both sides of SXMb_MONI?

2. Check the Status of your File adapter in the RWB. Does it have any error?

Regards,

Bhavesh