skip to Main Content

Create a Media Upload OData Service with Custom Header Parameters

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. 

OData Service

OData Service

OData Service

Below are the following steps I followed in order to implement the above solution. 

Steps

  1. Create SEGW Project
  2. Create Entity Type
    1. Check the “Media” box for Entity
  3. Generate Runtime Artifacts
  4. Model Provider Class Extension –  Redefine the DEFINE method with the code snippet.
  5. Data Provider Class Extension-  Redefine the CREATE_STREAM method with the code snippet.

Code Snippets

DEFINE Method in MPC Extention Class

OData Service

CREATE_STREAM

OData Service

OData Service

OData Service

OData Service

OData Service

OData Service

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.

Links:

https://github.com/marksmith-II/create_stream_upload_service

https://www.linkedin.com/in/mark-smith-6873644a/

 

If you are interested in viewing similar articles, visit our blog, here.

View our LinkedIn, here.

Mark Smith is a Full-stack SAP developer at Mindset. He is a self-proclaimed technical mercenary with a focus in all things SAP. Mark is a blogger, mentor and DEI advocate in the workplace and his community. In his spare time he enjoys the outdoors, playing basketball, spending time with family and fiddling with smart home technology.

Back To Top