You may have a need to upload a file to the server, and in the past you may have used COPSRV routine from ORDSYS.
On V6 the limit that this routine had was that, you did not know the file name of the file that is getting transferred to the server, and you had to define the file name for the destination.
But things have changed on newer version.
Before we get to the example review online help title "How to manage files in the storage area"
As you noted in the online help, in the new version COPSRV will copy the file to server TMP directory. So in below example I am going to use another routine MOVE from ORDSYS to move the file to my desired location.
In this example, I am adding a button to Sales order, for transferring the file.
- Open Development, Script dictionary, Windows.
- Select OSOH window.
- Add a new button.
- Save and Validate.
- Open Setup, Sales, Entry transactions, Orders.
- Validate the entry transaction.
- Now open Development, Script dictionary, Script Editor.
- Select SPESOH and add below code.
$ACTION
Case ACTION
When "EXEBOUT" : Gosub BOUTON
Endcase
Return
##############
$BOUTON
If BOUT="8" ###### this is the code of our button in Window dictionary
Local Char FICSRV(250),FICCLI(250),MYPATH(250)Local Integer ASTATUS
Local Integer stat
FICCLI = ""
FICSRV = filpath("tmp","","") ######## here I am building path to tmp folder
MYPATH= filpath("ATT\SALES","","") ########## here I am building the path to my destination folder
Call COPSRV(FICCLI,FICSRV,ASTATUS) From ORDSYS
FICSRV=FICSRV+"\"+FICCLI
If ASTATUS = 0
Call MOVE(FICSRV,MYPATH,stat) from ORDSYS ### this will move the file for me
Endif
If stat =0
Infbox("UPLOAD WAS GOOD THANKS")
Else
Infbox("Somethign went wrong")
Endif
Endif
Return
- Save and Compile.
- Now when open Sales , Orders, Orders.
- Click on the button on right.
- After click on the button, you will get the following.
- Use the button to select the file or drag the file here, then click Ok.
- Now you will get the information box that it was ok.
Conclusion: You can use COPSRV to copy files to the server.