Hi All,
We had a requirement to post attachments with different extensions to backend [ECC]. Required functionality was to fetch file content for respective posted invoice from azure, which can be one or multiple files with different extensions, convert it in acceptable ECC format and post it to ECC.
When I was implementing this functionality, I couldn’t find any straightforward blog which would help me explain how to send attachments from workflow to ECC or any other backend system. Hence, I explored some other options, made it successful and thought I should share so that it can be useful and can be referred by others who want to achieve similar kind of functionality in their projects. Hope this helps.
We had a requirement where we wanted to send attachments to ECC. This requirement was to post attachments to backend only if invoice posting is successful.
Here our complete logic flow is as below:
User will raise invoice request where user has flexibility to add documents with any extension.Request will be stored in azure and BTP workflow will be triggered for the same for posting the invoice to backend.Once invoice posting is successful, workflow will fetch the attachment file content, and as is send to ECC with required parameters against related invoice.
Steps to add logic flow for posting attachments to ECC.
First, I am checking if posting of invoice is successful, as we want to send attachments only for success scenario and not for failures
If it’s successful, fetch the files from invoice request, one invoice can have multiple files with different extensions.
Fetch the file content from azure by sending file name in required payload format to API call. Collect the response from azure in response variable for next step.
Prepare payload for posting document to ECC. Header parameters and payload content is what we ll require to send to entity set.
Header parameters as above.
And file content we will send as is from azure response variable to “Request variable” section to avoid any corruption or additional quotes which gets added due to reassignment.
Once posting step is completed, we will handle the notification for success/error. And in next step we will check if files are remaining to post.
Then, we’ll check flag [which we can set by shifting or removing files form original file array of one or multiple files] for remaining documents, as we are posting one document at a time. Once all files are posted, we will complete the workflow.
From backend we must convert the file content [which is base64] in X-string to process it further.
Once all files are posted in backend, we can view all posted attachments against invoice as below.
Using this approach, you can post files easily to backend, as well you can view attached files from backend.
That is all folks, this is how I achieved the posting files to backend. You can modify the flow and steps as per your own requirement. Good Luck!
Hi All,We had a requirement to post attachments with different extensions to backend [ECC]. Required functionality was to fetch file content for respective posted invoice from azure, which can be one or multiple files with different extensions, convert it in acceptable ECC format and post it to ECC.When I was implementing this functionality, I couldn’t find any straightforward blog which would help me explain how to send attachments from workflow to ECC or any other backend system. Hence, I explored some other options, made it successful and thought I should share so that it can be useful and can be referred by others who want to achieve similar kind of functionality in their projects. Hope this helps.We had a requirement where we wanted to send attachments to ECC. This requirement was to post attachments to backend only if invoice posting is successful.Here our complete logic flow is as below:User will raise invoice request where user has flexibility to add documents with any extension.Request will be stored in azure and BTP workflow will be triggered for the same for posting the invoice to backend.Once invoice posting is successful, workflow will fetch the attachment file content, and as is send to ECC with required parameters against related invoice. Steps to add logic flow for posting attachments to ECC.First, I am checking if posting of invoice is successful, as we want to send attachments only for success scenario and not for failures If it’s successful, fetch the files from invoice request, one invoice can have multiple files with different extensions. Fetch the file content from azure by sending file name in required payload format to API call. Collect the response from azure in response variable for next step. Prepare payload for posting document to ECC. Header parameters and payload content is what we ll require to send to entity set. Header parameters as above.And file content we will send as is from azure response variable to “Request variable” section to avoid any corruption or additional quotes which gets added due to reassignment. Once posting step is completed, we will handle the notification for success/error. And in next step we will check if files are remaining to post. Then, we’ll check flag [which we can set by shifting or removing files form original file array of one or multiple files] for remaining documents, as we are posting one document at a time. Once all files are posted, we will complete the workflow. From backend we must convert the file content [which is base64] in X-string to process it further. Once all files are posted in backend, we can view all posted attachments against invoice as below. Using this approach, you can post files easily to backend, as well you can view attached files from backend. That is all folks, this is how I achieved the posting files to backend. You can modify the flow and steps as per your own requirement. Good Luck! Read More Technology Blogs by Members articles
#SAP
#SAPTechnologyblog