Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix components order issue #7

Merged
merged 1 commit into from
Oct 14, 2019
Merged

fix components order issue #7

merged 1 commit into from
Oct 14, 2019

Conversation

hhelibeb
Copy link
Contributor

@hhelibeb hhelibeb commented Oct 12, 2019

There is a side effect of the conversion: The order of keys is always sorted after converting,
image

Reason: /UI2/CL_JSON->GENERATE_INT use a SORTED table LT_FILEDS to process data.

In order to keep ABAP components order same as the original order of JSON data, the data type of LT_FILEDS should be HASHED table.

ZUI2_JSON is a class copied from /UI2/CL_JSON. And the LT_FILEDS in ZUI2_JSON is hashed table, so it can keep original order when converting. All occurrences of /UI2/CL_JSON in report ZJSON2ABAPTYPE is replaced by ZUI2_JSON now,
image

It is important to ensure that ZUI2_JSON has the same behavior in other respects. The local test classes copied form /UI2/CL_JSON guarantee that ZUI2_JSON works as good as /UI2/CL_JSON,
image

ZUI2_DATA_ACCESS is another class introduced in this commit, it is necessary for unit tests.

There is a side effect of the conversion: The order of keys was always sorted after converting.
Reason: /UI2/CL_JSON->GENERATE_INT use a sorted table LT_FILEDS to process data.

In order to keep ABAP components order same as the original order of JSON data, the data type of LT_FILEDS should be hashed table.

ZUI2_JSON is a class copied from /UI2/CL_JSON. And the LT_FILEDS in ZUI2_JSON is hashed table, so it can keep original order when converting.

ZUI2_DATA_ACCESS is necessary for unit tests.
@fidley
Copy link
Owner

fidley commented Oct 12, 2019

Thanks @hhelibeb . I will firslty check it with my own examples to see if this does not crash the program. Will try to do this still today or through the weekend.

Thank you very much for contribution, do you have any twitter handle?

@hhelibeb
Copy link
Contributor Author

@fidley No, I would like to use twitter to get information. But seems twitter blocks China mainland phone number since several years. So I can't use it anymore 😆
As a young developer, I benifit from open source a lot. I'm glad to work on open source projects and hope to be a good developer, just like you, like larshp..

@fidley fidley merged commit e73d26f into fidley:master Oct 14, 2019
@fidley
Copy link
Owner

fidley commented Oct 14, 2019

Thanks once again for this. It's a pity that you cannot use twitter. Is community.sap.com allowed in China? Do you have user there? I'd like to shout out about your contribution :)

@hhelibeb
Copy link
Contributor Author

@fidley Thanks, that is very good. My sap account is: https://people.sap.com/marspark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants