Project and Portfolio Management Practitioners Forum

Document attachment using sql

Go to solution
Respected Contributor.

Document attachment using sql

We have requirement to attach document to package using either a SQL script or ppm command.

Found a way  to create the refrence to package as attachment using sql. but not sure how to create entry in knta_document table which points to real file.

Another question is how ppm store attachments i can see numbered folder inside attachment folder in which attachments exist on server...


Please help

Honored Contributor.

Re: Document attachment using sql



can you please share which package contain that function to attach a file to package. in ppm attachments stored in db with holder id, and this id is the prefix for attachment in file system. if you checked with that package you are able to attach a file, then no need to worry about documents table, it should do it also.i checked util packages there is no such function.



Respected Contributor.

Re: Document attachment using sql



yes you are right it is storing the documents with holder_id. I am using the KCRT_REQUEST_UTIL.CREATE_REFERENCES package.But it is not updating the document table.It is just updating the reference table.


Do you know any other OOTB function for this.

Acclaimed Contributor.

Re: Document attachment using sql

Hi Varun,


The number folder in the attachment directory refers to the last two digits of "DOCUMENT_ID" in KNTA_DOCUMENTS table.


So if the ID is genereted like 32456, then the document will be stored in "56" folder, further within this directoy the file is stored with the name prefixed with Document ID.


In PPM there no OOTB SQL utility to upload the file, rather it is done via Java utility/classes.


In order to implement your requirement, you can proceed like:


  1. Create a new record in KNTA_DOCUMENT table
  2. Get the new Document _id
  3. FTP/SCP the file to the Attachement directory based on the Document_id
  4. Finally use KCRT_REQUEST_UTIL.CREATE_REFERENCES to create a reference
Utkarsh Mishra

-- Remember to give Kudos to answers! (click the KUDOS star)
Respected Contributor.

Re: Document attachment using sql

Right utkarsh i am able to figure it out this process and able to attach it.


But it is cumbersome implementation there should be OOTB utility to do it in simple way.Thanks :)