cancel
Showing results for 
Search instead for 
Did you mean: 

Find the File name from directory

Former Member
0 Kudos

Hi Experts,

My Scenario is:

Pick the file from the Directory, Based on the file name, get the Q information from R/3 system and place the file into MQ.

My Question is : How can I get the file name?, any one please guide me..

Thanks for your help,

Thanks,

SR

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

use Adapter specific attributes.

http://help.sap.com/saphelp_nw04/helpdata/en/c8/98e7d5c1620642973565ea3dd319d1/frameset.htm

you can access the constants by using the method getTransformationParameters() of the container object or by using the method getParameters() of the GlobalContainer object.

Details.

http://help.sap.com/saphelp_nw04s/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm

Former Member
0 Kudos

Thanks.

Could you please explain clearly...

Former Member
0 Kudos

In the sender file adapter, you need to tick the check box ( Adapter-Specific Attributes ). This will add the adapter specific attributes ( filename, directory and so on) to the header of the message. Then, you can write the code to access in the UDF.


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

DynamicConfigurationKey key = DynamicConfigurationKey.create(
    u201Chttp://sap.com/xi/XI/System/Fileu201D,
    u201CFileNameu201D);

String filename = conf.get(key);

Former Member
0 Kudos

My Question is : I want to know the file name....

in File i don't have header and file name...

justin_santhanam
Active Contributor
0 Kudos

SR,

You don't need to have the File name inside your file. There is the concept called ASMA -Adapter Specific Message Attributes, if you select this attribute in your sender comm.channel, your file name will be grabbed and stored in XI headers. By using the above code provided by Anand, you can read it from the header.

Hope it's clear!

raj.

Former Member
0 Kudos

HI SR

You need to enable the Adapter-Specific Message Attributes

enable the FileName under this. Enabling this will allow to have this parameter as XI header

You can check this value is generated or not using SXMB_MONI -> Inbound message -> SOAP header -> Dynamic Configuration.

This will be captured under http://sap.com/xi/XI/System/File name = FIleNameu201D

Now code given by Anand above will allow you to use this FileName in mapping. Based on this you can check R/3 system for relevant file.

Hope this make you confortable with filename concept

Thanks

Gaurav

Former Member
0 Kudos

Is there any Module setup required...

Please let me know..

Thanks

Answers (1)

Answers (1)

prateek
Active Contributor
0 Kudos

For Adapter Specific message attributes access, UDF is enough. Module is not required.

Regards,

Prateek