Spend Management Blogs by Members
Check out community member blog posts about spend management and SAP Ariba, SAP Fieldglass, and SAP Concur solutions. Post or comment about your experiences.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
1,620

As promised, this is the sequel to Working with FTP folders in SAP Sourcing 9.x

SAP Sourcing 10 introduces the FileTransferConfiguration BO which allows for a "more configuration, less coding" approach in working with FTP folders.

**WARNING**- this blog post will make use of Internal APIs. Even if I have tested and confirmed them working in 10.x versions, great care should be taken while implementing and supporting these APIs.


  • Prerequisites
    • Define your File Transfer Configuration (FTP location for file exports)



SCRIPTING part


  • Required imports

import java.io.File;
import com.sap.odp.common.platform.HomeLocator;
import com.sap.odp.doccommon.filetransfer.FileTransferConfigBo;
import com.sap.odp.util.filetransfer.FileTransferClientIfc;

  • Prepare file
    • For example let's extract the first attachment in the document

File exportFile = doc.getAttachments().get(0).getAttachment().getFileData(session);

  • Write file to FTP

ftcHome = HomeLocator.lookup(session, "odp.doccommon.FileTransferConfig");
FileTransferConfigBo ftCfg = ftcHome.findByExternalId("EXPORT_EXT_SYSTEM");
FileTransferClientIfc ftc = ftCfg.getClient();
try {
     // if you plan to export multiple files with loops, implement them here, aka build your FTC client only once
     ftc.putFile(exportFile, ftCfg.getUrl() + exportFile.getName());
} finally {
     ftc.close(); //always make sure you close the client
}

Bogdan Toma

3 Comments
Former Member
0 Kudos

Thank You Very Much Bogdan, you've saved my life! Keep up the great work.

Former Member
0 Kudos
Dear Bogdan,

 

We do not see above classes in sourcing API list to utilized FTC in the script. We are currently in 10.0.11 version. Are these classes  available in this versions. Please let us. It would be great help.

 

Thank You,

Gurvi.
Former Member
0 Kudos
Just use those imports provided (!!! internal APIs) ... The script will work, but you won't find the classes in the official (public) API.

Bogdan
Top kudoed authors