Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Editable alv_grid

Former Member
0 Likes
896

Hi Abap Programers!

I want to create a editable alv_grid as in the sapmle BCALV_EDIT_04.

To the internal_tabele is added a deep structure, where are stored the RW or RO properties.

At the PAI Module all is well, the deep structure is accesable, visible.



    LOOP AT lt_ordbu INTO la_ordbu.
      MOVE-CORRESPONDING la_ordbu TO la_outtab_line.
      APPEND la_outtab_line TO p_gt_ordbu.
    ENDLOOP.
    REFRESH la_outtab_line-celltab.
    LOOP AT p_gt_ordbu INTO la_outtab_line.
      l_index = sy-tabix.
      REFRESH lt_celltab.


      PERFORM fill_celltab USING 'RO'
                        CHANGING lt_celltab.
** Copy your celltab to the celltab of the current row of gt_outtab.
      INSERT LINES OF lt_celltab FROM l_index TO l_index
      INTO TABLE la_outtab_line-celltab.
      MODIFY p_gt_ordbu FROM la_outtab_line INDEX l_index.
    ENDLOOP.


Then I collected the inserted rows in lt_ins_keys internal tabelle, after a enterter event.


LOOP AT lt_ins_keys INTO l_ins_key.
    MOVE-CORRESPONDING l_ins_key TO la_outtab_line.
    APPEND la_outtab_line TO gt_ordbu.
  ENDLOOP.


  LOOP AT lt_ins_keys INTO l_ins_key.
    l_index = sy-tabix + records.
    REFRESH lt_celltab.
    PERFORM fill_celltab USING 'RO'
                      CHANGING lt_celltab.
    READ TABLE gt_ordbu INTO la_outtab_line INDEX l_index.
    INSERT LINES OF lt_celltab
    INTO TABLE la_outtab_line-celltab.
    MODIFY gt_ordbu FROM la_outtab_line INDEX l_index.
  ENDLOOP.

At debug, I have yet seen the constance of deep structure (celltab), but after it is empty.

It is very important.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
860

U can set specific fields editable in the fieldcatalog.

Like,

w_fieldcat-reptext = text-001.

w_fieldcat-fieldname = 'NAME'.

w_fieldcat-tabname = 'I_OUTPUT1'.

w_fieldcat-edit = 'X'.

APPEND w_fieldcat TO i_fieldcat.

Later on the edited field can be handled using the event data_changed.

Hi Abap Programers!

I want to create a editable alv_grid as in the sapmle BCALV_EDIT_04.

To the internal_tabele is added a deep structure, where are stored the RW or RO properties.

At the PAI Module all is well, the deep structure is accesable, visible.



    LOOP AT lt_ordbu INTO la_ordbu.
      MOVE-CORRESPONDING la_ordbu TO la_outtab_line.
      APPEND la_outtab_line TO p_gt_ordbu.
    ENDLOOP.
    REFRESH la_outtab_line-celltab.
    LOOP AT p_gt_ordbu INTO la_outtab_line.
      l_index = sy-tabix.
      REFRESH lt_celltab.


      PERFORM fill_celltab USING 'RO'
                        CHANGING lt_celltab.
** Copy your celltab to the celltab of the current row of gt_outtab.
      INSERT LINES OF lt_celltab FROM l_index TO l_index
      INTO TABLE la_outtab_line-celltab.
      MODIFY p_gt_ordbu FROM la_outtab_line INDEX l_index.
    ENDLOOP.


Then I collected the inserted rows in lt_ins_keys internal tabelle, after a enterter event.


LOOP AT lt_ins_keys INTO l_ins_key.
    MOVE-CORRESPONDING l_ins_key TO la_outtab_line.
    APPEND la_outtab_line TO gt_ordbu.
  ENDLOOP.


  LOOP AT lt_ins_keys INTO l_ins_key.
    l_index = sy-tabix + records.
    REFRESH lt_celltab.
    PERFORM fill_celltab USING 'RO'
                      CHANGING lt_celltab.
    READ TABLE gt_ordbu INTO la_outtab_line INDEX l_index.
    INSERT LINES OF lt_celltab
    INTO TABLE la_outtab_line-celltab.
    MODIFY gt_ordbu FROM la_outtab_line INDEX l_index.
  ENDLOOP.

At debug, I have yet seen the constance of deep structure (celltab), but after it is empty.

It is very important.

8 REPLIES 8
Read only

Former Member
0 Likes
860

Hi, Gabor,

check the layout structure.

The field stylefname, must contain your deep structure field.

Ex: s_layout-stylefname = 'CELLTAB'.

Regards

Read only

Former Member
0 Likes
860

Thx

Well, I set it before.

regards

Read only

Former Member
0 Likes
860

Hi,

In the Grid Function Module u have paramter called 'GRID_SETTINGS'. try to under the understand the structure of that paramter thru SE37. A structure is used declare that structure, in that structure u have to set a field 'X'. This enables the editing of the fields in the output.

Regards,

Aravind.

Read only

0 Likes
860

If I understand it good , it refer to fields just. First of all need this settings to final success, but not enought.

Read only

Former Member
0 Likes
860

You can make all the fields as editable by the following

DATA GS_LAYOUT TYPE LVC_S_LAYO.

DATA: gt_fieldcat TYPE lvc_t_fcat.

GS_LAYOUT-EDIT = 'X'.

After this pass this to the

CALL METHOD cc_column->set_table_for_first_display

EXPORTING

is_layout = gs_layout

CHANGING

it_outtab = it_alv

it_fieldcatalog = gt_fieldcat[]

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

ENDIF.

If you want to make editable by field level

make this before calling method the above

gt_fieldcat-edit = 'X'.

APPEND gt_fieldcat .

Read only

0 Likes
860

Ok.

But i want to make editable just the selected rows. not the fields

Read only

Former Member
0 Likes
861

U can set specific fields editable in the fieldcatalog.

Like,

w_fieldcat-reptext = text-001.

w_fieldcat-fieldname = 'NAME'.

w_fieldcat-tabname = 'I_OUTPUT1'.

w_fieldcat-edit = 'X'.

APPEND w_fieldcat TO i_fieldcat.

Later on the edited field can be handled using the event data_changed.

Read only

0 Likes
860

Anybody else?