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

ITAB-Container /USI/CL_BAL_DC_ITAB: Includes and structured fields are not recognized #22

Open
Codenarski opened this issue May 8, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Codenarski
Copy link
Member

DATA(logger) = /usi/cl_bal_factory=>get_instance( )->create_new_logger( i_log_object = 'MY_LOG_OBJECT'
                                                                        i_sub_object = 'MY_SUB_OBJECT' ).
DATA(token)  = logger->claim_ownership( ).

TYPES: BEGIN OF ty_log_line,
         pernr TYPE pernr_d,
         p0000 TYPE p0000,
       END OF ty_log_line,
       ty_log_tab TYPE STANDARD TABLE OF ty_log_line with EMPTY KEY.

SELECT *
  FROM pa0000
  UP TO 1 ROWS
  INTO TABLE @DATA(db_records).

DATA(log_table) = VALUE ty_log_tab( FOR record IN db_records ( pernr = record-pernr
                                                               p0000 = CORRESPONDING #( record ) ) ).

logger->add_message( i_problem_class      = /usi/cl_bal_enum_problem_class=>very_important
                     i_message_type       = /usi/cl_bal_enum_message_type=>error
                     i_message_class      = '5B'
                     i_message_number     = '015'
                     i_details            = NEW /usi/cl_bal_dc_itab(
                                                  i_internal_table = log_table
                                                  i_title          = /usi/cl_bal_tc_report_text_c40=>create(
                                                                         i_text_key = 'L01'
                                                                         i_text     = text-l01 ) ) ).

logger->save( token ).
logger->free( token ).

This leads to p0000 being ignored not being included in the log.

image

image

@Codenarski Codenarski added the bug Something isn't working label May 8, 2024
@NeumannJoerg NeumannJoerg self-assigned this May 8, 2024
@NeumannJoerg
Copy link
Member

Thanks for reporting this!

I was able to reproduce the error.

The data is serialized and persisted correctly. The problem is caused by method LCL_TABLE_DESCRIPTOR->GET_FIELDCATALOG (local class inside /USI/CL_BAL_DC_ITAB), that does not handle fields having a structured type correctly. Instead of resolving the structured field P0000 into its respective fields it just adds the "field" P0000 to the field catalog, that cannot be displayed by the ALV since it is a structure.

Guess I'll have to adjust the persistency so that included structures are resolved into fields (P0000-PERNR becomes FIELD_01 or some other generated name).

Otherwise we might run into issues with the ALV, since it only supports fieldnames having up to 30 characters. So if you would rename P0000 to something having more than 24 characters, its field PERNR could no longer be displayed by the ALV, since the new name was too long for the fieldcatalog.

I'll fix that as soon as I find the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants