cancel
Showing results for 
Search instead for 
Did you mean: 

Restore PDF File from IdM Database

Former Member
0 Kudos

Hi,

I've configured an attribute with File Presentation, so I am able to browse and upload a File to IdM through the UI.

Now I want to store the File in a Folder. Therefore I've created a script which receives the File from IdM DB and convert the File using the uFromHex (since the File is stored as a Hex value in the DB).

This approach works fine for txt files, but not for pdf files.

Does anyone know how to deal with this?

Thanks

Christos

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Christos

Try something like the below as an example; Web UI task to upload; attribute Data Type: Binary

Call the script; $FUNCTION.fileupload(%MSKEYVALUE%|%BINARY_FILE_UPLOAD%)$$

function fileupload(Par){

	delimiter = "%$glb.SAP_DELIMITER%";
	parvalues = Par.split(delimiter);
	mskeyvalue = parvalues[0];
	file = parvalues[1];

	filevalues = file.split(":");
	filename = filevalues[0];
	filebody = filevalues[1];

	filebody = UserFunc.uFromHex(filebody,"ISO-8859-1");

	filelocation = "/usr/sap/files/" + filename;
	//UserFunc.uErrMsg(1,"User: " + mskeyvalue + " File: "  + filename );

	UserFunc.uToBinFile(filelocation,filebody,"ISO-8859-1");
}

Hope it helps ...

Rgrds

Craig

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Even though the file is downloaded properly , the job throws an error.  Any idea?

"java.lang.NullPointerException: while trying to invoke the method java.sql.ResultSet.getMetaData() of a null object loaded from local variable 'rs'" .

Former Member
0 Kudos

Hi Craig,

that's the solution! Thanks for your answer!

My fault was that i did not decrypt the value with a specific format. Therefore the file was scrambled every time.

Cheers

Christos

Former Member
0 Kudos

Hi Craig,

thanks for your quick response.

Unfortunately it did not work. It works fine if you read a file from disc and store it anywhere else.

I think the issue is that although the attribute has the Datatype Binary, IdM stores the value in HEX format.

Any other idea?

Regads,

Christos

0 Kudos

Hi Christos

Have you tried setting the attribute to a binary type and use the uToBinFile function?

http://help.sap.com/saphelp_nwidmic71/en/using_functions/internal_functions/dse_utobinfile.htm

Rgrds

Craig