on 2024 Oct 18 8:09 AM
Hello SAP Community. I need to paste data from a text file into multiple selections.
I have code that works in part:
Dim boundary As String
Dim formData As String
Dim fileBytes() As Byte
Dim fullRequest() As Byte
Dim filePath As String
Dim file As String
Dim byteContent() As Byte
Dim i As Long
Dim fileNumber As Integer
Dim fileSize As Long
Dim formDataLength As Long
Dim totalLength As Long
filePath = "D:Macro\WebSAPtest\exceptions.txt"
file = "exceptions.txt"
' Random boundary generation
boundary = "----WebKitFormBoundary" & GenerateBoundary()
formData = "--" & boundary & vbCrLf
formData = formData & "Content-Disposition: form-data; name=""updownbase64in""" & vbCrLf & vbCrLf
formData = formData & vbCrLf
formData = formData & "--" & boundary & vbCrLf
formData = formData & "Content-Disposition: form-data; name=""updownchunkstatusin""" & vbCrLf & vbCrLf
formData = formData & vbCrLf
formData = formData & "--" & boundary & vbCrLf
formData = formData & "Content-Disposition: form-data; name=""updownfilesize""" & vbCrLf & vbCrLf
formData = formData & fileSize & vbCrLf
formData = formData & "--" & boundary & vbCrLf
formData = formData & "Content-Disposition: form-data; name=""LOCALFILE1""; filename=""exceptions.txt""" & vbCrLf
formData = formData & "Content-Type: application/octet-stream""" & vbCrLf & vbCrLf
formData = formData & ReadFileContent(filePath) & vbCrLf
formData = formData & "--" & boundary & "--" & vbCrLf
' send request
xmlHttp.Open "POST", "http://" & sap_web_server & link & "post", False
xmlHttp.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & boundary
xmlHttp.send formData
It writes two numbers to one cell in encoded form:
u3035\u3330\u3134\u3737\u0A0D\u3035\u3330\u3136\u3434\u0A0D
Also i have python code that works correctly:
with open(os.path.join(input_folder, 'exceptions.txt'), 'rb') as exceptions_file:
r=session.post(f"http://{sap_web_server}{link}post",
files={'exceptions.txt': exceptions_file},
params={'SEC_SESSTOKEN': sessiontoken,
'updownchunkstatusin': '',
'updownbase64in': '',
'LOCALFILE1': '(binary)'})
how to change the code so that data is written to different cells, the values in the text file can be more than 300. what am I doing wrong?
Request clarification before answering.
User | Count |
---|---|
9 | |
8 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.