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

Make a column editable in ALV Object Model

Former Member
0 Likes
5,216

Dear All,

I am using ALV Object Model (using class CL_SALV_TABLE) to display a ALV.

I have a requirement where a particular column should be editable. I am trying to do this using the method SET_ENABLED_COLUMN from class CL_SALV_COLUMNS_TABLE. But this is not working and moreover the documentation for that method says that the method is not released.

So how can I achieve a editable column in ALV Object model?

Regards,

Koushik Lingam

9 REPLIES 9
Read only

Former Member
0 Likes
1,622

Hi,

perform the steps as mentioned.

data: gs_fieldcat type lvc_s_fcat.

clear gs_fieldcat.

gs_fieldcat-fieldname = 'CARRID'.

gs_fieldcat-ref_table = 'SFLIGHT'.

gs_fieldcat-outputlen = '5'.

gs_fieldcat-key = 'X'.

gs_fieldcat-edit = 'X'.

gs_fieldcat-auto_value = 'X'.

append gs_fieldcat to gt_fieldcat.

The property edit marked as Bold in the field catalog will allow the column to be editable mode.

Regards,

JLN

Read only

Former Member
0 Likes
1,622

u make a coloum editable by passing x in the field cataloud for that coloum . like

int_fieldcat-edit = 'x' .

Thanks

ROhit

Read only

Former Member
0 Likes
1,622

Dear All,

Please remember that I am using ALV Object model in which we cannot modify the field catalog manually. We have to use methods to do that.

So please reply accordingly

Read only

0 Likes
1,622

We can modify the field catalog in the ALV Object Model also. Just that you have to approach it in a tweaked manner.

Determine the field catalog for any given structure or internal table using the FM "LVC_FIELDCATALOG_MERGE"

Refer the package SLIS to find out how to use this FM.

Then modify the fields in the Field Catalog as you require and then pass it to SET_TABLE_FOR_FIRST_DISPLAY method.

In your case, you will have to pass 'X' to edit field in the necessary records of the field catalog.

have a look at this link.

[http://www.abap4.it/download/ALV.pdf]

Reward if helpful.

Read only

Madhu2004
Active Contributor
0 Likes
1,622

Hai,

Try with the following Code:

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

i_structure_name = 'sflight'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

ct_fieldcat = itab_lvc

  • 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.

WRITE 😕 'before'.

WRITE 😕 '----


'.

LOOP AT itab_lvc INTO wa_lvc.

WRITE 😕 wa_lvc-row_pos,wa_lvc-col_pos,wa_lvc-fieldname,wa_lvc-edit_mask.

ENDLOOP.

LOOP AT itab_lvc INTO wa_lvc WHERE fieldname = 'CARRID'.

wa_lvc-edit_mask = 'X'.

MODIFY itab_lvc FROM wa_lvc.

ENDLOOP.

WRITE 😕 'after'.

WRITE 😕 '----


'.

LOOP AT itab_lvc INTO wa_lvc.

WRITE 😕 wa_lvc-row_pos,wa_lvc-col_pos,wa_lvc-fieldname,wa_lvc-edit_mask.

ENDLOOP.

Thanks,

Madhu

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,622

Hi Koushik. This is one of the limitations when using the ALV Object Model, class CL_SALV_TABLE. There is no functinoality supporting the editable ALV, column, row, or cell. You must use the class CL_GUI_ALV_GRID instead for editable ALVs.

Regards,

Rich Heilman

Read only

0 Likes
1,622

I'm trying to use CL_GUI_ALV_GRID and it gives me some inconsistencies in java gui. So I have searched oss for notes and I have found

Note 695910 - ALV grid: Editable grid and non-released methods

that says:

"all methods that are related to editability of the ALV grid are not released for customer software developments"

Does that means that we can "play" with editable CL_GUI_ALV_GRID but we have no support for it?

Does anyone knows if that note still apply?

Many thanks,

Lorenzo

Read only

0 Likes
1,622

Hi Lorenzo,

did you ever find an answer to your question?

I found the same note when researching an issue with my editable ALV which started after we applied new service pack.

Regards,

Mahesh

Read only

Former Member
0 Likes
1,622

Hi,

Check the following link:

http://sapdev.co.uk/reporting/alv/alvgrid_editable.htm

Regards,

Bhaskar