Hi Experts,
ISSUE PART 1
i have created two structures ZTEST_SRC and ZTEST_TRT. The structure ZTEST_TRT contains the same fields as in structure ZTEST_SRC but i have removed the include COMT_TEXT_TEXTDATA in this structure.
![ZTEST_SRC_70.PNG]()
![ztest_trt_70.PNG]()
Technically, as the two structure contains the same fields and length, the memory occupied during run time should be same.
But contrary to the expectations, its not .
I have written a short program to analyze it. Please find the screen shot below.
***************************************************************************************
REPORT ZTEST_COMPARE_LENGTH.
DATA: SRC TYPE ZTEST_SRC,
TRT TYPE ZTEST_TRT,
LO TYPE REF TO CL_ABAP_TYPEDESCR,
LSRC TYPE REF TO CL_ABAP_TYPEDESCR,
LTRT TYPE REF TO CL_ABAP_TYPEDESCR.
DATA: REF_KIND TYPE CHAR10,
STXH TYPE STXH,
LINES TYPE COMT_TEXT_LINES_T,
FUNCTION TYPE TDFUNCTION.
CALL METHOD CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA
EXPORTING
P_DATA = SRC
RECEIVING
P_DESCR_REF = LSRC.
CALL METHOD CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA
EXPORTING
P_DATA = TRT
RECEIVING
P_DESCR_REF = LTRT.
BREAK-POINT.
***************************************************************************************************************************
During debugging, the following is the screenshot of the memory analysis.
![70_mem_analy.PNG]()
The bytes occupied by SRC is 912 and TRT is 904.
ISSUE PART 2:
Now i have changed the filed length of the field 'REF_KIND' in both the structures to CHAR80.
![ztest_trt_80.PNG]()
Now i have execute the program and here is the memory analysis.
![80.PNG]()
Surprised to see that the Bytes occupied are 928 and its same.
Why is memory occupied not the same in ISSUE PART 1 when char70 is used for field REF_KIND as in ISSUE PART 2 ?
Hope I have provided sufficient data for analysis and I need your help in getting to know about it.
Thanks in advance.
Cheers,
Ravi.