Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
fatihpense
Active Contributor
3,328

My colleagues leverage new front-end technologies like JS frameworks. However each time they edit a JavaScript file they have to open the MIME file, edit it and close it to see the change in the web page. This workflow makes me cringe and I feel sorry for my fellow developers. I developed a solution for them and decided to share it with you.

 

Problem


-Too many actions required changing a single JavaScript file.
-Version control becomes harder since you always change MIME on the server first. You have to get local copies periodically if you want to use SVN or Git.
-Every IDE has its way of organizing projects, and extra features. You can not use all of the features because you open one file at a time from temp.
-You want to upload many files at once like images.
-Often JS frameworks create a single minimized .js file and you have to import the file every time.

 

Solution


-Start zMIMESync program. Edit your files in your PC with your favorite IDE/editor. Whenever you save a file zMIMESync instantly sends the file to the MIME repository. You can directly go to the browser and refresh to see the changes! Since files are already on your PC you can use any version control.


Features



  • instantly syncs your js file when you save.

  • checks if the file is really changed after the last sync.

  • works well with requests.

  • works with folders.

  • overwrites files.

  • doesn't delete files.

  • uploads any file type like .js .png ...


Installation


zMIMESync consists of two parts.
1- Web Service in SAP system that updates MIMEs.
2- Command line client tool that watches files to upload.

1- Service creation is documented here with the source code:
https://blogs.sap.com/2016/10/23/creating-class-handler-sicf-service-code-example/

2- Installing client is very easy. If you are developing with Node.js you are already familiar with npm tool. If you don't have it installed, you can install Node.js from the official website: link .This brings command line tool "npm". Then you can run:

npm install zmimesync -g

That's all it takes to install client!

 

Usage


Create a BSP application

Now it opens the file as script.js.txt with Notepad. You have to save&close the file to see the changes. Every time! You can change the default program for *.txt files to the beloved Notepad++ but that doesn't solve open/close, open/close issue... There is a better way 🙂

Open command line and go to your root folder for MIMEs. Execute "zmimesync" it will create a settings file on the first run.



mimesync-settings.txt

This is the created settings file with explanations in it:
#Settings file for ZMimeSync - Automatic Mime Sync for easier development

#SICF Service for ZMimeSync you can find more info at the documentation
#Example: "http://erpdev.company:8000/sap/bc/zmimesync_s001?sap-client=100"
mimesync_service = ""

#Username on SAP system.
username = ""

#Password on SAP system. This is optional since you may not want to store it in plaintext.
#If there is no password field the tool asks you for password each time you run it.
password = ""

#Root Mime Path for BSP, etc. This is found at the bottom in BSP properties screen.
#Example: "/sap/bc/bsp/sap/zbsp_mimesync_ex/"
#Please note that you can also sync current folder to an subfolder in MIMEs.
#Example: "/sap/bc/bsp/sap/zbsp_mimesync_ex/my_folder/"
mime_url = ""

#Request Number for SAP development.
#Example = "ERPK900141"
request_number = ""

Enter the required fields.
You should enter "mimesync_service" URL from the SICF service. You can find URL by testing it.


"mime_url" field is /sap/bc/bsp/sap/$YOUR_BSP_APP_NAME/ . You can also sync the folder on your computer to a sub-folder in BSP.


"request_number" is the transport request number. It should be same with the BSP application.

Now if you run the client program it will immediately sync your files and continue syncing! You can use Ctrl+c to close the program.


1- I changed script.js and saved it automatically synced.
2- I added a line and deleted it again, then saved. Since content didn't change the tool didn't sync.

Thanks for reading. If you have any question regarding this tool, I would be happy to help.

 

 
7 Comments
Labels in this area