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

Error message pops up again after correction (ALV DATA_CHANGED)

Former Member
0 Likes
835

Hi experts:

I am doing a list using ALV control (OO), I put my validation logic in data changed handler. The validation is simple, to check whether a field is blank or not, if it is blank, pup up error messages and let the user to correct his/her input. But the strange thing is that after the error message firstly pops up, I input something in the field and press enter. No error message should be popped up. But the same error message pops up again. I debug the program found that after the first error, even I input something in the field, but the program does not get the value I input, so the same checking failed, and the error message pops up.

METHOD HANDLE_DATA_CHANGED. "#EC NEEDED

DATA: LW_INS TYPE LVC_S_MOCE,

LV_FNAME TYPE LVC_FNAME,

LT_MOD TYPE LVC_T_MODI,

LW_MOD TYPE LVC_S_MODI,

LV_TEXT(10) TYPE C,

LV_MAX TYPE I,

LV_ROWID TYPE I,

LV_RES(12) TYPE C,

LW_LIST TYPE ZTSRE007.

LOOP AT GT_LIST INTO LW_LIST.

IF LW_LIST-ID > LV_MAX.

LV_MAX = LW_LIST-ID.

ENDIF.

ENDLOOP.

LT_MOD[] = ER_DATA_CHANGED->MT_MOD_CELLS[].

LOOP AT LT_MOD INTO LW_MOD.

IF LW_MOD-FIELDNAME = CNS_ZZTTSN.

LV_FNAME = CNS_ZZTTSN.

CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE

EXPORTING

I_ROW_ID = LW_MOD-ROW_ID

I_FIELDNAME = LV_FNAME

IMPORTING

E_VALUE = LV_RES

.

IF LV_RES IS INITIAL.

LV_ROWID = LW_MOD-ROW_ID.

CALL METHOD ER_DATA_CHANGED->ADD_PROTOCOL_ENTRY

EXPORTING

I_MSGID = CNS_MSGID

I_MSGTY = CNS_MSGTY

I_MSGNO = CNS_MSGNO

I_FIELDNAME = LV_FNAME

I_ROW_ID = LW_MOD-ROW_ID

.

ENDIF.

ENDIF.

CLEAR: LV_ROWID,

LV_FNAME.

ENDLOOP.

ENDMETHOD. "handle_data_changed

Edited by: Changjiu Tan on Sep 1, 2009 11:58 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
725

Hi,

Have you called the method CHECK_CHANGED_DATA in the PAI of your program?

Regards,

Ankur Parab

5 REPLIES 5
Read only

Former Member
0 Likes
726

Hi,

Have you called the method CHECK_CHANGED_DATA in the PAI of your program?

Regards,

Ankur Parab

Read only

0 Likes
725

Hi,

No, it is triggered by DATA_CHANGED event of CL_GUI_ALV_GRID. It is a event handler of event DATA_CHANGED

Vincent

Read only

0 Likes
725

Make sure that you are setting handler only once for ONE alv reference. Also make sure that only ONE instance of ALV is created during runtime. It might be that your event is triggered twice as there are two instances of ALVs and your handler method is registered for both.

Regards

Marcin

Read only

0 Likes
725

HI,

in that case probably the handler method is getting called twice.

Are you changing the ALV grid data within the handler method itself??

In that case it might call the handler method once again.

regards,

Ankur Parab

Read only

0 Likes
725

Hi,

I have checked my code, there seems no such probelm. Any other possible reasons?

Added: After the second error message screen has been closed. when press enter, no message pops up.

Vincent

Edited by: Changjiu Tan on Sep 1, 2009 2:14 PM