Attach BP Url via Code
Hi experts!!
I am using cl_crm_documents=>create_with_url to create attachments via URL, in BPs. The problem is that the attachments are uploaded as application/octet-stream, hence i cannot open . When i manually attach URLs to BP they are displayed fine.
Any ideas?????
Here's the code i've written.. Am i missing something??
ls_url-line = 'http://www.google.com'.
APPEND ls_url TO url.
unpack businesspartner to ls_part.
SELECT SINGLE * FROM but000 INTO ls_but000
WHERE partner = ls_part.
BREAK-POINT.
ls_bus_obj-instid = ls_but000-partner_guid.
ls_bus_obj-typeid = 'BUS1006'. "(for business partner)
ls_bus_obj-catid = 'BO'. "(for business object)
pro_LS-NAME = 'CONTENT_URL'.
PRO_LS-VALUE = 'http://www.google.com'.
APPEND PRO_LS TO PRO.
pro_LS-NAME = 'KW_RELATIVE_URL'.
PRO_LS-VALUE = 'Application_form'.
APPEND PRO_LS TO PRO.
pro_LS-NAME = 'DESCRIPTION'.
PRO_LS-VALUE = 'Description'.
APPEND PRO_LS TO PRO.
pro_LS-NAME = 'LOIO_CLASS'.
PRO_LS-VALUE = 'CRM_L_URL'.
APPEND PRO_LS TO PRO.
pro_LS-NAME = 'PHIO_CLASS'.
PRO_LS-VALUE = 'CRM_L_URL'.
APPEND PRO_LS TO PRO.
CALL METHOD cl_crm_documents=>create_with_url
EXPORTING
url = url
properties =
properties = pro
business_object = ls_bus_obj
parent_folder =
IMPORTING
loio = lt_loio
phio = lt_phio
error = lt_error
Actually Problem is now Solved!!
Insted of using method CREATE_WITH_URL i used CREATE_URL.
Here's the code..
ls_url-line = 'http://www.google.com'.
APPEND ls_url TO url.
unpack businesspartner to ls_part.
SELECT SINGLE * FROM but000 INTO ls_but000
WHERE partner = ls_part.
BREAK-POINT.
ls_bus_obj-instid = ls_but000-partner_guid.
ls_bus_obj-typeid = 'BUS1006'. "(for business partner)
ls_bus_obj-catid = 'BO'. "(for business object)
pro_LS-NAME = 'CONTENT_URL'.
PRO_LS-VALUE = 'http://www.google.com'.
APPEND PRO_LS TO PRO.
pro_LS-NAME = 'DESCRIPTION'.
PRO_LS-VALUE = 'Description'.
APPEND PRO_LS TO PRO.
CALL METHOD cl_crm_documents=>create_url
EXPORTING
url = url
properties =
properties = pro
business_object = ls_bus_obj
parent_folder =
IMPORTING
loio = lt_loio
phio = lt_phio
error = lt_error
BREAK-POINT.
CALL METHOD cl_crm_documents=>rename_object
EXPORTING
is_io = lt_loio
iv_name = 'Application'
IMPORTING
es_error = lt_error
EXCEPTIONS
io_not_renameable = 1
name_error = 2
others = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Similar Messages
-
Attaching local URL via WS 2.0 returns SBL-DBC-00111 and SBL-EAI-04375
I can create attachments using Insert in WS 2.0. Now I need to create an attachment as URL to a local server, in the form User Guide suggests: as \\scdept\attachments\products.xls and I also know that I can do it via OD GUI.
But any attempt to do it via WS returns this error:
*Method 'WriteRecord' of business component 'Opportunity Attachment' (integration component 'Opportunity_Opportunity Attachment') for record with search specification '[Id] = "AIHA-HBX3A"' returned the following error:"An error has occurred writing to a record.*
*Please continue or ask your systems administrator to check your application configuration if the problem persists.(SBL-DBC-00111)"(SBL-EAI-04375)*
The SOAP call is this:
SOAP action is: document/urn:crmondemand/ws/ecbs/opportunity/:OpportunityInsert
SOAP body is: *<soap:Body><OpportunityInsert_Input xmlns="urn:crmondemand/ws/ecbs/opportunity/"><ListOfOpportunity recordcount="1" xmlns="urn:/crmondemand/xml/Opportunity/Data"><Opportunity><Id>AIHA-GVS1O</Id><OpportunityName>AIHA-GVS1O</OpportunityName><ListOfAttachment lastpage="true" recordcount="1"><Attachment><OpportunityId>AIHA-GVS1O</OpportunityId><DisplayFileName>AIHA-GVS1O_Form</DisplayFileName><FileNameOrURL>//backup/Shared/customers/AIHA-GVS1O_Form.txt</FileNameOrURL></Attachment></ListOfAttachment></Opportunity></ListOfOpportunity></OpportunityInsert_Input></soap:Body>*
I tried removing parent ID ( OpportunityId ), I tried adding +<FileExtension>URL</FileExtension>+, I tried specifying URL as file://backup/Shared/customers/AIHA-GVS1O_Form.txt, ... The same error is always returned.
Do I have to revert to WS 1.0? Does it work there?
Are file URLs supported at all with WS (as opposed to HTTP and FTP)?I saw this message recently in some testing, but only see it intermittently in one environment - did you ever resolve this issue?
-
I hit the replace when publishing the new iweb site (so we could have control over changes - last one was not an apple based site) but new site name is attached to old via a forward slash and underscore after our www address. Makes it very messy with a very long web address. Original address now followed by iweb site name followed by name of first page? Went for iweb as not that computer literate - all going so well?! Cheers for help in anticipation. Have to get off to work now but be great end to week if we could be sorted tonight. Rupes
Well yes of course, if you try and publish through iWeb there won't be an option to publish without your site folder which is exactly why I told you to download Cyberduck and use Cyberduck to upload your site to your server having published your site from iWeb to a local folder. That is what you need to do if you don't want your site name to be included in yoru url.
It would have been easier also if you had used Cyberduck initially to connect to your server and delete your old site yourself - at least that way you would have deleted the correct files rather than relying on your hosting service to do it and doing it incorrectly.
Download Cyberduck and then select the publish to a local folder option from iWeb and then use Cyberduck to upload your site to your server, but rather than uploading the whole site folder and separate index file, upload ONLY the contents of your site folder and then your url will be http://www.domain.com/page_name.html.
It really isn't rocket science! -
Attaching a URL which does not start with HTTP / HTTPS in SAP TM
Dear Experts,
I am trying to insert a new URL to a Attachments table in FWO / FRB application.
My URL neither start with HTTP nor HTTPS (Ex: Z3://searchsmartstart...). while I am trying to insert such URL, I am getting an error message 'URL not valid.Check if the URL contains the protocol (HTTP/HTTPS). Message ID - /SCMTMS/UI_MESSAGES and message number 088.
After some analysis, I have understood that WebDynpro ABAP framework does not accept such URL.
Could you please guide, is there any other way of doing it? The URL which I am trying to access is of SMART CLIENT.
Thanks in advance for your reply.
Thanks,
Bharath.KHi Bharath,
Yes, you can achieve the same via URL redirection. Please follow the below steps.
1.Create a service in SICF e.g. sap/bc/redirect_z3 in your SAP TM system and follow following steps.
2. Create a class with interface IF_HTTP_EXTENSION e.g. ZCL_REDIRECT_URL
3. Maintain class created in step 2 into the Handler List of the service created in step 1.
4. In class ZCL_REDIRECT_URL Method IF_HTTP_EXTENSION~HANDLE_REQUEST write below code
Data: lv_target type string.
lv_target = 'Z3://searchsmartstart.......'
server->response->redirect( url = lv_target ).
5. You can also read the parameter from the source URL with below program code
CALL METHOD server->request->get_form_data
EXPORTING
name = 'PAR1'
CHANGING
data = lv_par1.
6. Now attach the URL of your service created in step 1(Which will be http/https URL) to Attachments table in FWO / FRB application with parameter you want.
Now once you click this URL , Mehtod IF_HTTP_EXTENSION~HANDLE_REQUEST in Handler list class will execute here you can read the parameter as mentioned above and form a target URL and redirect to you intended target .
Thanks, Pravin -
Getting error when connecting to url via https
I am connecting to a url via https. Everything seems to work when I open the connnect as follows.
conn = (HttpsURLConnection)theURL.openConnection();
//Set the proper connections properties
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
conn.setDoInput(true);
But when I try to send data with the following code:
StringBuffer sendThis = new StringBuffer();
sendThis.append( URLEncoder.encode("uid=", "UTF-8") );
sendThis.append( URLEncoder.encode("This is the UID", "UTF-8") );
/* PrintWriter pout = new PrintWriter( new OutputStreamWriter( conn.getOutputStream(), "8859_1"), true);
pout.print (sendThis.toString());
pout.flush();
I get an error that says "could not find trusted certificate"
Could not find trusted certificate
javax.net.ssl.SSLHandshakeException: Could not find trusted certificate
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(DashoA62
75)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(OutputStream.java:58)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:562)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Dash
oA6275)
What am I missing ?
thanks in advance.
kris.You have to make sure that the cert for the CA which signed the server's
certificate is in your keystore (cacerts) file.
Check out 'keytool' and the JSSE readme.
Cheers,
Billy. -
Get Gateway name / url via JSP
Anyone say what is the method to get the Gateway name / url via JSP?
Thanks
FaustoAlex, in the normal case you have reason the client host is the gateway host.
A simple code:
<%
InetAddress inet = InetAddress.getByName( request.getRemoteHost() );
String gateway = inet.getHostName();
String portal="http://" + gateway + "/portal/dt";
gateway="https://" + gateway + "/";
String url=request.getParameter("url");
if ( url != null) {
response.sendRedirect(gateway + url);;
}else{
responde.sendRedirect(gateway + portal);
%>
I put a jsp in the web container, I contact the jsp trough an url
http://www.mydomain/portal/desktop/redirect.jsp without the method get for the url variable, if I call the jsp directly without gateway from my client the gateway variable is my dns hostname and the jsp cannot redirect my in the portal login page
If I take the localhost, it works fine but if a particular case when the gateway and the platform are the same host.
There is not a HTTP enviroment variable to get the gateway name or a simple java method to ask the correct host?
Thank you again
Fausto
http://www.mydomain/portal/desktop/redirect.jsp
i -
GS_CM. How to hide buttons: 'Attachment' and 'URL'
Hi,
Business object 'catalog product' use component GS_CM
We want to hide buttons: Attachment and URL
We need to use only button Advanced.
How I can customize it?
Denis.Dear Denis,
Enhance Component GS_CM and view DocList.
Redefine method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS and implement the following code:
super->IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS( ).
delete gt_button where id ne 'advanced'.
Hope this helps.
Thanks
Vishal
Edited by: Vishal Kesar on Aug 9, 2011 2:07 PM -
Workflow UWL attachment external url
Hi all,
i'm trying to open an URL as attachment via the EP form the UWL. Links like http://www.google.de or other external URL are not correctly shown in the webbrowser (IE7.x).
how can i attach an URL (documenttype is URL) to an Workitem an let it show directly from the UWL
Cheers
FelixI don't know if it works in UWL but using html tags
<a href="www.xyz.com"> test </a>
works for SAP inbox. Try this.
Regards, IA
Edited by: Imthiaz Ahmed on Jul 25, 2008 9:11 AM -
How to display a popup window (DialogMessage) via code behind c#?
hi all,
How to display a popup window (DialogMessage) via code behind c#?
I use sp 2013, in else case I want show the DialogMessage:
if(condition)
else
HttpContext.Current.Response.Redirect(SPContext.Current.Web.Url+"/_layouts/TestError/ErrorDueDate.aspx");
the above Redirect work good but I want show the error in a DialogMessage its better because of Usability and not redirect the user to new page...
if not via code behind is there a better way to do it?
thanks in advance
Ahmad
SP 2013 & SPD 2013 & VS 2013 & MSSQL 2012thanks for you answer,
And yes I includ them via CDN, like below:
<script
type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js"
type="text/javascript"></script>
<link
href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
rel="stylesheet" type="text/css"
/>
But I get still the above error in my previes post.
SP 2013 & SPD 2013 & VS 2013 & MSSQL 2012 -
Hi,
I've been using getPortalApplicationURL (WDPortalUtils Class) in portal 7.0 to get the URL of an iview using the pcd.
It does not work in portal 7.3 ! (or any CE portal for that matter) it just returns the pcd itself as result, despite the fact it is not deprecated or anything else.
Before I open an OSS regarding this issue i wanted to know if there's another way to get the URL via PCD.
thanks!Hi Yoav,
I tried setting up the EPCF but it isn't working. I can't
get the iView to open in the central frame. Problem is, i
can't change the code very much now as this is only a
content migration from EP5 to EP6 and not a rewrite of the code.
To get the rid i use:
RID rid = RID.getRID(request.getParameter("rid"));
but i don't url-encode it. Which might be the issue.
However not url-encoding it was not an issue in EP5.
Thanks,
Ale -
I have a mid-2010 iMac and just purchased a 2TB TC, I just found out that it can't join existing wireless network with new AC standard so attached to iMac via ethernet with TC's wifi turned off. How do i access TC now? not showing up in disk utility or on desktop. It is working fine with TM. My cheeper seagate drives etc kept crashing, so i didnt trust cheeper back up options anymore. Connected those drives to TM via firewire and could see the drives and access them.
Also, I didn't want to bridge TC with my new fios router that I paid 100 dollars for, to get N speed and also paying 10 dollars more a month for fast speed. I heard that bridging slows down everything and then there can be port issues with mail etc. I connect to the internet via airport only and it is pretty fast. Getting over 50mbs downloads and over 30mbs uploads. Plus everything in my home it connected to my fios router, airport express for music streaming, two apple tvs, vuezone camer system. I really didn't want to monkey around too much with my system. But are there other options to connect the new TC. Can't find info anywhere for this and called apple who gave me the info above. after hanging up, i see that i cant access my TC and I am wondering if i would have to reset it to turn wifi on again to make changes to the drive, turn off blinking light or repair it in disk utility if it should become corrupted.
For other with similar issues i did solve some other problems: when i connected it to my ethernet port on my iMac wifi stopped working. Found that I had to turn off the ethernet in the system>network screen, but then TM didn't see the TC so i restarted after changes and then it saw it.
Now a rant. I can't believe in this wireless age that Apple would make a product that cant join a wireless net work. The apple rep said i could return it and look for the previous TC that would join an existing wireless network. Are we going backwards?
Thanks!
lennydasOk... it is getting a bit clearer but there are still some questions.
I connect to the internet via airport only and it is pretty fast.
I was assuming airport in this statement in your first post meant the TC or the Express.. but I now realise we are still in the mass confusion stage where apple calls everything wireless an airport. So what you mean is the airport internal card of the computer??
Also, I didn't want to bridge TC with my new fios router that I paid 100 dollars for, to get N speed and also paying 10 dollars more a month for fast speed. I heard that bridging slows down everything and then there can be port issues with mail etc.
I think this is mistaken.
Putting the TC in bridge mode plugged into your FIOS will not slow the network.. nor will it cause mail or port issues.. in bridge the TC is just a fancy WAP and switch plus the network hard drive.
If the computer is close it will be faster than the FIOS.
You can run both wireless networks with different names.. so it is clear which is which. But you can also setup roaming so the computers themselves pick which is the best wireless.
I tried extending the wireless net work and tried joining wireless network, but the TC kept crashing and I had to keep resetting the TC. the Apple support person said these, extend wireless network and joint wireless network, are no longer a connection option with the new TC because of the new AC protocol.
Thanks again!
You cannot extend to a non-apple wireless router.
You cannot use join a wireless network because when you do the ethernet ports will be cut off.
But that has not changed.. I don't think Apple support is correct.. there has been no change with the AC model.. it is simply a fact that apple routers do not work in join wireless mode other than as a dumb client. The same applies to AC as to the earlier version.. but I have asked another person to check this.
Join in the express is the only apple router that still allows an ethernet connection.
For now you best use of the TC is bridged to the FIOS. Wireless you can sort out between several options. -
Supplying username and password to repository via code
Hi There,
Is there a way to supply the username and password to the webdav repository via code or in the address line? We have an ActiveX object accessing files and would like to avoid the repository prompting.
ThanksWith Script I can do it as follows.. See VerifyConnection
Option Explicit
Const iTimeOutInSecs = 60
Const ForWriting = 2
Rem ************** MAIN *****************
main
Wscript.quit
Sub Main
Dim WShell, FileSystem
Dim davControl
Dim objArgs, targetPath, serverURL, username, password, rootFolder, filter
Dim fileUploadList, result
Dim folderList, filelist
Dim status
Dim spoolFile
Set wShell = WScript.CreateObject("WScript.Shell")
Set fileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set spoolFile = fileSystem.OpenTextFile("httpUploadLoad.log", ForWriting, True)
Set objArgs = WScript.Arguments
targetPath = objArgs(0)
serverUrl = objArgs(1)
username = objArgs(2)
password = objArgs(3)
rootFolder = objArgs(4)
If objArgs.length = 6 Then
filter = objArgs(5)
Else
filter = Empty
End If
Set fileUploadList = CreateObject("Msxml2.DOMDocument.4.0")
fileUploadList.async = False
result = fileUploadList.load(targetPath)
If (result = False) Then
MsgBox "Failure while loading or parsing file : " & targetPath,vbCritical
Wscript.quit
End If
Set davControl = new DavControlClass
davControl.setServer serverURL, username, password
davControl.setSpoofile(spoolfile)
status = verifyHttpConnection(davControl, username)
Set folderList = fileUploadList.documentElement.selectNodes("/Upload/directories/directory")
createFolders davControl, rootFolder, folderList, username, password, filter
Set fileList = fileUploadList.documentElement.selectNodes("/Upload/files/file")
uploadFiles davControl, rootFolder, fileList, username, password, filter
spoolfile.close()
End Sub
Function verifyHttpConnection(davControl,username)
Dim status, targetFolder
targetFolder = "/home/" & username
status = davControl.verifyConnection(targetFolder)
verifyHttpConnection = status
End Function
Sub createFolders(davControl, rootFolder, folderList, username, password, filter)
Dim i, targetFolder, targetFolderPath
For i = 0 to folderList.length - 1
Set targetFolder = folderList.item(i)
targetFolderPath = rootFolder & targetFolder.text
If IsNull(filter) or (InStr(targetFolder.text,filter) = 1) Then
'wscript.echo "Making " & targetFolderPath
davControl.makeDir targetFolderPath,true
End If
Next
End Sub
Sub uploadFiles(davControl, rootFolder, fileList, username, password, filter)
Dim i, targetFile, targetFilename, localFilename
For i = 0 to fileList.length - 1
Set targetFile = fileList.item(i)
targetFilename = rootFolder & targetFile.text
localFilename = Right(replace(targetFile.text,"/","\"),Len(targetFile.text)-1)
If IsNull(filter) or (InStr(targetFile.text,filter) = 1) Then
'wscript.echo "Uploading " &localFilename & " as " & targetFilename
davControl.uploadFile localFIlename, targetFileName, "FORCE"
End If
Next
End Sub
Class DavControlClass
Private HTTPUser
Private HTTPPassword
Private HTTPServer
Private installParameters
Private windowsShell
Private XMLHTTP_CLASS_ID
Private HttpObject
Private spoolFile
Dim folderStatusList
Private Sub Class_Initialize()
XMLHTTP_CLASS_ID = "Msxml2.XMLHTTP.6.0"
Set HttpObject = CreateObject(XMLHTTP_CLASS_ID)
folderStatusList = Empty
End Sub
Public Sub setSpoofile(file)
Set spoolFile = file
End Sub
Public Sub setParameters(wshell, params)
Set installParameters = params
Set windowsShell = wShell
setServer params.getServerURL(), params.getUser(), params.getPassword()
End Sub
Public Sub setServer(serverURL,serverUser,serverPassword)
HTTPServer = serverURL
HTTPUser = serverUser
HTTPPassword = serverPassword
End Sub
Public Function getServerURL
getServerURL= HTTPServer
End Function
Public Function verifyConnection(target)
On Error Resume Next
HttpObject.Open "HEAD", HTTPServer & target, false, HTTPUser, HTTPPassword
If Err.Number <> 0 Then
WScript.echo "verifyConnection() - Fatal Error encountered accessing : " & HTTPServer & target & ". Status (" & Hex(Err.number) & ") " & Err.Description
Wscript.quit
End If
On Error GoTo 0
HttpObject.setRequestHeader "Content-type", "text/xml"
HttpObject.setRequestHeader "Depth", "1"
On Error Resume Next
HttpObject.send ("")
If Err.Number <> 0 Then
WScript.echo "resetConnection() - Fatal Error encountered accessing : " & HTTPServer & target & ". Status (" & Hex(Err.number) & ") " & Err.Description
Wscript.quit
End If
On Error GoTo 0
If HTTPObject.status <> 200 Then
MsgBox "Unable to access " & getServerURL() & target & ". HTTP Status = " & HTTPObject.status & ". Please correct installParameters.xml and restart Installation",vbCritical
Wscript.quit
End If
spoolfile.writeline "HTTP Successfully Connected to '" & getServerURL() & target
verifyConnection = HTTPObject.status
End Function
Public Function uploadFile (local, remote, mode)
Dim returnCode, rc
returnCode = doHead(remote)
If returnCode = 401 Then
MsgBox "uploadFile() - Unauthorized (Status (" & returnCode & "). Unable to upload '" & local & "' into '" & remote & "'. Please check installParameters.xml and log files.",vbCritical
Wscript.quit
End If
If returnCode = 200 Then
If mode = "ERROR" Then
MsgBox "uploadFile() - Installation Failed. Resource Exists : '" & remote & "'. Please check installParameters.xml and restart Installation",vbCritical
Wscript.quit
End If
If mode = "SKIP" Then
uploadFile = returnCode
Exit Function
End If
If mode = "FORCE" Then
rc = doDelete(remote)
End If
End If
uploadFile = doPut (local, remote, null)
If uploadFile = 500 Then
MsgBox "UploadFile() - Upload Failed (Status (" & uploadFile & "). Unable to upload '" & local & "' into '" & remote & "'. Retry in Progress.",vbCritical
uploadFile = doPut (local, remote, null, user, password)
If uploadFile = 500 Then
MsgBox "UploadFile() - Installation Failed (Status (" & uploadFile & "). Unable to upload '" & local & "' into '" & remote & "'. Please check installParameters.xml and log files.",vbCritical
Wscript.quit
End If
End If
If uploadFile = 401 Then
MsgBox "UploadFile() - Unauthorized (Status (" & uploadFile & "). Unable to upload '" & local & "' into '" & remote & "'. Please check installParameters.xml and log files.",vbCritical
Wscript.quit
End If
End Function
Public Function makeDir(targetFolder,force)
Dim Status, ParentFolder
status = doHEAD(targetFolder)
If not IsEmpty(folderStatusList) Then
folderStatusList.add targetFolder, status
End If
If (status = 404 or status = 409) and force Then
parentFolder = Mid(targetFolder,1,InStrRev(targetFolder,"/")-1)
makeDir parentFolder,true
status = doMKCOL(targetFolder)
End If
makeDir = status
If status = 401 Then
MsgBox "doMKCOL() - Unauthorized (Status (" & status & "). Unable to create '" & targetFolder & "'. Please check installParameters.xml and log files.",vbCritical
Wscript.quit
End If
End Function
Public Function doHEAD(remote)
' Dim HttpObject
' Set HttpObject = CreateObject(XMLHTTP_CLASS_ID)
' HttpObject.Open "HEAD", HTTPServer & remote, false, user, password
HttpObject.Open "HEAD", HTTPServer & remote, false
HttpObject.setRequestHeader "Content-type", "text/xml"
HttpObject.setRequestHeader "Depth", "1"
On Error Resume Next
HttpObject.send ("")
If Err.Number <> 0 Then
WScript.echo "doHEAD() - Fatal Error encountered accessing : " & HTTPServer & remote & ". Status (" & Hex(Err.number) & ") " & Err.Description
Wscript.quit
End If
On Error GoTo 0
doHead = HttpObject.status
End Function
Public Function doPUT(local,remote,contentType)
Dim tmStart
Dim tmCurr
Dim iTimeTaken
Dim currentStatus
Dim ado_stream
Dim uploadCount, uploadStatus
Set ado_stream = CreateObject("ADODB.Stream")
ado_stream.Type = 1
ado_stream.Open()
On Error Resume Next
ado_stream.LoadFromFile(local)
If Err.Number <> 0 Then
WScript.echo "doPUT() - Fatal Error encountered reading File : " & local & ". Status (" & Hex(Err.number) & ") " & Err.Description
Wscript.quit
End If
On Error GoTo 0
HttpObject.Open "PUT", HTTPServer & remote, false
If not IsNull(contentType) Then
HttpObject.setRequestHeader "Content-type", contentType
End If
tmStart = Now
On Error Resume Next
HTTPObject.send(ado_stream.Read(-1))
If Err.number <> 0 Then
' Unexpected errors can occur as a result of the HTTP request being passed to wrong database instance
' when multiple databases are using the same listener.
WScript.echo "doPUT() - Fatal Error encountered uploading File : " & local & ". Status (" & Hex(Err.number) & ") " & Err.Description
WScript.quit
Else
currentStatus = HTTPObject.status
End If
On Error GoTo 0
uploadCount = 1
uploadStatus = doHead(remote)
Do While uploadStatus <> 200 and uploadCount < 6
' Unexpected errors can occur as a result of the HTTP request being passed to wrong database instance
' when multiple databases are using the same listener.
spoolfile.writeline "Http Error encountered uploading " & local & " to " & HTTPServer & remote &". Status=" & currentStatus
currentStatus = retryPUT(local,remote,contentType)
uploadCount = uploadCount + 1
uploadStatus = doHead(remote)
Loop
If uploadStatus = 200 Then
tmCurr = Now
spoolFile.writeLine "Uploaded File " & local & ". Elapsed Time = " & CInt(DateDiff("s", tmStart, tmCurr)) & " seconds."
Else
WScript.echo "doPUT - Fatal Error uploading file (" & HTTPServer & remote & ") : Status=" & HTTPObject.status
WScript.quit
End If
doPut = currentStatus
ado_stream.Close()
End Function
Public Function retryPUT(local,remote,contentType)
Dim ado_stream
Set ado_stream = CreateObject("ADODB.Stream")
ado_stream.Type = 1
ado_stream.Open()
On Error Resume Next
ado_stream.LoadFromFile(local)
If Err.number <> 0 Then
WScript.echo "doPUT() - Fatal Error encountered reading File : " & local & ". Status (" & Hex(Err.number) & ") " & Err.Description
Wscript.quit
End If
On Error GoTo 0
HttpObject.Open "PUT", HTTPServer & remote, true
If not IsNull(contentType) Then
HttpObject.setRequestHeader "Content-type", contentType
End If
On Error Resume Next
HTTPObject.send(ado_stream.Read(-1))
If Err.Number <> 0 Then
ado_stream.Close()
WScript.echo "doPUT() - Fatal Error encountered sending File : " & local & " to " & HTTPServer & remote &". Status (" & Hex(Err.number) & ") " & Err.Description & ". Retrying ...."
Wscript.quit
Else
Do While HTTPObject.readyState <> 4
WScript.Sleep(1000)
Loop
End If
On Error GoTo 0
ado_stream.Close()
retryPut = HTTPObject.status
End Function
Public Function doMKCOL(remote)
' wscript.echo "doMKCOL (" & HTTPServer & remote & ")"
Dim currentStatus
HttpObject.Open "MKCOL", HTTPServer & remote, false
HttpObject.setRequestHeader "Content-type", "text/xml"
On Error Resume Next
HttpObject.send("")
If Err.Number <> 0 Then
WScript.echo "doMKCOL() - Fatal Error encountered making Folder : " & HTTPServer & remote &". Status (" & Hex(Err.number) & ") " & Err.Description
Wscript.quit
End If
On Error GoTo 0
If HTTPObject.status <> 201 Then
WScript.echo "doMKCOL() - Fatal Error encountered making Folder : " & HTTPServer & remote &". Status (" & HTTPObject.status & ")."
Wscript.quit
End If
doMKCOL = HTTPObject.status
End Function
Public Function doDELETE(remote)
HttpObject.Open "DELETE", HTTPServer & remote, false
HttpObject.setRequestHeader "Content-type", "text/xml"
On Error Resume Next
HttpObject.send("")
If Err.Number <> 0 Then
WScript.echo "doMKCOL() - Fatal Error deleting : " & HTTPServer & remote &". Status (" & Hex(Err.number) & ") " & Err.Description
Wscript.quit
End If
On Error GoTo 0
doDELETE = HTTPObject.status
If HTTPObject.status <> 201 and HTTPObject.status <> 204 and HTTPObject.status <> 207 and HTTPObject.status <> 404 Then
wscript.echo "doDELETE (" & HTTPServer & remote & ") : Status=" & HTTPObject.status
End If
End Function
End Class -
How could I open an saved Draft report via API/UI.
I have draft an report via API/UI and now I would show this report on Desktop/SAP
I would open it via code
z.B. application.forms.items("")
because I get the Docnum of my before safed draft but It wouldn´t shown at the SAP now so I have to open it via codeSorry for my first Miss Understandable explanation.
Ok let me explain the other times.
I have a parked document, I want this now to open it via code (programming).
I have this code today:
programspeach: vb.net
we assume we have a sales order and press now via code the menu option "Save as a parked document"
' to change the sales order in a parked document
appl.ActivateMenuItem(("5907"))
' Information: MY_FormUID = the sales order before
' Change DocNum in DocEntry
oRSTRDocData.DoQuery(("SELECT max(DocEntry) FROM ODRF WHERE DocNum=" & Value))
appl.Forms.Item(MY_FormUID).Items.Item("txtDraft").Specific.Value = oRSTRDocData.Fields.Item(0).Value
' take the DocEntry
Value = oRSTRDocData.Fields.Item(0).Value
'open parked Document via DocEntry and let it show
appl.Forms.Item(MY_FormUID).Items.Item("lnkDraft").Click(SAPbouiCOM.BoCellClickType.ct_Linked)
' Close the Sales Order before
appl.Forms.Item(OLD_FormUID).Close()
After this there is no Document opened, also not the parked Document
So yet I have an parked Document but when I open the SBO again there is no Document Opened? When I do this prozedere via SBO there will be at least the parked Document opened.
What do I wrong? -
Stored Procedure parameter (@Carrier) used in report and can't be set via code
I have a report that has regular Crystal parameters that I am setting correctly via code. However, one report actually uses one of the database parameters from the stored procedure that the report was created from. It is the only report like this and I'm using the same code in an attempt to set it's value. Although no error is thown, if I look at the parameter value in the IDE it is set correctly, but the field on the report just shows up blank. I have changed the way the report is created. Previously, I used the report.export method to create the actual file via a stored procedure. Now, I'm running the stored procedure first and creating a datatable. This allows me to execute the SP only once to see if it has data, because only then do I want to create the actual report. I'm using the SetDataSource method to pass the datatable into Crystal and then using the report.export method to create the report with data. Everything seems to work, except this stored procedure parameter (@Carrier) is not actually being populated to display on the report.
Not sure what to look at. Any suggestions?
Thanks.crpe32.dll is version 13.0.5.891. This was developed in VS2012 and VB.NET. I'm using ADO.Net to connect to a MS SQL Server database.
MainReport.SetDataSource(DTbl)
bRC = PopulateAllSubReports(MainReport)
If Not bRC Then Throw New Exception("Received an error in PopulateAllSubReports.")
bRC = PopulateCrystalParameters(MainReport, SP)
If Not bRC Then Throw New Exception("Received an error in PopulateCrystalParameters.")
'Actually create the output file.
bRC = ExportData(MainReport)
Private Function PopulateCrystalParameters(myReportDocument As ReportDocument, SP As ReportStoredProcedureCrystal) As Boolean
Dim myParameterFieldDefinitions As ParameterFieldDefinitions = Nothing
Dim myParameterFieldDefinition As ParameterFieldDefinition = Nothing, ParamValue As String = ""
Dim bRC As Boolean, Param As SqlParameter = Nothing
Try
myParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterFields
'*********************Report Parameters***************************
For Each myParameterFieldDefinition In myParameterFieldDefinitions
myParameterFieldDefinition.CurrentValues.Clear()
Select Case myParameterFieldDefinition.ParameterFieldName.Trim.ToUpper
Case "@CARRIER"
If SP.DBParameters.ContainsKey("@CARRIER") Then
Param = SP.DBParameters("@CARRIER")
ParamValue = NullS(Param.Value).Trim
bRC = SetCurrentValueForParameterField(myParameterFieldDefinition, ParamValue)
If Not bRC Then Return False
End If
End Select
Next
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
End Try
End Function
Private Function SetCurrentValueForParameterField(myParameterFieldDefinition As ParameterFieldDefinition, submittedValue As Object) As Boolean
Dim currentParameterValues As ParameterValues = Nothing
Dim myParameterDiscreteValue As ParameterDiscreteValue = Nothing
Try
myParameterDiscreteValue = New ParameterDiscreteValue
myParameterDiscreteValue.Value = NullS(submittedValue).Trim
currentParameterValues = New ParameterValues
currentParameterValues.Add(myParameterDiscreteValue)
myParameterFieldDefinition.ApplyCurrentValues(currentParameterValues)
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
Finally
myParameterDiscreteValue = Nothing
currentParameterValues = Nothing
End Try
End Function
Private Function SetDBSourceForSubReport(mySubReport As ReportDocument) As Boolean
Dim myTables As Tables = Nothing, myTable As Table = Nothing, DTbl As DataTable, SP As StoredProcedure = Nothing
Try
myTables = mySubReport.Database.Tables
For Each myTable In myTables
Dim SPName As String = myTable.Location.Substring(0, myTable.Location.IndexOf(";"c))
SP = New StoredProcedure(ConnectionString, SPName, CommandType.StoredProcedure)
DTbl = SP.FillTable
mySubReport.SetDataSource(DTbl)
SP = Nothing
Next
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
Finally
If Not SP Is Nothing Then SP = Nothing
If Not myTable Is Nothing Then myTable = Nothing
If Not myTables Is Nothing Then myTables = Nothing
End Try
End Function
Private Function PopulateAllSubReports(myReportDocument As ReportDocument) As Boolean
Try
Dim mySections As Sections = myReportDocument.ReportDefinition.Sections
For Each mySection As Section In mySections
Dim myReportObjects As ReportObjects = mySection.ReportObjects
For Each myReportObject As ReportObject In myReportObjects
If myReportObject.Kind = ReportObjectKind.SubreportObject Then
Dim mySubreportObject As SubreportObject = CType(myReportObject, SubreportObject)
Dim subReportDocument As ReportDocument = mySubreportObject.OpenSubreport(mySubreportObject.SubreportName)
Dim bRC = SetDBSourceForSubReport(subReportDocument)
If Not bRC Then Return False
End If
Next
Next
Return True
Catch ex As Exception
GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
Return False
End Try
End Function -
I have a problem with either Mountain Lion, Safari or Mail 6.0.
When I try to attach a URL as a link that is taken from Safari to mail 6.0 the font and font size changes!!!!!
It changes from comic sans 24 to heltvekia 12!!!! What the heck is going on??????
Thanks for any help you can shed on this problem.
BBC1050I also upgraded to Lion and do have font problems in Mail. Just in some mails, including my own signature.
I just updated today with 10.7.1, but still have the font problem.
Does anyone know if Apple will solve this?
Maybe you are looking for
-
Steps for creating a dashboard in desktop and deploying it on an ipad
Hi All, Can any one tell me the steps to dashboard creation for mobile(i-pad or i-phone) with an example. is it possible in Bi or we should develop it Publisher ? Please clarify me and let me know the creation steps with example'
-
How to put java files in *.jar
I have 5 *.java files in 1 directory. I want to put those 5 classes in a *.jar file without using some special tool. How is the best way to do that. It is something with the command prompt? All help welcome. Grtz Lehtori
-
List of GL accounts without posting
Hi Guru, Appreciate if you could help me. i need to get all the list of GL Accounts without postings but how? Appreciate the response thanks in Advance
-
Using two computers - Photoshop Elements
I live in the USA for part of the year and the UK for the remainder and wish to purchase Adobe Photoshop Elements - Does the license let me download it onto 2 separate computers (one in UK & one in USA) . I use a separate hard drive for files so I ca
-
Drap and Drop between MS-Word and a Java-Applet
Hi, i've read that it is possible to drag a text in an applet and to drop it on a word document. Somebody know if it is possbile to do it the other way round ? To drag a text within a word document and to drop it on an applet. thanks a lot