cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to read JSON file stored in local folder in SAP Desktop studio

0 Kudos

Hi Gurus

I was trying to give the user and password details in a JSON file and placed it in Local folder of Desktop Studio as mentioned in the link here. https://blogs.sap.com/2019/07/21/automate-business-processes-using-intelligent-robotics-process-auto...

I am facing error

[fso.file.read] : File could not be opened.

shrinidhi_k
Explorer
0 Kudos

Hi Sulagna ,

please make sure

weather your Json is valid or not ,

and check in the debugger the given path is correct or not

Best Regards,

Shrinidhi

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Also another issue I am facing is that , the variable is not being able to set through this value.

GLOBAL.step({ pSAP_management: function(ev, sc, st) {
var rootData = sc.data;
ctx.workflow('SAP logon', 'beb12d5f-05be-4c80-a267-0bbe6aedc283') ;
	// Wait until the Page loads
SAPLogon760.pSAP.wait(function(ev) {
SAPLogon760.pSAP.edClient.set(rootData.SAPLogon760Data.pSAPData.edClient);
SAPLogon760.pSAP.edUser.set(rootData.SAPLogon760Data.pSAPData.edUser);
SAPLogon760.pSAP.oPassword.set(rootData.SAPLogon760Data.pSAPData.oPassword);
SAPLogon760.pSAP.keyStroke(e.SAPScripting.key._Enter_);
sc.endStep(); // pTransportOrganizer_m
		return;
	});
}});

The code is not going inside this and not setting the variable edClent , user and password. Although the variables rootdata.... are being filled correctly with proper data.

Jerome
Advisor
Advisor
0 Kudos

Can you log these values in the debugger, just to make sure they are correct when you're using them ?

0 Kudos

Hi shrinidhi.k

The format is correct , when i am trying to direct access the file, it is working fine.

var sParams = ctx.fso.file.read('******\\local\\user.json') ;

var oParams = JSON.parse(sParams);

Otherwise on using

var sPath = ctx.options.path.local + "\\user.json";

var sParams = ctx.fso.file.read(sPath) ;

This is not working and gives error as mentioned above.

0 Kudos

Hello,

Please use the following syntax:

ctx.json.parse(ctx.resources.loadHtml(ctx.fso.file.getParentFolderName(ctx.options.path.resources) + "\\local\\Config.json"));

Check the JSON is of right format and check the name/path of the file.

Best Regards,

Jai Vignesh R

0 Kudos

Hi jai.vignesh.r

When i am trying to direct access the file, it is working fine.

var sParams = ctx.fso.file.read('******\\local\\user.json') ;

var oParams = JSON.parse(sParams);

Otherwise on using

var sPath = ctx.options.path.local + "\\user.json";

var sParams = ctx.fso.file.read(sPath) ;

This is not working and gives error as mentioned above.

0 Kudos

Isn't your issue solved by the above-provided syntax or you are keen to know why this issue is happening for the specific syntax that you are using? Just trying to understand the problem here 🙂