Thanks for tuning in and checking out my very first blog for Mindset, Create a Media Upload OData Service with Custom Header Parameters. Now, I’ve written a few blogs over the years. However, this is the first blog I’ve written for Mindset and I’m really looking forward to adding to the SAP knowledge-base and hopefully making a developer’s life a little bit easier.
Before spilling the beans on how I utilized the Create Steam method passing multiple custom parameters, I want to set the stage and explain the business use case for this particular development.
As you may know, Mindset is a development firm focusing on human-centered design. We were working with a client, bringing them out of the stone age GUI experience and building them a gorgeous web application.
My particular assignment was to find a way for the web application to upload documents into the SAP Document Management Service (DMS) and assign document classifications and characteristics via custom parameters. However, there isn’t much information on how to implement this using an OData service. Also, I found that the most common recommendation is to use a code-based implementation via SEGW and redefine the CREATE_STREAM method.
I want to add context around Classifications and Characteristics and how custom header parameters relate to them. When documents are loaded into the DMS, you can access these documents through transaction CV04N (there are multiple CV0*N Transactions you can use). Within this transaction, you will see that there are multiple tabs with additional fields that can be associated with the document that’s been uploaded. However, in my case, I needed to be able to add classification characteristics as well as link the document to a partner. Further, by utilizing the custom parameters in my payload, I was able to send those values through the parameters, utilize the FM that you’ll see in the code, and commit the records to the database.
Below are the following steps I followed in order to implement the above solution.
- Create SEGW Project
- Create Entity Type
- Check the “Media” box for Entity
- Generate Runtime Artifacts
- Model Provider Class Extension – Redefine the DEFINE method with the code snippet.
- Data Provider Class Extension- Redefine the CREATE_STREAM method with the code snippet.
DEFINE Method in MPC Extention Class
If you’re a developer new to the CREATE_STREAM and DEFINE methods and how they are implemented. I hope this blog gave you a good starting point and empowered you to create your own solution. Please feel free to reach out to me via LinkedIn or on the Git repository if you have any questions and I’ll try my best to get back to you. If you’re one of the old dogs and there is a better way to do this. Please, by all means, drop a comment in the Git repository and let me know how you would enhance this solution. But, most importantly, stay inspired, keep learning, and share the knowledge. Mark out.
If you are interested in viewing similar articles, visit our blog, here.
View our LinkedIn, here.