11-21-2016 7:51 PM - edited 02-03-2024 5:28 PM
Hello everyone.
I need to create document (and other business object) in SAP B1 from imported file.
I would like to use XML, but my first steps to learn working with XML and B1 are annoying. I need some advice:
I saved XML schema for Business Partner object (GetBusinessObjectXmlSchema), and then I get object GetAsXML (XMLAsString = true, XmlExportType = xet_ExportImportMode). Q:
1. XML file encoding is set to UTF-16, but content is UTF-8, any idea why?
2. XML file is not valid with earlier saved schema, what is wrong?
3. My goal is prepare valid XML file outside SAP and use it to create object using DI API, can You give some advice?
I will be very grateful for any help or knowledge.
Hi Michal,
One common approach is to export the GetAsXML file and clean the data. Then use that as a template when creating your importable file.
The UTF-16 has always been like that, and if I recall correctly it's not necessary to include the XML declaration tag (not 100% sure) in your file when importing.
About the validation of the XML file against the schema, I've never done it (since I use the approach above), but I'd expect it to validate. That could perhaps be an issue with the schema returned as well.
Pedro Magueija
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You for answer. I know this method. But I need to create XML file for import in other application. In other words: need to create empty XML file, fill it with data and finally import to B1.
The problem is how to generate empty, importable XML file.
Mayby the problem is that I don't understand schema file. (sample XML object I saved from B1 is not compliant with scema file).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michal,
If you need to be able to import back the xml file, before you export the object, you need to set
oCompany.XmlExportType =BoXmlExportTypes.xet_ExportImportMode
Note, that this property is for 1 session, so you need to set once only for the current oCompany object.
I noticed that encoding, not sure why, but you can import it without changing the UTF declared.
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.