cancel
Showing results for 
Search instead for 
Did you mean: 

Folder selection in webdynpro abap

former_member262988
Active Contributor
0 Kudos

Hi,

I have a requirement to read all the files present in a folder,i have searched for frontend classes but doesnot work in webdynpro abap can any one suggest how to acheve the functionality

Thanks,

Shailaja Ainala.

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

Hello Shailaja,

have a look at the [AcfUpDownload UI element|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b9157c878a2d67e10000000a42189c/frameset.htm]

and the [ACFExecute UI element|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b91539878a2d67e10000000a42189c/frameset.htm]

I think Thomas Jung has written an [e-Learning|http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/109b9b52-bc00-2c10-8786-e4c5e96d7e04] on this topic, but I believe the premise is that you can use ACFExecute to cause a directory listing to be executed and then ACFUpDownload to download that listing and then download the files.

You can look at the example WD application wd_test_appl_acfupdown to get single files.

Hope this gives you a direction to search in.

Cheers,

Chris

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You have to remember that you are in a Web Browser and therefore are subject to the sandbox security restrictions that the web browser enforces. This means very limited access to the frontend client machine compared to SAPGUI applications.

>I think Thomas Jung has written an e-Learning on this topic, but I believe the premise is that you can use ACFExecute to cause a directory listing to be executed and then ACFUpDownload to download that listing and then download the files.

Its not quite that easy I'm afraid. ACFExecute can't return data to the Web Dypro Application. It is desgined to trigger interactive applicactions not become a data interface between them (although you can pass startup parameters for the application). ACFUpDownload will let you silently upload multiple files (thanks to the use of a Java Applet), but doesn't have any file selection dialog. It was originally designed for KPRO - where you have file check-ins and know the file locations from the document records. A file open/save dialog for ACFUpDownload isn't added until 7.02. Even with the dialog you would still need user interaction to select the files - it can't just read all the files in a directory. Note: both ACFExecute and ACFUpDownload are new in NetWeaver 7.0 Enhancement Package 1.

You could also try a FlashIsland (also new in 7.01). I have a sample of multiple file uploads using Islands as well on SDN. However same issue here - you can't just read the file structure of a directory. Even in Flash/Flex you are somewhat sandboxed - and the user must select the files they wish to upload (although they could select all files in a directory and upload them all at once).

The other solution (which can be done on 7.0) is to have the user manually ZIP the entire directory and then upload the single ZIP file with the normal FileUpload UI element. On the ABAP side you can use CL_ABAP_ZIP to parse and process out the individual files within the ZIP content.

ChrisPaine
Active Contributor
0 Kudos

>ACFExecute can't return data to the Web Dypro Application

but if you asked it to run a batch file which created the directory listing you wanted and piped that to a file eg in windows:

dir path > filelisting.txt

then used ACFUpDownload to retrieve filelisting.txt you could parse the file and then use ACFUpDownload to read all the files.

but perhaps an island would be easier!

as an aside - This formatting restricting is currently more than silly!

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

That's true - a lot of work - but true. Of course the directories in question would have to be added to the Whitelist security configuration as well. If only browsers had some special trusted mode that allowed closer desktop access. It would be nice for applications like Web Dynpro - but would probably lead to more problems than its worth in general browser usage.

And yes the formatting limitations seem to have gotten worse.

former_member262988
Active Contributor
0 Kudos

Hi Thomas,

Thanks for the solution,I followed the ACF download upload functionality but with ACF multiple files i could not download

also i did the ZIP file approach ,working fine .......but still not userfriendly as user has to unzip manually......

Is there any other approach where i can download multiple files and upload multiple files.....and i am very much thankful to the acf tutorial (e learning)

Thanks,

Shailaja Ainala.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Is there any other approach where i can download multiple files and upload multiple files

No. The three approaches I listed here (ACFUpDownload, ZIP, and FlashIsland) are it.

>but with ACF multiple files i could not download

Why not? This is functionality that is provided?

Former Member
0 Kudos

"....but with ACF multiple files i could not download."

I am having the same problem when trying to download multiple files with ACF.

This is how I call the handler:

wd_comp_controller->acf_method_handler->if_wd_acfupdownload_scms~http_get(

EXPORTING

urls = tl_urls

error = co_errorinformation_stru

override = lv_overwrite ).

When the internal table contains one single record it works a treat. However when calling with more than one record nothing happens, not even is the handler class being triggered...

The last time I tried I ensured tl_urls had several records but just before calling the ~http_get I removed all but one record. The single download worked fine... It appears that the mere occurence of multiple records in that parameter table makes ACFUPDOWNLOAD not work.

Any ideas of what to do with this?

raja_narayanan2
Active Participant
0 Kudos

Hi Thomas,

>

> >Is there any other approach where i can download multiple files and upload multiple files

>

> No. The three approaches I listed here (ACFUpDownload, ZIP, and FlashIsland) are it.

>

> >but with ACF multiple files i could not download

>

> Why not? This is functionality that is provided?

Ya i too followed your ACF online tutorial and i can able to upload and download multiple files. But in this scenario the file name we are hardcoding.

But in my scenario, from ALV i will select some records and then i need to download those records into individual XML file. But the file name i will generate dynamically and that has to be store in the specified path.

In this scenario for me Upload is not possible. Is there any way where i can get ride of the cache table.

Any Solution for the above approach.

Thanks and regards

Raja Narayanan

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>In this scenario for me Upload is not possible. Is there any way where i can get ride of the cache table.

I'm not sure I understand your question. Why is Upload not possible?

My file names where hard coded because you must remember the ACFUpDownload was designed for KPRO/Cache Server. Therefore in something like DMS when you perform check in or check out you know the file name and location since it is stored in the database. In 7.02 we add a File Open/Save dialog to ACFUpDownload that makes it much more useful.

You also need the cache table in my tutorial becuase this UI element was deisgned to communication with the external KPRO/Cache server not with the Web Dynpro hosted server. The Cache table and the ICF handler simulate the KPRO/Cache server and allow the data to pass to/from your Web Dynpro component instance.

Answers (0)