Sometimes application needs to upload some kinds of document( attachment ) from the user desktop and store in sap data base or in content server.
The below post shows how we can reuse the FPM_ATTACHMENT_WRAPPER component to upload any document. Once we receive the source place i.e URl then the document content can be uploaded by the standard frontend service methods or GUI_UPLOAD FM technique and then it can be stored any where as desired.
FPM_ATTACHMENT_WRAPPER component provides either ECM ( Enterprise Content Management ) or KPro( knowledge Provider ) storage types to store the document but the post doesn't speak in detail about the storage types but just tells how FPM_ATTACHMENT_WRAPPER component can be sued to just reuse the ATTACHMENT WINDOW. Currently FPM_ATTACHMENT_WRAPPER provided in the list uibbs.
On the list uibb we have a button called Attachment.
When user clicks on the attachment button a upload browsing pop up appears by FPM_ATTACHMENT_WRAPPER component.
User can browse and select a doc and provide a document name and on click ok the document content can be uploaded and stored as per required.
The feeder class for the list uibb.
Create an event for the button.
Create an ovp application configuration.
Select free style uibb and provide component name as FPM_ATTACHMENT_WRAPPER and create a configuration.
Create a list uibb configuration.
Here the storage type as ECM - Enterprise Content Management or KPro- Knowledge Provider.
List UIBB configuration.
In the process event of the feeder class the below logic should be added to open the attachment upload pop up.
Test the application and on click on the button the pop up appears.
Now when the ok button is selected we should be able to read the document content from the address. So put the below code.
When OK button is pressed . The event parameter gives the details.
So here we have the file name URL and then by the forntend service method call we can read/upload the content and stores in ECM or Kpro.