Skip to Content
author's profile photo Former Member
Former Member

Restore PDF File from IdM Database

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

Add comment
10|10000 characters needed characters exceeded

5 Answers

  • Best Answer
    Posted on Oct 10, 2011 at 04:31 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2011 at 07:59 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 06, 2011 at 08:23 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 10, 2011 at 12:51 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 19, 2015 at 11:53 PM

    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'" .

    Add comment
    10|10000 characters needed characters exceeded