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

one editable cell in alv grid using function module

Former Member
0 Likes
1,441

Hello all,

Any one have an idea how to make a single editable cell in alv grid using function module, i mean to say

with out using object oriented programming.

Regards,

Prakash

7 REPLIES 7
Read only

Former Member
0 Likes
1,104

This message was moderated.

Read only

nagarajan_ramudu
Active Participant
0 Likes
1,104

Hi,

I had the same requirement in one of my development and below is what I did.

CLEAR: w_fieldcat.

w_fieldcat-col_pos = w_counter.

w_fieldcat-fieldname = 'PLANNED_HOURS'.

w_fieldcat-seltext_l = text-m34.

w_fieldcat-outputlen = 5.

w_fieldcat-edit = 'X'.

w_fieldcat-emphasize = 'C300'.

APPEND w_fieldcat TO t_fieldcat.

w_counter = w_counter + 1.

EDIT = 'X' will make the field editable.

Read only

mvoros
Active Contributor
0 Likes
1,104

Hi,

if you really want to have editable only one cell (not one column) then I do not think so that it is possible. What you can try to do is that you will implement double click for the whole column. In the handling routine for double click you will display pop up window to change value of your desired cell and all other cell you will simply ignore.

Cheers

Read only

Former Member
0 Likes
1,104

hi,

to make field editable in your ALV, you need to add one more line in field cat design.

make fieldcat-edit = 'X' for that specific field.

this will make field editable when ALV will display. when you will do some change in ALV report in that editable field and click on save button it will save the change in internal table which is passed in ALV report means it will modify the internal table and when you will back from ALV report you can see the change in internal table if you will display that internal table again. if you have still dout then please let me know. thanks

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,104

Hi,

Using ALV List display it is possible.

Try this.

TYPE-POOLS:SLIS.

DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA:IT_EVENTS TYPE SLIS_T_EVENT.

data: begin of it_chg occurs 0,

index type sy-tabix,

end of it_chg.

DATA: X_EVENTS TYPE SLIS_ALV_EVENT.

DATA: BEGIN OF ITAB OCCURS 0,

NAME(10) TYPE C,

ZTERM TYPE C,

END OF ITAB.

PERFORM FILL_TABLE.

loop at itab where zterm = 'A'.

it_chg-index = sy-tabix + 3.

" addition 3 IS FOR FIELD LABELS

append it_chg.

clear it_chg.

endloop.

DATA:L_POS TYPE I VALUE 1.

CLEAR: L_POS.

L_POS = L_POS + 1.

**fieldcatalog

X_FIELDCAT-FIELDNAME = 'NAME'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = L_POS.

X_FIELDCAT-OUTPUTLEN = '10'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

L_POS = L_POS + 1.

X_FIELDCAT-FIELDNAME = 'ZTERM'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = L_POS.

X_FIELDCAT-OUTPUTLEN = '10'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

**events

REFRESH:IT_EVENTS.

CLEAR:X_EVENTS,IT_EVENTS.

X_EVENTS-NAME = SLIS_EV_END_OF_LIST.

X_EVENTS-FORM = 'MODIFY_LIST'.

APPEND X_EVENTS TO IT_EVENTS.

CLEAR X_EVENTS.

END-OF-SELECTION.

data lv_repid type sy-repid.

lv_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = lv_REPID

IT_FIELDCAT = IT_FIELDCAT

IT_EVENTS = IT_EVENTS

TABLES

T_OUTTAB = ITAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

&----


*& Form FILL_TABLE

&----


  • text

----


FORM FILL_TABLE.

ITAB-NAME = 'AAA'.

ITAB-ZTERM = 'A'.

APPEND ITAB.

clear itab.

ITAB-NAME = 'ABC'.

ITAB-ZTERM = 'B'.

APPEND ITAB.

clear itab.

ITAB-NAME = 'TEST'.

ITAB-ZTERM = 'C'.

APPEND ITAB.

clear itab.

ITAB-NAME = 'BBB'.

ITAB-ZTERM = 'D'.

APPEND ITAB.

clear itab.

ITAB-NAME = '123'.

ITAB-ZTERM = 'E'.

APPEND ITAB.

clear itab.

ITAB-NAME = 'GEN'.

ITAB-ZTERM = 'A'.

APPEND ITAB.

clear itab.

ITAB-NAME = 'ALV'.

ITAB-ZTERM = 'F'.

APPEND ITAB.

clear itab.

ITAB-NAME = 'ALVTEST'.

ITAB-ZTERM = 'A'.

APPEND ITAB.

clear itab.

ENDFORM. "FILL_TABLE

&----


*& Form MODIFY_LIST

&----


  • text

----


FORM MODIFY_LIST.

data: l_lines type i.

describe table itab lines l_lines.

L_LINES = L_LINES + 3.

  • "because we have 3 lines extra occupied by lables.

  • "if we have header,i mean top of page add the no.of lines

  • "how many ever top of page have + 3 for labels.

DO L_LINES TIMES.

read table it_chg with key INDEX = sy-index.

if sy-subrc = 0.

**This code is for reading the out put line

**and modify accordinlg to our requiremnet.

**don't chnage this.

READ LINE SY-INDEX INDEX SY-LSIND.

IF SY-SUBRC = 0.

MODIFY LINE SY-INDEX INDEX SY-LSIND

FIELD FORMAT ITAB-NAME INPUT.

ENDIF.

ENDIF.

ENDDO.

ENDFORM. "MODIFY_LIST

Read only

0 Likes
1,104

Thank you Jayanthi.

Is it not possible for Grid display.

Regards,

Prakash

Read only

0 Likes
1,104

hey jayanthi

i am using almost the same code as you but the diffrence is i am using REUSE_ALV_FIELDCATALOG_MERGE to generate field catlog.

will it efffect ???

cause i am not able to make some cells editable