Application Development 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: 

Editable Grid control

Former Member
0 Kudos

Hi Experts,

I am using REUSE_ALV_GRID_DISPLAY for displaying output.

I want to change values of certain fields.

I have made EDIT = 'X' in field catlog.

But I am not able to get changed values into my internal table when i use usercommand event.

Can any one help me on this?

Thanks in advance...

Pratik Vora

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Pratik,

Would you please paste your code here. So that we can analyse what the problem is..

You can refer the following link:

Regards,

Nitin.

7 REPLIES 7

Former Member
0 Kudos

Hi Pratik,

Would you please paste your code here. So that we can analyse what the problem is..

You can refer the following link:

Regards,

Nitin.

0 Kudos

Hi Nitin,

would you please elaborate what is status of int table XX_final and ZZ_final,

before loop, in the link which you have provided.

And for others,

I am not able to get changed data from grid to my internal table.

i.e. If i click on Check box on the grid, my int table should reflect 'X' value for check box field in my internal table after certain sy-ucomm.

and also i must not work with object oriented concepts.

Thanks,

Pratik

Edited by: Pratik Vora on Dec 1, 2008 10:05 AM

Former Member
0 Kudos

HI

Use MODIFY STATEMENT

wa_fieldcat-edit = 'X'.

modify it_fieldcat from wa_fieldcat .

changed data will be reflected in the internal table once it save button is pressed in the displayed alv grid,

Ranga

Former Member
0 Kudos

Hello Pratik,

Please search SCN before posting. There are a lot of posts with the same query.

May be you can also get it from here (First hit from the search I made): [;

Thanks,

Jayant

Former Member
0 Kudos

Hi,

It will be not be efected, means data will not come to internal table.

You just have to make add one more field that checkbox in the fieldcatlog.

So whenver user will select any checkbox and give any usercommand .

Suppose u have given in PF-Status Application Toolbar as FetchExtraData (as 'FETC').

So .......

Case sy-ucomm

When 'FETC'

loop at internal table into workarea where select ='X'.

endloop.

endcase.

Try this out it will work .

Else u can use ...

data lo_grid type ref to cl_gui_alv_grid.

call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'

importing

e_grid = lo_grid.

call method lo_grid->check_changed_data.

This will capture when u click the 'Standard' SAVE button which will be in ur GUI satatus.

regards.

Arbind

Former Member
0 Kudos

see the following example:-

REPORT ZTEST_ALV MESSAGE-ID ZZ .

TYPE-POOLS: SLIS.

DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

L_LAYOUT TYPE SLIS_LAYOUT_ALV,

X_EVENTS TYPE SLIS_ALV_EVENT,

IT_EVENTS TYPE SLIS_T_EVENT.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN LIKE VBAK-VBELN,

POSNR LIKE VBAP-POSNR,

CHK(1),

color(4),

END OF ITAB.

SELECT VBELN

POSNR

FROM VBAP

UP TO 20 ROWS

INTO TABLE ITAB.

X_FIELDCAT-FIELDNAME = 'CHK'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 1.

X_FIELDCAT-INPUT = 'X'.

X_FIELDCAT-EDIT = 'X'.

X_FIELDCAT-CHECKBOX = 'X'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'VBELN'.

X_FIELDCAT-SELTEXT_L = 'VBELN'.

X_FIELDCAT-HOTSPOT = 'X'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 2.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'POSNR'.

X_FIELDCAT-SELTEXT_L = 'POSNR'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 3.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

L_LAYOUT-info_fieldname = 'COLOR'.

*L_LAYOUT-ZEBRA = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = L_LAYOUT

I_CALLBACK_PF_STATUS_SET = 'STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IT_FIELDCAT = IT_FIELDCAT

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 STATUS

*&----


*text

*----


*-->P_EXTAB text

*----


FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.

*Pf status

SET PF-STATUS 'STATUS'.

ENDFORM. " STATUS

*&----


*& Form USER_COMMAND

*&----


*text

*----


*-->R_UCOMM text

*-->RS_SELFIELD text

*----


FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

DATA: GD_REPID LIKE SY-REPID, "Exists

REF_GRID TYPE REF TO CL_GUI_ALV_GRID.

IF REF_GRID IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = REF_GRID.

ENDIF.

IF NOT REF_GRID IS INITIAL.

CALL METHOD REF_GRID->CHECK_CHANGED_DATA .

ENDIF.

loop at itab where chk = 'X'.

itab-color = 'C300'.

modify itab index sy-tabix transporting color.

endloop.

RS_SELFIELD-refresh = 'X'.

break-point.

ENDFORM. "USER_COMMAND

0 Kudos

Thank you krupa,

but i am not supposed to use object oriented concepts.

Is not there a way to find out without it??