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

No underscore before digits in AFF field names #385

Open
huber-nicolas opened this issue Aug 1, 2022 · 2 comments
Open

No underscore before digits in AFF field names #385

huber-nicolas opened this issue Aug 1, 2022 · 2 comments

Comments

@huber-nicolas
Copy link
Contributor

I run into problems when trying to map a json field name back to the corresponding abap field name. This happens when the abap field name has underscores in front of a digit. For example: element_1. In json this will become "element1" and when mapping "element1" back to abap there are 2 possibilities. It could have been "element1" or "element_1" in abap.
So should we forbid underscores in front of digits, so that we can reconstruct the abap field name?

@huber-nicolas huber-nicolas changed the title No digits in AFF field names No underscore before digits in AFF field names Aug 1, 2022
@larshp
Copy link
Collaborator

larshp commented Aug 1, 2022

@huber-nicolas
Copy link
Contributor Author

huber-nicolas commented Aug 1, 2022

I tested it with this coding:

data abap_name type string.
    data json_name type string.
    data reconstructed_abap_name type string.

    abap_name = 'element1'.
    json_name = to_mixed( abap_name ).
    reconstructed_abap_name =  from_mixed( json_name ).
    out->write( |abap_name = { abap_name } => to_mixed( ) = json_name: { json_name } => from_mixed( ) reconstructed abap_name from jsonname: { reconstructed_abap_name }| ).

    abap_name = 'element_1'.
    json_name = to_mixed( abap_name ).
    reconstructed_abap_name =  from_mixed( json_name ).
   out->write( |abap_name = { abap_name } => to_mixed( ) = json_name: { json_name } => from_mixed( ) reconstructed abap_name from jsonname: { reconstructed_abap_name }| ).

    abap_name = 'element_1_'.
    json_name = to_mixed( abap_name ).
   json_name = to_mixed( abap_name ).
    reconstructed_abap_name =  from_mixed( json_name ).
    out->write( |abap_name = { abap_name } => to_mixed( ) = json_name: { json_name } => from_mixed( ) reconstructed abap_name from jsonname: { reconstructed_abap_name }| ).

    abap_name = 'element_1_a'.
    json_name = to_mixed( abap_name ).
    json_name = to_mixed( abap_name ).
    reconstructed_abap_name =  from_mixed( json_name ).
    out->write( |abap_name = { abap_name } => to_mixed( ) = json_name: { json_name } => from_mixed( ) reconstructed abap_name from jsonname: { reconstructed_abap_name }| ).

The output is this:
abap_name = element1 => to_mixed( ) = json_name: element1 => from_mixed( ) reconstructed abap_name from jsonname: ELEMENT1
abap_name = element_1 => to_mixed( ) = json_name: element1 => from_mixed( ) reconstructed abap_name from jsonname: ELEMENT1
abap_name = element_1_ => to_mixed( ) = json_name: element1_ => from_mixed( ) reconstructed abap_name from jsonname: ELEMENT1_
abap_name = element_1_a => to_mixed( ) = json_name: element1A => from_mixed( ) reconstructed abap_name from jsonname: ELEMENT1_A

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

No branches or pull requests

2 participants