cancel
Showing results for 
Search instead for 
Did you mean: 

Deriving info from source text file

Former Member
0 Kudos

Hi

I need help / links suggestions in the following scenario

In an incoming file in one of the interfaces the source file to be polled by PI will contain the company code in the file name

I need to pick that from the file and use it in the mapping to pass it to the IDOC.

for eg .. ABCCompcode123.txt is the file name i need to derive the comp code from this and map it to the compcode field iin one of the IDOCS

kindly let me know how this can be achieved

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

As already suggested use DynamicConfiguration by writing a UDF,

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

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

String ourSourceFileName = conf.get(key);

// write here logic to take out compcode from filename

return compCode;

Also, set adapter specific message attributes in sender file adapter, refer

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

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can pick the name using DynamicConfiguration FileName property. Then just use one of text transformations.

Regards,

Radek

Former Member
0 Kudos

Thanks for your reply

Actually i need to pass the infor from the Source file and then put in the IDOC in one of the fields

is there a link or a blog i can refer to cos most of the stuff ihave checked talks about writing a UDF and creating a target element ,but im not sure how is that to be done if the target is an IDOC

please help me if you can with a link or a blog

Former Member
0 Kudos

As I understand you need to create Flat File to IDOC scenario. First step would be get the source message using File Adapter with Content Conversion and next mapping to IDOC.

Simple scenario is described here:

http://www.riyaz.net/blog/xipi-file-content-conversion-for-simple-structure/

former_member272911
Participant
0 Kudos

Hi,

use a file ad apdater to read file in the mapping pick only the file name from that using UDF in the mapping and pass then use that target mapping in mapping the idoc.

Thanks

kamath