Tuesday, November 22, 2011

Native sFTP transmission in PeopleSoft

Running Peopletools 8.51.x. A lot has been mentioned about sFTP support in PT 8.51, so today decided to give that a shot. For the POC I am trying to send a extract ascii text file (developed using XMLP eTEXT) via sFTP to a target location.

  1. Setup URL Definition.
    1. My URL has the form sftp://servername/destination_directory. Did not specify the port number, which generally is 22.
    2. Setup URL properties. In my case AUTHTYPE is password, as I am using a basic userid/password type of authentication. Other types like using private/public keys is also available, but I haven't tried that yet. (I did try it here)
    3. I encrypted the password using the password encryption option available on this page.
      1. Note: Though the password is encrypted online, the actual value is stored in a plain text field in the db, so can be queried using a query tool (PS_PT_URL_PROPS, is the name of the table where the properties are stored)
  2. Now test this via the PeopleTools Test Utility page. Once you this working proceed to the next step.
  3. Develop an AE program and add a peoplecode step.
  4. The following code will do the trick
 &returncode = PutAttachment(URL.MY_URL, &filename, &fullpathtofile);

where MY_URL is the URL definition created above
&filename is the filename as in test.txt
and &fullpathtofile is the complete path as in C:\temp\test.txt

That's all, works like a charm, so no more 3rd party products.

Thanks
Deepak.

5 comments:

  1. While migrating the URL definition from one database to another using Application Designer, the URL properties are not copied. So a DMS script or re-keying of the properties is necessary to update the target db.

    ReplyDelete
  2. What if the Source File is in sftp?

    ReplyDelete
    Replies
    1. Not sure I follow your question Sujith?

      Delete
    2. If i want to read a file from a sftp, what i have to do?

      Delete
    3. use GetAttachment function

      Delete