Skip to Content

Sometimes negotiating on a standard solution with the customer is like waving a red flag to a bull,  “Consultant proposes, Customer Disposes” had become a norm in my recent endeavours. Few at times, there is good reason behind their intransigence, but more often than not it is display of effrontery to say that was is there is the best and should continue, but hidden behind the veil is the resistance towards any kind of change.

Rather than pressing your point home, it is better to give in and get things going beofore customers says my way or the highway 🙂 . We advocating use of HCM processes and forms to standardize all their HR processes did not get their buying. Firstly, they wanted the look and feel exactly as it was and also the functionality, one major bone of contention was to have file upload at different sections in the form as each section will be used by different stakeholder, the standard HCM processes and form framework would not offer such an option as all the attachments are available in only one section at the top, and also then flexibility of making certain attachment available for certain groups is not an option.

In this blog I shall describe how to incorporate file uploads in different sections and load it to the content server, a prequisite being that the content server is configured by doing the basic customizing for the archivelink. if you are unware, then just take a note of the below steps.

1. Create a content repository – here you create a content repository id along with other parameters.

Contrep1.JPG

Enter the required details related to the content server.

contrep2.JPG

2. Create a document type and use the document class as * so that you can use any document type.

document.JPG

3. Now link the object type, document type, and the content repository using the below customization view.

Enter the other details as required.

LinkDocs.JPG

4. Also, ensure that during storage the document type is not copied from document class. Keep the below box unchecked in the customizing.

storetype.JPG

Once you are done with these quick settings, it is time to a develop a small WDA reusable component. This particular component shall then be placed in different sections of the main component. But before we start to develop WDA we need to small spade work of designing the table to store the required document data.

Design the table to store the following as shown below.

1. The section field is used to identify from which section the document got uploaded

2. The document ID is returned by the archive link after loading the document, it uniquely identifies a document.

3. The unique process id is used here because every form when submitted would give a unique process id, thus we can link the uploaded documents to unique form and sections in the form.

4. File type is the file extension, it needs to be capture as this wll be used while trying to open the document from WDA.

5. Store the file name also

table.JPG

6. Now create a web dynpro component with a very simple view consisting of a upload UI and table UI to display uploaded document details and also delete if not required.

Uploadview.JPG

On the load action of the file use the CALL FUNCTION ‘CH_SPLIT_FILENAME’ to split file name and mimetype so that it can be captured in the z-table.

Then store the read content into the content server by calling  ARCHIV_CREATE_TABLE


load_fm.JPG

Store the  ls_outputarc_doc_id in the ztable, this is an unique reference to the document store in the content server, this id will help us to retrieve the document back.


Now, on the other hand to open the uploaded file, you can create a handler action to fetch the file and open as a response. Use the FM CALL FUNCTION ‘ARCHIVOBJECT_GET_TABLE’ as shown below passing the unique document reference number that was generated and stored in the previous step.

down_fm.JPG

You might need to get the correct mime type to be passed to the browser using the  below FM and a little bit tweaking using a conversion class to correct the binary information. If you don’t use the conversion class you might not be supporting xlsx type files and end up getting error while opening the file, though the file ultimately opens.

sdok.JPG

then a bit of coding to attach to response and the file shows up on the browser.

last_step.JPG

Apart from these, you might need to have some interface methods in the component controller to communicate with the parent component, the one of particular importance is the set data method(see below screen shot). This method gets information from the parent component, which helps it to uniquely identify the files that belongs to the process, the section and also store information of the files in the z-table. You can have other interface methods if you need further manipulation of the child component.

interfacmeth.JPG

methdetails.JPG

Below image you can see how the upload component in used in different sections of the same form.

demo.JPG

This is a normal scenario you would come across and I hope this blog will be quite useful at that time 🙂 .

Thanks for reading and your comments are welcome.

Raghav.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply