With the multi lingual support of SAP XI we can achieve the desired result through either JAVA or ABAP. It depends on the development team to choose the technology.
I will demonstrate the same by highlighting the problems in FTP adapter on the J2EE stack and how my custom FTP ABAP Sender adapter did overcome it. We followed a generic design approach in our project in which we did not prefer to design one communication channel per interface. We used a generic communication channel, which can read any file structure using a single outbound interface. It works fantastic when we give a wild card pattern *.* in the filename but the problem comes when I want to select files with regular path expression. I posted the same on SDN forums where people gave a solution to either enhance the module processor to filter the files or using some templates for enhancing the features of XI. I ruled out the first option, as I dont want to get the files, which are not required for my interfaces and the second option is also ruled out as there are no pre-defined procedures for the same. I have created my own ABAP program, which connects to the FTP server through the parameters specified in the report interface and downloads the files to the XI temporary folder and moves into a folder where XI FTP adapters are polling for the files. We can monitor it centrally by creating a report tree and giving link to SXMB_MONI and ZXISNDFTPADAPTER.I tested this approach and it works fine.
Let me briefly explain the scenario. I configured 3 communication channels for metering, purchasing, supply point streams. I cant give a *.* in the filename field because all the files of 3 streams are in the same folder on the FTP server. Communication channel configured for metering has to fetch only metering files and this can be done only using regular path expressions. FTP java adapter does not support it.
So I have written my own Sender ABAP Adapter, which has a similar interface like Sender Java Adapter.
Source Code Snippet:
1.Cut and Paste the code in the se38 editor.
2.Include the text elements as shown below by using the menu option GoTo->Text Elements and press F8.After pressing F8 an initial screen will appear which has UI similar to Sender Java FTP Adapter where user can specify the parameters which is explained in the step-3.
3.Specify FTP Connection parameters as shown below.
4.Choose Processing Mode, File Type, Transfer Mode as shown below.
5.Executing operating system commands from XI server.
6.Error log is created if there are errors and the same is listed on the screen once F8 is executed after specifying the required parameters.
Sample Screen Shots:
I want to select all the SC9 and MRI files from specified directory on the FTP server.I have given sample screen shots for achieving the desired functionality.
MRI and SC9 files are present in the /local/data/interface/dx5/ixfiles/inbound folder on the FTP server.
XI ABAP FTP Sender Adapter:
The parameters have to be appropriately fed into the report program as shown below.XI directories specified here should be present in AL11 transaction and the basis administrator should provide the required authorization for you to perform the FTP.
Files downloaded on the XI server:
After executing the report program we can see the files in the directory specified above using transaction code AL11.
Configurations in the Integration Directory:
I configured sender file communication channel to poll into the shared folder metering and do the necessary transformation routing specific to the metering stream.
I scheduled the report program in sm37 to poll for every 10 minutes, which will download all metering files into the metering folder and post them as Idocs into SAP ISU. I can also achieve multitasking by scheduling the report with different variants.Ex:I can schedule the same report for purchasing stream with the parameters related to that. Well, this is just a skeletal adapter and it can be enhanced with rich functionality as desired by the developers. We can also code SFTP adapters from ABAP. It is very simple to do it in ABAP with the help of API’s provided by SAP. It is very very easy to develop reciever adapter after cracking the ABAP Code and I leave that to the readers.:)
Note: I have not performed any stress or load testing on this code. I could use it in the project, as the volumetric is not too heavy. We can tune the performance if it is useful.