cancel
Showing results for 
Search instead for 
Did you mean: 

File-PI-RFC scenario with extraction of contents in the filename

Former Member
0 Kudos

Hi All,

I am working on File to RFC scenario.

Here the file name is like 'ABCD_XYZ_1234_DATE' where the date is in yyyymmdd format.

I have to read this filename & the date in the filename is to be mapped with one of the RFC parameter.

Also how would I trigger the Interface if the file resides in PI server or on local mchine.

How to configure the processing parameters in sender comm channel if I want to read the file after every 15 mins?

Thanks,

Amit Patil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

By writing simple UDF in your mapping you can Acheive this

Try this Once

DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

String MyFileName = dynamicconfiguration.get(key);

String str[] = MyFileName.split("_");

return str1[1];

Map this to the date parameter(RFC) in the mapping .

If the file resides on Local machine then you can use FTP and if it is on PI server then NFS as Transport protocol.

If you want read the file for every 15 min there are 2 options

1) Set the poll interval time to 900 sec

2) Configure ATP in RWB

Configuring ATP in RWB :

http://www.dataxstream.com/2010/11/configuring-availability-time-planning-in-sap-pi/

Thank & Regards,

Deepthi

Former Member
0 Kudos

Hi All,

First of all - Thanks to All.

After keeping the file on PI server and configuring NFS as Sender Transport Protocal, I am unable to see the message log in SXMB_MONI.

I kept poll interval as 5 mins i.e. 300 secs.

How would I know whether the interace has got triggered or not? Or is there any else triggering point?

Thanks & Regards,

Amit Patil

Former Member
0 Kudos

Hi Amit,

Did you check the message status in RWB?

Former Member
0 Kudos

Hi All,

Now I am able to monitor XML messages.

But now the problem is of Message Mapping in which I am getting error is as below.

com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_MM_Vista_Royalties_for_proxy_: RuntimeException in Message-Mapping transformatio~

The UDF I have used in the message mapping for the date passed in the filename is as below.

public String MapPostDt(Container container)

{

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

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

String SourceFileName = conf.get(key);

String str[] = SourceFileName.split("_");

return str[3];

}

Is it the correct one?

Regards,

Amit Patil

Former Member
0 Kudos

Hi Amit,

UDF code is Correct ,

I think it is due to cache problem ,

jus change the mapping description and then save and activate .

Hope it works fine ..

Former Member
0 Kudos

Hi All,

When I am monitoring XML message, in the pipeline process under Inbound Message under SOAP Header, I am unable to find the step for DynamicConfiguration which should appear when Java Mapping(UDF) is used.

Can anybody guide me as soon as possible?

Regards,

Amit Patil

stefan_grube
Active Contributor
0 Kudos

> When I am monitoring XML message, in the pipeline process under Inbound Message under SOAP Header, I am unable to find the step for DynamicConfiguration which should appear when Java Mapping(UDF) is used.

You have to check the corresponding parameter in communication channel for sender file adapter, otherwise the fields are not populated.

Former Member
0 Kudos

Hi All,

I am not getting what parameters to be checked in the sender comm channel.

Why I am unable to monitor the DynamicConfiguration step under SOAP Header of Inbound Message although I have used UDF/Java Mapping?

Regards,

Amit Patil

Former Member
0 Kudos

Hi amit,

Have you checked the ASMA checkbox in Sender Communication channel in advance tab

and under that check the FileName checkbox

Former Member
0 Kudos

Check File name and then see Inbound message->Dynamic configuration.

--Divyesh

former_member192851
Active Participant
0 Kudos

Advanced Tab

- Use Adapter-Specific Message Attributes

- File Name

Former Member
0 Kudos

Hi All,

Thanks to all.

If I want to read every file from the specified directory mentioned in sendr comm channel & after processing the file delete the file then what settings I have to do?

All other logic remains the same.

Thanks & Regards,

Amit Patil

anupam_ghosh2
Active Contributor
0 Kudos

Hi Amit Patil,

In sender communication channel set processing parameters -> processing mode ->"Delete".

regards

Anupam

Former Member
0 Kudos

Hi All,

If I want to read every file at the specified location then can I set the filename as *(asterisk) ?

Thanks & Regards,

Amit Patil

anupam_ghosh2
Active Contributor
0 Kudos

Hi Amit,

yes you can put an asterisk.

If your files have an extension always then you can use asterisk dot asterisk too.

regards

Anupam

Former Member
0 Kudos

Hi All,

Is there an provision to read all the files(kept in the directory at the specified location) one by one, process those files and then delete those files till that directory gets empty?

How to configure such scenario?

Thanks & Regards,

Amit Patil

Former Member
0 Kudos

Hi All,

Any update on this?

Is there an provision to read all the files(kept in the directory at the specified location) one by one, process those files and then delete those files till that directory gets empty?

How to configure such scenario?

Thanks & Regards,

Amit Patil

Former Member
0 Kudos

Amit

Use file name as *.extension. Keep you sender communicatiion channel in delete mode under processing tab. It will read the all the files one by one and after processing the file it will delete that file.

Regards

Raj

Former Member
0 Kudos

Hi amit,

For reading all the files from Particular location : In sender Communication channel give File Name parameter value as *.extension

For deleting the files that are picked : In sender Communicarion channel in processing tab we have a parameter "processing mode" Set that to Delete

Former Member
0 Kudos

Hi All,

If I want to read(process & delete) only .txt files having specific pattern in their filename, how shall I configure it?

Thanks & Regards,

Amit Patil

Former Member
0 Kudos

If you are looking for the selective reading of the inbound directory then please refer here..

http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm

Advanced Selection for Source File

If you want to set an exclusion mask for the File Name specified above, or if you want to specify multiple directories using a file name mask and exclusion mask, set the Advanced Selection for Source Fileindicator.

○ Specify an Exclusion Mask for the file name specified above.

You want to process all files that have the extension '.txt', but want to exclude all files that begin with the letter 'a'. To do this, enter .txt for File Name, and a for Exclusion Mask.

○ You can enter additional specifications for source directories, file names, and exclusion masks in the table. This data is processed in addition to the details specified above.

Answers (3)

Answers (3)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Amit Patil,

Do you need only the date then I would like to do a little change in the return statement within Deppthi's code above.

It will be return str1[3];

All other required settings for the purpose has been already stated in above posts.

regards

Anupam

Former Member
0 Kudos

Thanks Anup,

Yup,For date String return statement must be str1[3]

Thanks and Regards,

Deepthi

Former Member
0 Kudos

Hi,

>>Here the file name is like 'ABCD_XYZ_1234_DATE' where the date is in yyyymmdd format. I have to read this filename & the date in the filename is to be mapped with one of the RFC parameter.

For this use ASMA Properties in file sender communication channel and write a UDF using dynamic configuration and split the text n date from filename.. and then pass the date as input to RFC paramter..

mapping will be UDF->RFC paramter..

>>Also how would I trigger the Interface if the file resides in PI server or on local mchine.

Use FTP server if it resides on Local machine,if on PI server go for NFS transport protocol

>>How to configure the processing parameters in sender comm channel if I want to read the file after every 15 mins?

For this increase poll interval in sender communication channel

Former Member
0 Kudos

Hi Amit

Here

1. Set your Adapter Specific Parameter for your sender file adapter. Make use of this blog by michal

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14 for achieving the same

2. With the help of the code described, obtain the Dynamic configuration parameters where you get the file name.

3. With the help of UDF extract the date from the file name.

4. With the help of UDF map the required parameter to RFC's Parameter

DONE!

Regards

Ramesh