Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Binary download to unmapped drive (NOT!!!!! GUI_DOWNLOAD)

Former Member
0 Kudos

Is there a download function other than GUI_DOWNLOAD that will download a binary file to a client file system directory that is not physically on a user's PC and not mapped by the user on his or her PC?

Please advise at your earliest convenience.

Thanks

djh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I think there's a SAP whitepaper that addresses this.

Rob

13 REPLIES 13

Former Member
0 Kudos

I think there's a SAP whitepaper that addresses this.

Rob

0 Kudos

Rob -

Thanks very much! Do you have any idea how to search for that whitepaper?

0 Kudos

This is the one I meant, but I don't know if it will help:

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2">Communication to Presentation Server in Background Mode</a>

Rob

Former Member
0 Kudos

Hi David,

I didn't clearly understand the question,

Do you Want to download a file into another pc that is not mapped on the PC where you are working?

If this is the question, and the target file system can be access by local network, maybe you should try donwload the file using:

***************************************************************

my_file = '//any_network_dir/any_file.any'.

Try.

OPEN DATASET my_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

loop at (your binary file) assigning (any_fieldsymbol). "If necesary

transfer (any_fieldsymbol) TO my_file.

endloop. "If necesary

CLOSE DATASET my_file.

catch cx_(any exception)

endtry.

***************************************************************

Since de GUI_ functions only work in foreground mode on the calling PC and you don't have the mapping with the foreing file system, you can't dowload this file in ussing GUI_ functions,

I hope it helps,

Regards,

John.

0 Kudos

John -

Thanks for taking the time to respond.

We can't use the open/transfer option, for various reasons - it did, of course, occur to us.

Thanks anyway

djh

Former Member
0 Kudos

I am not sure if it is possible. If the file system is not physically on the user's PC and not even mapped, then the user cannot even save a file using MS Word, leave alone doing it from SAP. Unless I understood your question completely wrong, I don't think it is possible.

0 Kudos

hi Srinivas -

Thanks very much for taking the time.

We here all agree with you - the only question is whether SAP has developed some kind of new "privileged" function that can be activated during install, and would allow this type of download by SAP under some kind of special user id (like SAPADM for batch work.)

Best

djh

0 Kudos

At least I haven't heard of one that would allow a file to be created on a ghost (I am using the term losely to indicate that it is not visible in any directory browser) directory. Mind if I ask what is the scenario you are looking to find a solution for?

former_member181923
Active Participant
0 Kudos

Rob -

That's a neat RFC - thanks very much for providing the link. It's not relevant to our needs here, but it is good to know of for future reference,

djh

former_member181923
Active Participant
0 Kudos

Hi Srinivas -

This need arises only because the client has not yet moved from storage of internal GOS attachments in the DB table SOFFDB1 to storage of such attachments in a BDS subsystem or external content server etc. (I've blogged and posted about this at length before - so I apologize for boring folks who are already familiar with this sad story.)

OK - you've got a jpg binary sitting in SOFFDB1.

The client wants you to pop this jpg in an SAP picture control, and when the picture is double clicked, the client wants you to bring up a full-size copy in the SAP HTML viewer control.

Of course, you need a URL to pass the picture control or the HTML viewer control - neither of these classes have a method "load_binary_direct" that you can pass your jpg to.

So what we had to do is read the jpg out of SOFFDB1, download it to a drive, and then pass the directory path of this file as a "file:// ...." URL to the two controls.

Now, we have users in multiple plants across the world that have to execute the code that does this, and all these users will have to have the same drive letter mapped on their workstations - the drive we use when we download the jpg that we've retrieved from SOFFDB1.

But if SAP could write directly to an unmapped drive using a "raw" path, then we'd avoid the problem of trying to find a drive letter that none of the users have already used on their workstations.

What's interesting is that the HTML viewer can <b>read</b> from such an unmapped path - it's just that the GUI_DOWNLOAD function can't write to an unmapped path.

Hope that clarified why I asked the question.

Of course, if we got rid of SOFFDB1 and went to an external content server, the whole problem would go away because every stored binary would have a URL - same as if we went to BDS. (By the way - where is BDS - its area has been removed from the online documentation ....?)

Better yet, we could go to Documentum - which we're in the process of doing ...

Best regards

djh

0 Kudos

I got it. Have you tried looking into the approach that when you normally try to download or upload to pc file, system brings in a default directory?

May be that is where you can create a temporary directory and download the file to. Take a look at the method GET_UPLOAD_DOWNLOAD_PATH of CL_GUI_FRONTEND_SERVICES class and also at GET_SAPGUI_WORKDIR method. This is the class that probably will help you in achieving what you want.

former_member181923
Active Participant
0 Kudos

Funny you should say that, Srinivas, because that, of course, is exactly what happens.

SO_OBJECT_DOWNLOAD calls the download method of cl_gui_frontend_services which of course calls our old friend GUI_DOWNLOAD. (We start with SO_OBJECT_DOWNLOAD to get type compatibility with the format of the binary file we've pulled out of the table SOFFDB1 using a different function in SO30.)

But before GUI_DOWNLOAD is called, SAP tries to interpret the path that you've given SO_OBJECT_DOWNLOAD, and if it can't interpret this path in terms of the mapped and local drives on the workstation that's executing the code, then it creates whatever directories it needs under the SAP default work directory on C, and then puts the file there.

So, you might ask - why not just let each users' temp files go to this path on the user's C drive.

Well the answer is as follows.

In order to avoid constantly extracting the same binaries over and over again from SOFFDB1, we write any given binary to our designated mapped drive the first time we have to get it from the database. Then the next time this binary is requested, we check to see if we have it on the mapped drive, and if we do, we just pass the URL to the picture control and the viewer control.

In effect - we have created our own mini-content-server on the mapped drive.

And since many different users can reqest the same binary, we need a single common place to look for the binaries on disk, not a hundred C drives scattered around the world - that's why we don't leave the files on each user's C drive.

Anyway, as I said earlier, please bear in mind that all of the above is one HUMONGOUS kluge which is going to go away as soon as we have Documentum or an external content server up-and-running, whichever comes first.

So we're not doing all of the above because we want to - it's our only choice right now.

Best regards

djh