JointLantic

PeopleCode To Browse for File and Save attachments To FTP or Database Server

PeopleCode To Browse for File and Save attachments To FTP or Database Server

/* Using add_attachment if required- only using AddAttachment
Declare Function add_attachment PeopleCode FILE_ATTACH_WRK.ATTACHADD FieldChange;
add_attachment(FUNCLIB_UTIL.FTPSITE, &FILEEXTENSION, &SUBDIRECTORY, &FILESIZE, False, &recname, FUNCLIB_UTIL.ATTACHSYSFILENAME, FUNCLIB_UTIL.ATTACHUSERFILE, &MESSAGE_LVL, &RETCODE);
*/

/* All the following assignments to &URL_ID work – I have commented off all except one in each case, because only one assignment is required */
/*&URL_ID = “RECORD://HRS_ATTACHMENTS”;*/
/*&URL_ID = “ftp://user:password@ftpserver.peoplesoft.com:6000/”;*/
/*&URL_ID = “ftp://user:password@ftpserver.peoplesoft.com:6000/PATH”;*/
/*&URL_ID = “URL.HRS_INT_ATCH”;*/
/* The following goes to the default folder (default folder assigned to the login user id) on the FTP server – example: /sw/app/psoft/psofthr*/
&URL_ID = “ftp://pmilind:password@mycompany.com”;
/* If the default folder on FTP server is /sw/app/psoft/psofthr then the following puts it to /sw/app/psoft/psofthr/log */
/*&URL_ID = “ftp://pmilind:password@mycompany.com/log”;*/
/* The following puts the file on the /tmp folder on the system root */
/*&URL_ID = “ftp://pmilind:password@mycompany.com/../../../../tmp”;*/

If Exact(Left(&URL_ID, 4), “URL.”) Then
   &RETCODE = AddAttachment(@(&URL_ID), &ATTACHSYSFILENAME, &FILEEXTENSION, &ATTACHUSERFILE, &FILESIZE);
Else
   &RETCODE = AddAttachment(&URL_ID, &ATTACHSYSFILENAME, &FILEEXTENSION, &ATTACHUSERFILE, &FILESIZE);
End-If;

References:
http://www.pscustomizer.com/peoplesoft-examples/attachments/
http://peoplesoft.ittoolbox.com/groups/technical-functional/peopletools-l/write-file-into-database-using-sqr-2528747
https://forums.oracle.com/forums/thread.jspa?messageID=10320192
http://docs.oracle.com/cd/E15645_01/pt850pbr0/eng/psbooks/tpcl/book.htm?File=tpcl/htm/tpcl02.htm#H4541 
http://docs.oracle.com/cd/E15645_01/pt850pbr0/eng/psbooks/tpcd/chapter.htm?File=tpcd/htm/tpcd11.htm
http://peoplesoftstuff.blogspot.com/2012/07/upload-file-from-local-to-server.html 
http://peoplesoft.ittoolbox.com/groups/technical-functional/peopletools-l/browse-functionality-on-run-control-page-819632

Exit mobile version