on 2021 Dec 16 8:46 AM
I have the following code:
CLEAR: go_t1.
SELECT *
FROM mara
INTO TABLE @DATA(gt_mara)
UP TO 10 ROWS.
CREATE OBJECT go_t1
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT go_splitter
EXPORTING
parent = go_t1
rows = 2
columns = 1.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = o_grid.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = o_grid1.
TRY.
cl_salv_table=>factory(
EXPORTING
r_container = o_grid
IMPORTING
r_salv_table = alv
CHANGING
t_table = gt_mara ).
CATCH cx_salv_msg
cx_salv_not_found
cx_salv_data_error
cx_salv_existing
cx_salv_wrong_call INTO DATA(lo_x).
MESSAGE lo_x TYPE 'E'.
ENDTRY.
alv->display( ).
and I am getting the the following error : Field symbol has not been assigned yet.
and I have no idea why this is happening...
Request clarification before answering.
Be careful to NOT declare the ALV internal table as local, otherwise you will have a short dump (it may not be immediate, it depends on the global quantity of data (total number of bytes/characters of all cells displayed / versus given amount of bytes/characters buffered on frontend); if not immediate, it may happen after a number of ALV page scrolling, when the frontend needs to acquire more data of the internal table from the backend).
I don't reproduce the bug with this minimal reproducible program:
REPORT.
DATA: go_splitter TYPE REF TO cl_gui_splitter_container,
o_grid TYPE REF TO cl_gui_container,
alv TYPE REF TO cl_salv_table,
gt_mara TYPE TABLE OF mara.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
CHECK go_splitter IS NOT BOUND.
SELECT *
FROM mara
INTO TABLE gt_mara
UP TO 10 ROWS.
CREATE OBJECT go_splitter
EXPORTING
parent = cl_gui_container=>screen0
rows = 2
columns = 1.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = o_grid.
TRY.
cl_salv_table=>factory(
EXPORTING
r_container = o_grid
IMPORTING
r_salv_table = alv
CHANGING
t_table = gt_mara ).
CATCH cx_salv_msg
cx_salv_not_found
cx_salv_data_error
cx_salv_existing
cx_salv_wrong_call INTO DATA(lo_x).
MESSAGE lo_x TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
alv->display( ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the program trying to display 2 ALV in one screen? If so, custom dynpro needs to be defined and container needs to be embedded there.
(1) Define a custom dynpro 9xxx and click on custom control button. Then enter each containers name there. Sample screen in screenshot.
(2) Call screen 9xxx in the program.
(3) In PBO module, create field catalog, get data from MARA, instatiate container and grid object. Then call method SET_TABLE_FOR_FIRST_DISPLAY for each container.
I made a demo so please take a look at below code and screenshots.
Please mark this as answer if it solved your requirement.
REPORT YDEMO.
DATA:GO_T TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
GO_T1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID TYPE REF TO CL_GUI_ALV_GRID,
O_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
X_LAYOUT TYPE LVC_S_LAYO.
X_LAYOUT-SEL_MODE = 'A'.
CALL SCREEN 9000.
BREAK-POINT.
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
DATA: LS_FIELDCAT TYPE LVC_S_FCAT,
LT_FIELDCAT TYPE LVC_T_FCAT.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-SCRTEXT_S = 'Material'. "#EC NOTEXT
LS_FIELDCAT-SCRTEXT_M = 'Material'. "#EC NOTEXT
LS_FIELDCAT-SCRTEXT_L = 'Material'. "#EC NOTEXT
LS_FIELDCAT-COL_POS = 1.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'ERNAM'.
LS_FIELDCAT-SCRTEXT_S = 'User name'. "#EC NOTEXT
LS_FIELDCAT-SCRTEXT_M = 'User name'. "#EC NOTEXT
LS_FIELDCAT-SCRTEXT_L = 'User name'. "#EC NOTEXT
LS_FIELDCAT-COL_POS = 2.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
CLEAR: GO_T, GO_T1.
SELECT MATNR, ERNAM
FROM MARA
INTO TABLE @DATA(GT_MARA)
UP TO 10 ROWS.
GO_T = NEW #( CONTAINER_NAME = 'CONTAINER' ).
O_GRID = NEW #( I_PARENT = GO_T ).
GO_T1 = NEW #( CONTAINER_NAME = 'CONTAINER1' ).
O_GRID1 = NEW #( I_PARENT = GO_T1 ).
CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_SAVE = 'A'
IS_LAYOUT = X_LAYOUT
CHANGING
IT_OUTTAB = GT_MARA
IT_FIELDCATALOG = LT_FIELDCAT.
CALL METHOD O_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_SAVE = 'A'
IS_LAYOUT = X_LAYOUT
CHANGING
IT_OUTTAB = GT_MARA
IT_FIELDCATALOG = LT_FIELDCAT.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.
DATA: LT_ROWS TYPE LVC_T_ROW,
LT_ROID TYPE LVC_T_ROID.
O_GRID->CHECK_CHANGED_DATA( ).
CALL METHOD O_GRID->GET_SELECTED_ROWS
IMPORTING
ET_INDEX_ROWS = LT_ROWS
ET_ROW_NO = LT_ROID.
ENDMODULE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.