Retrieving file attachments from SAP through SQL/ASP.NET

We recently implemented SAP Financial and are having our AP staff scan physical invoices into PDF files and attach them to the AP Document in SAP through the "Services for Object" menu.  

I identified that these files are stored in SOFFCONT1 with SOOD having file attribute information, however I need to find a way that I can just directly retrieve the files from SQL Server (where our SAP db resides).  I've worked with binary data types in the past and using ASP.NET to retreive the file for the client to download, however it seems like SAP is storing these files in an odd format and splitting them up in 32,000 byte chunks in the CLUSTD file in hexcode.

Where do I start to even try and interpert how they are doing things here and how I can retreive these files?

My ultimate goal is to have a web portal for our clients to log in to and view expense data with the option of downloading the PDF files associated to them.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

BuckaConnect With a Mentor Commented:

It would best to have an ABAP developer create a Function Module in SAP that uses the cl_bds_document_set class to retrieve your documents.

You can then call it remotely from your application

It would be a good idea to ensure that the process for loading these documents includes a specific signature to ensure you retrieve only the documents relevant for this process. You don't want your client viewing internal documents that a User may have added for internal use.

Perhaps you could create a custom application in SAP that stores these documents using the class cl_bds_document_set. This way you could default some signature data to identify the documents for this process.


the answer is you don't directly... you go through sap and ger a sap api to give them to you...
itcaptainAuthor Commented:
Bucka - I would assume there are no existing SAP APIs that would do this for me?

Basically I will be accessing PDF files attached to an AP invoice document.  Users on the web application will have a view limited to AP invoices that pertain to them and therefore the paramters I would pass would be the AP document ID and/or line item ID that the PDF file has been attached to.

I just need a way that when they click that hyperlink, it pushes the parameters to SAP through this API, and then the API would return a binary file where the web browser would prompt the user to "run" or "save" just like any file download.

I'm sure this has been done by other SAP clients as this is probably not a unique requirement, just wish I knew who and their solution.
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

LowfatspreadConnect With a Mentor Commented:
does this help?

but basically this needs to be done by a competent abap developer, that all part and parcel of committing to the "Great" SAP

if you don't currently have those skills, then you have some interesting training courses ahead of you.

good luck

The class i mentioned will do it.
All you need is a remote enabled Function Module "Wrapper" to simplify the the call from your application.
If a developer couldn't do this in less than 2 days I would be surprised.


itcaptainAuthor Commented:
Thanks guys.

Have been brainstorming with my SAP VAR and we have come up with a solution where they will develop a routine that will run on a daily basis and save a copy of all the PDF attachments into a directory on the server using a filename strucured with key fields.

This would then allow me to develop an ASP.NET application where a download link for the user will fetch the file, where the download link will be dynamically generated based on which record the client picked.

Although you may say this is redundant having to the files taking storage in the DB and on a file system, but we're only looking at about 1 - 2 GB a year worth of PDF files and as you know storage is cheap so not an issue.

Thanks for your time on this.

I'll allocate points appropriately.
itcaptainAuthor Commented:
There was no definitive solution to this as it will require custom programming but the answers definetely provided direction.
All Courses

From novice to tech pro — start learning today.