11 Replies Latest reply: May 9, 2012 11:07 AM by Jim.Marion-Oracle RSS

    add attachment

      Hello All,

      Can I use add attachment through App Engine.

      For eg:- I have one file on location c:\reports\count.csv
      So system will pick this file and use function add attachment to store that file in database.

      Thanks in advance :)
        • 1. Re: add attachment

          Use the AddAttachment function to transfer a file from one server to another

          • 2. Re: add attachment

            You need to use the PutAttachment or CopyAttachments function to store a file that is on the server to store it to the database.
            It the file is on a server that is not the processcheduler server/application server (depends on how the appengine is run), you can use the GetAttachment function first to retrieve the file and then use the PutAttachment function to store in in the database.

            The AddAttachment function is there to upload one file from an end-user machine to a specified storage location.
            This is a think time function that waits for the a user action, not be used in Application Engines.

            See PeopleBooks for details on the functions.
            PeopleBooks > PeopleTools 8.52: PeopleCode Language Reference > PeopleCode Built-in Functions
            • 3. Re: add attachment
              thanks for your quick response :)

              Can I use GetAttachment / Put Attachment in App engine programs??
              • 4. Re: add attachment
                yes you can.
                • 5. Re: add attachment
                  Can you please tell with an example to do this.

                  If a file place on server so can I use viewattachement without doing addattachment ??
                  • 6. Re: add attachment
                    Please see
                    Main Menu > PeopleTools > Utilities > Debug > PeopleTools Test Utilities
                    On this page you can test all the attachment functions.
                    Look at the code behind the page how to use the functions.

                    • 7. Re: add attachment
                      Chapter 2 of my book has a good explanation of the File Attachment API: http://www.amazon.com/PeopleSoft-PeopleTools-Techniques-Oracle-Press/dp/0071664939. It is quite heavy on AddAttachment, ViewAttachment, etc, and light on GetAttachment and PutAttachment. If you have a good understanding of the Add and View versions, then the Get and Put are pretty easy to grasp. They are basically the same, but with different input and output destinations.
                      • 8. Re: add attachment
                        thanks for your response.

                        Can I use putattachement in app engine, if yes so help me with code exmple.

                        Plz help
                        • 9. Re: add attachment
                          Did you check the PeopleBooks?

                          • 10. Re: add attachment
                            yes i checked but it is saying for FTP, however I am having that file already on server and want to insert in record using putattachment.

                            Thanks in Advance :)
                            • 11. Re: add attachment
                              Yes, you can use it with App Engine. App Engine usage is just like any PeopleCode usage. Just be sure you specify the file location based on the perspective of your process scheduler rather than your app server (unless you are using CallAppEngine).

                              The examples in PeopleBooks are very relevant, and very short: http://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tpcl/htm/tpcl02.htm#_6453b1b1_1355ab71343__18ce. If you have a record URL instead of an FTP URL, then change the URL parameter to RECORD://YOUR_RECORD_NAME.

                              For delivered examples of PutAttachment, open App Designer and use Edit > Find In and search for PutAttachment in Text Strings in PeopleCode inside your Entire Database. I found quite a few hits among delivered PeopleTools PeopleCode. PT_IB_WSDL.UI.ConsumeWebService has a great example of using PutAttachment in PeopleCode. Using PutAttachment from App Engine is exactly the same.