cancel
Showing results for 
Search instead for 
Did you mean: 

Adapter Module to get the Source Directory Name of File Adapter at Runtime

former_member201264
Active Contributor
0 Kudos

Hi All,

I have a requirement where i need set the Source Directory Name based  on the Sender Communication Componet and Party of the Scenario.

For this i have searched a lot in the SDN and Google, I got some information that is SAP NOTE 819761.

This NOTE says part of the java code not all as below:

---------------SAP NOTE 819761-----------------------------------------------------------------------------------------------------------------------------------------------

Summary

Symptom

 

You want to access the name of a file sent through a File Adapter Sender channel from a custom developed XI module.

Other terms

 

XI 3.0, XI30, File Adapter, Module Processor, Module Development, Modules

Reason and Prerequisites

 

The functionality described in this note requires SP 9 or higher of the component XI ADAPTER FRAMEWORK CORE 3.0.

Solution

 

The File Adapter passes the path of the processed file to the module processor. This information is available in a Hashtable object accessible as as supplemental module data under the name "module.parameters" within the module's 'process' method.

For further information, please take a look at the example code below:

public ModuleData process(ModuleContext mc, ModuleData md) throws
  ModuleException
{
  [...]

  Hashtable mp       = (Hashtable)
  md.getSupplementalData("module.parameters");
  String    fileName = null;

  if (mp != null)
    fileName = (String) mp.get("FileName");

  [...]
}

Important: Please note that the file name information is only accessible by modules that run in the File Adapter sender module chain.

---------------SAP NOTE 819761-----------------------------------------------------------------------------------------------------------------------------------------------

I can use source directory as below:

public ModuleData process(ModuleContext mc, ModuleData md) throws

ModuleException

{

[...]

Hashtable mp = (Hashtable)

md.getSupplementalData("module.parameters");

String fileDirectory = null;

if (mp != null)

fileDirectory = (String) mp.get("Directory");

[...]

}

Please let me know how to implement this NOTE by writing EJB clsses.

I need basic steps as I am new to java and particularly EJBs.

How to access the Party and Componet Names to set to the source directory?

Regards,

Sreeni.

Accepted Solutions (0)

Answers (2)

Answers (2)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

there's no need to use an adapter module for this requirement

you can just use ASMA (lots of blogs on that)

and use parameter - Directory - to get the directory name in the mapping

more Adapter-Specific Message Attributes on:

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

and blogs on SDN for ASMA (how to get it in the mapping)

this is very easy and does not require any modules,

Regards,

Michal Krawczyk

former_member201264
Active Contributor
0 Kudos

Hi Michal,

My  requirement is to get the source directory like \\DEVECCServer\interace\Myfile.txt in PI File Sender Adapter Channel. This Sender Source Directory is from SAP ECC system.

I need access the host name of the Sender ECC Server (Business System) and that should be used to create create the sourceDirectory at runtime for this sender file adapter.

I have seen so many blogs and max said Adapter Module is the soultion.

Even I am new to adapter modules with java and Ejbs.

Even I feel good to have the with ASMA and Mapping.

Please guide me with any artical or Blog to configure the sourceDirectory at run time.

Regards,

Sreeni.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

this blog will tell you what ASMA is (the same works on sender and receiver adapters)

http://scn.sap.com/community/pi-and-soa-middleware/blog/2006/04/18/dynamic-configuration-of-some-com...

the rest you will find yourself - just try - parametr you want to use is - directory

Regards,

Michal Krawczyk

smavachee
Active Contributor
0 Kudos

Follow below document for adapter module development process with expected java code as per your business requirement.

Developing Adapters and Module...

Also you will find more detail here

Developing Adapters and Modules

Regards,

Sunil