12-22-2014 10:43 AM
Hello!
We are sending XML files from our ERP to another SAP system. In order to send those files we first encode them, insert encoded text into SOAP message body and then send to a webservice that deals with forwarding the request to our target system. However there is a slight mistake in encoding the xml file - after decoding there appears to be a "#" symbol in the very beginning of the file. I've debugged the encoding process multiple times and this symbol does not exist there before encoding. This doesn't necessarily mean that there is a "#" symbol in the file. It could be newline or some other kind of symbol yet I used CONDENSE on that string and it doesn't make the problem go away. Has anybody else had this problem in the past?
I should also add that the files being read are BCM Batch payment files that are stored in TemSe.
12-22-2014 11:25 AM
Hi,
Try:
REPLACE first OCCURRENCES OF REGEX '[\n\t\r]' IN <your string> WITH '' .
regards.
12-22-2014 11:25 AM
Hi,
Try:
REPLACE first OCCURRENCES OF REGEX '[\n\t\r]' IN <your string> WITH '' .
regards.
12-22-2014 11:34 AM
12-22-2014 11:45 AM
Hi,
If you write the file as plain text to some share folder do you have this problem ?
Do you see the character in debug ? if yes find out the hex code.
regards.
12-22-2014 12:01 PM
I debugged the program and here I saw no symbols whatsoever. However when I wrote the string to a file I saw that symbol. Downloaded the file from ERP and checked it with Hex editor. It turned out to be BOM. That's funny though because this problem has never surfaced before.
12-22-2014 12:20 PM
Now rises the question how to remove this byte order mark? If I would read this XML from a physical file then I could just say SKIPPING BYTE-ORDER or sth like that. However I use "FI_PAYM_FILE_READ" and this doesn't allow me to specify additional options. Should I just write the string to file and then re-read this file without BOM? Or maybe this could be achieve more elegantly?
12-22-2014 1:35 PM
Hi,
Assuming the XML is one big string......
Try (I did not test this)
OPEN DATASET in BINARY MODE
TRANSFER dobj TO dset NO END OF LINE .
close....
regards.
12-22-2014 2:03 PM
Well that's the thing. I shouldn't need to write this XML into physical file before it has reached its destination. And it should already be sent in correct form. So what I need to do, is remove BOM from string and then encode it.