‎2007 Feb 06 10:30 AM
Hi experts,
I want to display some data in a ALV-Grid control, with just one column which is editable. So the ALV-Grid looks well, when I only display the data. But when I add the attributes for the editable column into my internal table, then I cannot see any data in there. But I can see the rows with the editable column.
Here are the operations:
1) All items of an transparent table is viewed in the ALV-LIST1
2) User can select the specific rows which he/she want to edit.
3) User press a button in the toolbar of ALV-LIST1
4) The ALV-LIST2 comes up with the selected rows and one editabled column, but no data in there...
I already looked in this great example, but I cannot see any special command, posted here:
I also looked in the examples of BCALV_EDIT_0*.
Here is the code:
Definitions:
The method for creating the second ALV-Grid
METHOD create_alv_list2.
DATA: ls_selected_line TYPE lvc_s_row,
lf_row_index TYPE lvc_index,
lt_celltab TYPE lvc_t_styl,
ls_celltab TYPE lvc_s_styl,
l_index TYPE i,
lt_exclude TYPE ui_functions
.
IF container23 is initial.
CREATE OBJECT container23
EXPORTING container_name = 'LIST_AREA2'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Control element couldn't be created'(510).
ENDIF.
CREATE OBJECT alv_list2
EXPORTING i_parent = container23.
ELSE.
CALL METHOD alv_list2->refresh_table_display.
ENDIF. "IF container23 IS INITIAL.
* Layout
g_lvc_layout-grid_title = 'Edit the rows'.
g_lvc_layout-sel_mode = ' '.
g_lvc_layout-stylefname = 'CELLTAB'.
CLEAR: lt_celltab,
wa_lab_dispo2,
it_lab_dispo2,
wa_lab_dispo3,
it_lab_dispo3
.
* catch all selected rows from ALV-Grid1
CALL METHOD alv_list1->get_selected_rows
IMPORTING et_index_rows = it_lvc_rows.
* write the lines into the it_lab_dispo3
LOOP AT it_lvc_rows INTO ls_selected_line.
lf_row_index = ls_selected_line-index.
READ TABLE it_lab_dispo INDEX lf_row_index INTO wa_lab_dispo.
wa_lab_dispo3-lab_dispo_struk = wa_lab_dispo.
APPEND wa_lab_dispo3 TO it_lab_dispo3.
ENDLOOP.
CLEAR: wa_lab_dispo3.
* make the cell XBEME editable
LOOP AT it_lab_dispo3 INTO wa_lab_dispo3.
l_index = sy-tabix.
ls_celltab-FIELDNAME = 'XBEME'.
ls_celltab-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
ls_celltab-STYLE2 = SPACE.
ls_celltab-STYLE3 = SPACE.
ls_celltab-STYLE4 = SPACE.
INSERT ls_celltab INTO TABLE lt_celltab.
INSERT LINES OF lt_celltab INTO TABLE wa_lab_dispo3-celltab.
MODIFY it_lab_dispo3 FROM wa_lab_dispo3 INDEX l_index TRANSPORTING celltab.
ENDLOOP.
CALL METHOD alv_list2->set_ready_for_input
EXPORTING i_ready_for_input = 1.
PERFORM exclude_tb_functions CHANGING lt_exclude.
* display the second grid
CALL METHOD alv_list2->set_table_for_first_display
EXPORTING i_structure_name = 'zmm_lab_dispo'
i_save = 'A'
it_toolbar_excluding = lt_exclude
is_layout = g_lvc_layout
CHANGING
it_outtab = it_lab_dispo3[]
.
CALL METHOD cl_gui_control=>set_focus
EXPORTING control = alv_list2.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc <> 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush ALV'(500).
ENDIF.
ENDMETHOD.
<b>If I follow my coding by processing the application, I could see that in the Method "SET_VALUES (CL_ALV_VARIANT)" which was executed by "CALL METHOD alv_list2->set_table_for_first_display" the table "it_outtab" is just filled with the data of my selected rows!
And after this Method their called "FUNCTION K_KKB_PUT_GLOBALS" which has only one command: </b>
create data gs_table_row like es_table_row.
<b>And the gs_table_row has the needed deep-structure.
After it i cannot see any really intressting backend-functions related to my Problem.
</b>
I also try to do something with the fieldcatalog but in this case I only could add columns to the existing table which was editable.
Regards,
Steffen
‎2007 Feb 06 10:38 AM
Hi Steffen,
Just give the name in capital letters and try:
display the second grid
CALL METHOD alv_list2->set_table_for_first_display
EXPORTING i_structure_name = <b>'ZMM_LAB_DISPO'</b>
i_save = 'A'
it_toolbar_excluding = lt_exclude
is_layout = g_lvc_layout
CHANGING
it_outtab = it_lab_dispo3[]
REgards,
Ravi
‎2007 Feb 06 10:45 AM
‎2007 Feb 08 9:27 AM
ok I have found this number in the oss: 695910
and it means that SAP do not support such methods like: IS_READY_FOR_INPUT
and attribute MC_STYLE_ENABLED.
regards,
Steffen