spreadsheetimporter / ui5-cc-spreadsheetimporter

A UI5 Component to integrate a Spreadsheet Upload for UI5 Apps.
https://spreadsheet-importer.com/
Apache License 2.0
82 stars 16 forks source link

[Bug]: Handling of Edm.Byte #505

Closed MARCxGAMBIT closed 6 months ago

MARCxGAMBIT commented 7 months ago

OData Version

OData V2

Draft

not relevant

Scenario

FE

Environment

VSCode

UI5 Spreadsheet Component

0.33.0

What happened?

Hey there,

in my backend I have a Data Element of native type INT1 (1 Byte integer, 0 to 255). The metadata of the OData service display this as Edm.Byte.

The parser currently has no handling for Edm.Byte and will parse the number from my excel as a string. Upload then fails.

I am not sure for what else Edm.Byte is used but would it be an easy fix to add it together with the handling of other integers here? https://github.com/spreadsheetimporter/ui5-cc-spreadsheetimporter/blob/main/packages/ui5-cc-spreadsheetimporter/src/controller/Parser.ts#L82

BR Marc

Relevant log output

Nothing relevant in the frontend but my backend tells me

[{"code":"CX_SXML_PARSE_ERROR/001560AA0E081DEB8CA398CC1690D406","message":"Failed to read property 'FromPeriod' at offset '77'","persistent":true,"targets":[""],"type":"Error"}]

Spreadsheet Component Init

usage: "spreadsheetImporter",
async: true,
componentData: {
  fieldMatchType: "label",
  context: this,
  debug: true
},

Manifest

No response

marianfoo commented 7 months ago

thanks for reporting, somehow slipped through fixed with version 0.33.1 just published

MARCxGAMBIT commented 7 months ago

Hey, thx for the quick fix. But I think this may only be half the battle.

Due to some conditions Edm.Byte is still a string in my case. In V2 the official OData docs state that Edm.Byte (and SByte and Int64) are formatted as JSON strings. But SAP seems to differ: https://sapui5.hana.ondemand.com/#/api/sap.ui.model.odata.type.Byte and https://sapui5.hana.ondemand.com/#/api/sap.ui.model.odata.type.SByte are represented as a number in UI5 and the ABAP backend expects this. (Int64 seems to be represented as a string both in your implementation, the OData docs as well as the UI5 framework, so nothing to worry here).

marianfoo commented 7 months ago

Ok, let me check again