2007 Oct 26 7:42 AM
I'm getting short-dump when creating dynamic internal table via CALL METHOD cl_alv_table_create=>create_dynamic_table. The fieldcatalog contains a component named LVC_S_STYL which populates fine when after call function LVC_FIELDCATALOG_MERGE but when this is passed to cl_alv_table_create=>create_dynamic_table it short dumps!
Is it possible to pass the style catalog in this case, how? Below is my code.
Structure of 'ZZ_ALV_FCAT' is WERKS type werks_d, DATE type datum, CELLTAB type LVC_S_STYL.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZZ_ALV_FCAT'
CHANGING
ct_fieldcat = lt_fieldcat.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcat
i_length_in_byte = ''
IMPORTING
ep_table = dy_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc EQ 0.
ASSIGN dy_table->* TO <dyn_table>.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
<b>I'll be generously giving away points for any help!</b>
Any idea anyone? I was thinking may be convert the HEX data to CHAR before creating the dynamic table then again convert the CHAR data back to HEX before I call SET_TABLE_FOR_FIRST_DISPLAY? In that case, how to convert Hex of a structure to CHAR and vice versa?
Message was edited by:
Sougata Chatterjee
2007 Oct 26 11:50 AM
2007 Oct 26 11:50 AM
2007 Oct 26 12:57 PM
Hi Uwe,
I added the following in your code after:
" Show how to fill the complex itab PERFORM fill_celltab.
PERFORM fill_celltab.
END-OF-SELECTION.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_table
CHANGING
t_table = <gt_itab>.
go_table->display( ).
CATCH cx_salv_msg .
ENDTRY.
But column BUKRS is still not editable! What do you think the problem is?
Thanks.
2007 Oct 26 1:02 PM
Hello Sougata
As far as I know class CL_SALV_TABLE is not intended for editable ALV lists.
Why?
Have you ever seen an event similar to DATA_CHANGED of CL_GUI_ALV_GRID?
Conclusion:
- Non-editable ALV lists -> use CL_GUI_ALV_GRID or CL_SALV_TABLE
- Editable ALV lists -> use CL_GUI_ALV_GRID
Regards
Uwe
2007 Oct 26 1:18 PM
Hi Uwe,
Then why do you do
ls_cell-style = cl_gui_alv_grid=>mc_style_enabled.
in your program?
I'm using CL_GUI_ALV_GRID but passing dynamic table to it when I call SET_TABLE_FOR_FIRST_DISPLAY. Your program is quite complex and will take time to implement (and I'm running out of time fast!) Any quick way to populate the values of Celltab to a dynamic table?
Thanks.
2007 Oct 26 1:25 PM
Hello Sougata
I have used class CL_SALV_TABLE just for displaying the results of the dynamic itab creation. The purpose of routine FILL_CELLTAB is just to show that we are able to create a complex itab (record contains one field (CELLTAB) which itself is a table type) and how to fill it because this has to be done dynamically, too.
If the dynamically created itab is used for an editable ALV list then you must use CL_GUI_ALV_GRID.
Regards,
Uwe
2007 Oct 26 11:52 AM
Hi
I worote this code in my system (4.6C) and I got any dump:
DATA: CT_FIELDCAT TYPE LVC_T_FCAT.
DATA: DY_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS: <TABLE> TYPE TABLE.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = 'ZLVC_S_STYL'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
CHANGING
CT_FIELDCAT = CT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = CT_FIELDCAT
* I_LENGTH_IN_BYTE = ''
IMPORTING
EP_TABLE = DY_TABLE
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
IF SY-SUBRC = 0.
ASSIGN DY_TABLE->* TO <TABLE>.
IF SY-SUBRC = 0.
ENDIF.
ENDIF.
I've included the structure LVC_S_STYL in my structure ZLVC_S_STYL and then add some fields.
But if I insert a field CELL like LVC_S_STYL, instead of to include it directly, I get the dump.
So I believe it depends on how you've defined the structure in dictionary, because in the second case it seems the METHOD can't create the subroutine to create the dynamic table.
It seems if it uses a complex structure where a field is a structure, the METHOD can't write a right defintion of an internal table based on the dictionary structure.
In my system I saw the method try to create a subroutine where the interna table is defined in this way:
DATA: STYLE TYPE ZLVC_S_STYL-STYLE.
instead of
DATA: STYLE TYPE ZLVC_S_STYL-CELL-STYLE.
Max
2007 Oct 26 12:17 PM
Hi,
Can you send me the code for defining the Structure of 'ZZ_ALV_FCAT' ?
Regards,
GURU