‎2020 Jun 10 1:22 PM
Hi,
I have created a dynamic structure using RTTS for the view 'FINSV_MASS_CTRLC', and at the same time, dynamically appended 2 single character flags to the structure to create a type handle for casting.
I have used the same code for several other views, and never faced any issue. It ran fine for this view as well for the first run (. After that I filled the View (earlier empty) with data , and now the following statement is throwing dump:
ASSIGN <fs_appl_t1> TO <fs_appl_t2> CASTING TYPE HANDLE lr_struct_type_hndl.
<fs_appl_t1> is a structure of type char200.
Following is the error:
I do not have much knowledge on memory alignment yet. I went through a few a question on the same, but it did not make a lot of sense to me. Any help is deeply appreciated.
‎2020 Jun 10 1:54 PM
Alignment of data objects is explained in the ABAP documentation.
If those characters were initialized from a structure to a character variable using CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C, you may retrieve its content using:
CL_ABAP_CONTAINER_UTILITIES=>READ_CONTAINER_C
‎2020 Jun 11 8:21 AM
Thank you Sandra for responding.
I have gone through the SAP Help of 'Alignment of data objects', it does say, that in case of casting, the alignment needs to be checked. But provided not much info on how to check and adjust the same.
If you can maybe shed some light on the same, that would be of great help.
I also tried to check a few notes, but it was not really of great help,
I am already able to retrieve the contents from standard code. I am trying to cast to a dynamic structure, which works for all other views, but this particular one (I have tried with 10-15 views complex views)
If you can provide a means to adjust the alignment, through code or without it, that would be of great help.
The structure of the dynamic type handle includes 2 nested structures, with first one filling from the aforementioned view
followed by 2 structure containing 2 flags (char01).
What do you think?
‎2020 Jun 11 9:23 AM
A nested structure doesn't imply gaps. Only a mix of character, deep and numeric types may imply gaps (with memory address alignments of 2, 4, 8 or 16 bytes).
I think that you should post a minimal reproducible example so that I can analyze and answer with code corrected and solution explained.
‎2020 Jun 11 11:54 AM
Hi Sandra,
I have attached the code:
ytest-alignment-dump-reproduce.txt
I would like to point out that the view 'FINSV_MASS_CTRLC' should have data for this dump to be properly reproduced.
Would be of great help to get your insights. 🙂
‎2020 Jun 11 1:14 PM
Hi Sandra,
I am still not sure why casting (with data present will not work, or how to make it work,
but I created new data by casting with the type handle which i earlier created within the code (no data involved), and then used CL_ABAP_CONTAINER_UTILITIES=>READ_CONTAINER_C on that, and it works fine. Even though my doubt persists, my issue is resolved. Thank you 🙂