Hi All,
Part I: Upload Images from Tablet/Mobile to SAP - Part I
INTRO:
A document management system (DMS) is a system (based on computer programs in the case of the management of digital documents) used to track and store documents. It is usually also capable of keeping track of the different versions modified by different users (history tracking).
Step1:
-Use Cordova to create your apk/ipa project. Because of cordova have more than 200 plugins to enhance android/ios applications. File opener could be among one of them.
API link: markeeftb/FileOpener · GitHub
-Add this plugin into your cordova project
- Command: plugin add "plugin link"
Step2: Code snippet
function commonDownloadAndDisplayDoc(mime, filename){
var downloadUrl = "http://MY-SYSTEM-eu.com:8100/sap/opu/odata/sap/ZGW_HELP_FILES_SRV/FileSet(filename)/$value";
var relativeFilePath; // using an absolute path also does not work
switch(mime){
case "PDF":
relativeFilePath = "HERE_Document_Dir/Viewer.pdf";
break;
case "PPT":
relativeFilePath = "HERE_Document_Dir/Viewer.ppt";
break;
case "WRD":
relativeFilePath = "HERE_Document_Dir/Viewer.doc";
break;
case "XLS":
relativeFilePath = "HERE_Document_Dir/Viewer.xls";
break;
case "JPG":
relativeFilePath = "HERE_Document_Dir/Viewer.jpg";
break;
case "PNG":
relativeFilePath = "HERE_Document_Dir/Viewer.png";
break;
case "GIF":
relativeFilePath = "HERE_Document_Dir/Viewer.gif";
break;
case "MP4":
relativeFilePath = "HERE_Document_Dir/Viewer.mp3";
break;
case "TXT":
relativeFilePath = "HERE_Document_Dir/Viewer.mp4";
break;
case "MP3":
relativeFilePath = "HERE_Document_Dir/Viewer.mp3";
break;
default:
relativeFilePath = "HERE_Document_Dir/Viewer";
}
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
var fileTransfer = new FileTransfer();
fileTransfer.download(
downloadUrl,
fileSystem.root.toURL() + '/' + relativeFilePath,
function (entry) {
var finalRes = fileSystem.root.toURL() + '/' + relativeFilePath;
window.plugins.fileOpener.open(finalRes);//Working
closeSplashScreen();//splash screen closed
},
function (error) {
alert("Error during download. Code = " + error.code);
closeSplashScreen();//splash screen closed
},true//Trust all host
);
});
}
This code will automatically open your requested file.
Step 3:
Run your application in Android/Ios mobile---> open ES folder -->under that folder "HERE_Document_Dir" search this name-->yup, I got my file :razz:
Thanks,
Karthik A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |