Self Training on ALV Report - METHOD SET_LAYOUT - compilation error
source link: https://answers.sap.com/questions/13885604/self-training-on-alv-report-method-set-layout-comp.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Compilation Error Message: The data object "LAYOUT KEY" has no structure therefore no component called "Report"
need help is resolving this compilation error as highlighted below(bold and italics).
sap-community-question-alv-report.txt
METHOD SET_LAYOUT.
DATA: LAYOUT TYPE REF TO CL_SALV_LAYOUT,
LAYOUT_KEY TYPE REF TO SALV_S_LAYOUT_KEY.
LAYOUT = ALV_TABLE_OBJECT->GET_LAYOUT( ).
LAYOUT->SET_KEY(LAYOUT_KEY).
LAYOUT->SET_SAVE_RESTRICTION(IF_SALV_C_LAYOUT=>RESTRICT_NONE).
ENDMETHOD.
ENDCLASS.
Attn Sandra/Vicenc - have reformatted the relevant part of code as below, trust it will be more helpful. ERP 6.0 EHP7 system.
METHOD SET_LAYOUT.
DATA: LAYOUT TYPE REF TO CL_SALV_LAYOUT,
LAYOUT_KEY TYPE REF TO SALV_S_LAYOUT_KEY.
LAYOUT = ALV_TABLE_OBJECT->GET_LAYOUT ( ).
LAYOUT_KEY-REPORT = SY-REPID.
LAYOUT->SET_KEY(LAYOUT_KEY).
LAYOUT->SET_SAVE_RESTRICTION(IF_SALV_C_LAYOUT=>RESTRICT_NONE).
ENDMETHOD.
Syntax Error for Program ZRS_ALV3 (ref line highlighted above)
Error Type
Line
Description
Error
The data object “LAYOUT_KEY” has no structure and therefore no component called “REPORT”
as Vicenc there seems to be a type ref problem in the highlighted statement as "SALV_S_LAYOUT_KEY." has 3 components name as below but these are not being transferred to "LAYOUT_KEY". Will be very grateful for your help thanks:
REPORT
HANDLE
LOGICAL_GROUP
I am working on the ALV examples given in the SAP Press Book - "ABAP - An Introduction" by Brian O'Neill and Jelena Perfiljeva
apologies the formatting of the error message has become garbled above, below picture may be more helpful
Sorry but good formatting is as follows:
METHOD SET_LAYOUT. DATA: LAYOUT TYPE REF TO CL_SALV_LAYOUT, LAYOUT_KEY TYPE REF TO SALV_S_LAYOUT_KEY. LAYOUT = ALV_TABLE_OBJECT->GET_LAYOUT( ). LAYOUT->SET_KEY(LAYOUT_KEY). LAYOUT->SET_SAVE_RESTRICTION(IF_SALV_C_LAYOUT=>RESTRICT_NONE). ENDMETHOD. ENDCLASS.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK