on 08-30-2004 11:57 PM
Hey guys, I have a question for you. I'm looking to do some sort of a download that executes in the background and stores the file onto a networked drive. I don't think WS_DOWNLOAD works because once you start in the background you loose access to the download destination (or something to that effect).
Anyways, was wondering if there was a way to use ws_download or another equivalent program to execute this the background. Thanks a lot.
-Shaunt
In situations like this, we normally take the help of the networking people and have the Windows directory mounted onto the SAP application server. That way you can download it to an application server directory in the background and yet see it in your desktop directory at the same time.
Let me know if this helps.
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Problem solved.
There was an issue with the rights that were set on the network-share.
The sapservice users had the correct priviledges for the "security" part, but they did not have the correct necessary priviledges for the share itself.
So one CAN, in fact, use a network-path, as long as the SAPServer can resolve it.
Example of a network-path: "
somecomputer\sharedfolder\".
Thanks for everybody's help.
No, we didn't use SAMBA, not that I know of anyway.
(I don't exactly know what samba is, but I assume it's some kind of bridging tool to broadcast shared folders on windows OS's to a Unix server)
In windows if you rightclick on a folder, you can choose to share it.
The only thing needed is to add correct permissions to the share, and to the security of the folder.
Let's say we want to write to a folder called dataset_test on a computer called network_pc.
What follows are operations in <b>windows</b> (2000)!
(I'm sure you can find how to do these steps with other versions of windows, or unix).
You log on to network_pc with Administrator.
Find the dataset_test folder (on the c: drive for example).
Right click on it and select "Sharing...".
Select the "Share this folder" option.
Click on Permissions.
Add the SAP Service account that's necessary.
I found this out by sharing a local folder, and giving access rights to "Everyone".
Then, made the open dataset statement go to that folder, and when you to to system management (again in windows), you can see what the open sessions to your computer are.
And I saw the user there.
I think it's because we run the SAP servers on a Windows environment as "services". And you can select a servicename for a service. This will probably used as user to connect over the network.
To continue the settings-story:
When you've clicked the permissions button and added the user (service), you give that user read and write permissions.
Then (if you have an NTFS file system), you go to the security tab, and add the same user (service) there, again with read & write permissions.
The <b>ABAP</b> side of the story:
In the program you should call the OPEN DATASET statement like this:
-
DATA: p_fileName LIKE rlgrap-filename,
tmpMblnr(19) VALUE 'TEST-document.txt',
path(26) VALUE '
network_pc\dataset_test\'.
"network_pc" could also be an IP-address if you don't have DNS available.
CONCATENATE path tmpMblnr INTO p_fileName.
OPEN DATASET p_fileName FOR OUTPUT IN TEXT MODE.
LOOP AT FileTab INTO FileTabWa.
TRANSFER FileTabWa TO p_fileName.
ENDLOOP.
CLOSE DATASET p_fileName.
-
Obiously, you should first define and fill FileTab with the data you want.
And that's it.
I hope this information was useful.
Regards
Tim.
Thanks, Tim. Appreciate ur effort for answering my query.
The key point here is that ur SAP runs on Windows and hence u did not need any software like SAMBA to map windows to ur app server. We have SAP running on UNIX and hence I am not able to do what u have achieved without any
software.
Another option for us we are thinking is to install App server on the Windows box and then we can directly use
'open dataset' commands to read/write the file in background.
I will keep u guys posted on the solution we choose.
-Thanks Again
Bhaven
Actually you can do a direct FTP to Windows box if you have FTP service running on it (on Windows 2000, it comes default with IIS, just need to turn it on). In SAP use the following FM after initializing the connection. It will transfer the table directly to the file. Make sure $table has rows of type C or string and size enough to take care of your largest record.
<b>
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = v_handle
fname = v_filename
character_mode = 'X'
TABLES
text = $table
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
</b>
And the following for the other way around:
<b>
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = v_handle
fname = v_filename
character_mode = 'X'
IMPORTING
blob_length = $size
TABLES
text = $table
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
</b>
Actually we have a class wrapped around this call, we use here quite often. The destination directory is shared on desktops of end-users.
Couple of options:
1> Use Samba with Unix Share
2> Use sapftp, first write to UNIX and then use FTP_COPY to move file from UNIX to NT, better error handling
3> Install SAP app instance on NT server and make it as Background server. Run all jobs on this instance and use open dataset option and files will be created directly NT server
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
DOWNLOAD function does not work in the background as that it will be able to access the Presentation server. What you can do is send mail to the id and then download that from that id as mail can be send in the background.
The FM used for sending mail is SO_NEW_DOCUMENT_ATT_SEND_API1
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did you try OPEN DATASET.
regards,
Prabhu Rajesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This is the answer I posted for another thread. Inserting here thinking it may help.
==>
1. You can use the FM "GUI_UPLOAD", "GUI_DOWNLOAD" for file operations interacting with presentation layer. Also the class "CL_GUI_FRONTEND_SERVICES" has same utilities.
2. But I think you need something to work at background too. Then these will not be suitable. You should use application server to store your files. For this inspect SAPHelp for the statements "OPEN DATASET/CLOSE DATASET".
There are some FMs utilizing these for file operations, like "C13Z_FILE_UPLOAD_BINARY" and "C13Z_FILE_DOWNLOAD_BINARY".
3. However if your task is somehow much in deep with document management, you may want to work with BDS (Business Document Service). Transaction code "OAER" and "SE61".
4. Another way may be to store your files in cluster tables. This time look for usage of ABAP statements "IMPORT FROM/EXPORT TO DATABASE...".
Hope these may be some starting point for you.
*--Serdar
Thanks guys for your input. I'm aware of using open/close dataset however, as far as I know I can only put that on the ap server it self. Running 4.0B with hp-ux. I need the file in a networked directory
I tried
path... and ip address\...
Did not work. Does this not work? or am I doing something wrong?
Hi Serdar,
I could view good ideas from you input. But in my case I have to download as ASC format and upload and BIN format, will EXPORT & IMPORT statements works?
Trying other options other that OPEN DATASET.
The resin for this is in my client place we dont have authorization to create new files in application server.
Prabhu Rajesh.
Hi Prabhu
"EXPORT" and "IMPORT" statements are used to store data in cluster tables. By those you can store huge amount of data. However, as Nablan told, they have nothing to directly do something with the application server.
"OPEN/CLOSE DATASET" statements are for that purpose. However, it seems you can't use them.
*--Serdar
Hi,
you can use the open dataset for downloading files where ever you want. With the open dataset statement you can save files in the sap directory of the application server. So just add an sap directory at the application server which is mapped at your presentation server or a file server or what ever.
The destination has to be mapped on your application server. So if you use open dataset with the added sap directory the system will save your file at the directory you want.
hope that helps
Chris
FTP is not the only way to do it.
Few years a go I have seen this discussion and the other proposed solution (by Ingo-Willy alias Kaphoon) was by using RFCEXEC program.
see description of this solution in
in spanish http://sapabap.webcindario.com/modules.php?name=Content&pa=showpage&pid=121
in german http://www.abap-fans.de/tipps/ARTIKEL_RFCEXEC1.htm
there must be somewhere english document about it, but I was not able to find it.
Ingo are you still around SAP area?
regards,
Andrzej
> Hi,
>
> you can use the open dataset for downloading files
> where ever you want. With the open dataset statement
> you can save files in the sap directory of the
> application server. So just add an sap directory at
> the application server which is mapped at your
> presentation server or a file server or what ever.
> The destination has to be mapped on your application
> server. So if you use open dataset with the added sap
> directory the system will save your file at the
> directory you want.
>
> hope that helps
> Chris
Hi
What exactly do you mean by "the destination has to be mapped on your application server"?
Do you mean, like, create a mapped network drive IN WINDOWS to the destination you want? Or are you referring to some mapping in SAP itself?
And also, which user is used when SAP sends/writes the file to the destination folder?
Does it match with your SAP service?
Hi,
You can download data on an application ( not presentation ) server in background using dataset : first "open dataset ... " then "transfer ... " and at the end "close dataset ... ".
Regards,
Małgorzata
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.