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

alv grid (automatic) message error

Former Member
0 Likes
1,972

I've written a table maintenance program with an editable alv grid as per SAP example (BCALV_EDIT_04).

It works like a charm except for the NON desired message error log on a specific field/column (<b>PROD_NUM</b>) for appended rows. That is, when I click 'ENTER' (or 'check entries' button) a message error log is raised somehow, which I didn't cater for!

I am calling my grid as follows:


*...initialize alv grid
    CALL METHOD g_grid->set_table_for_first_display
      EXPORTING
        is_layout            = ps_layout
        it_toolbar_excluding = lt_exclude
      CHANGING
        it_fieldcatalog      = pt_fieldcat
        it_outtab            = pt_outtab[].

I also cater for changed data event as follows:


SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.
*---register ENTER to raise event DATA_CHANGED.
    CALL METHOD g_grid->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_enter.

As said before, I don't handle any checks for data (or existance) integrity or anything of the sort in my handle_data_changed method. This error seems to be raised almost automatically.

My field catalog is derived from the structure. In the structure, PROD_NUM is defined as Built-in type CHAR 02.

Is there a way to deactivate this error checking?

Nhlanhla Ndlovu

10 REPLIES 10
Read only

Former Member
0 Likes
1,413

Hi,

what is the error you are getting. is it related to PROD_NUM. can you specify what is that error.

Regards

vijay

Read only

0 Likes
1,413

The message says:

'Enter a valid value'.

See, I do want it to accept initial values as well for field PROD_NUM but it flags these as erroneous input on the alv message log.

Read only

0 Likes
1,413

can you show the data declaration of internal table and fieldcatalog.

Regards

vijay

Read only

Former Member
0 Likes
1,413

hi,

use following sy-subrc check after you call the display method.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Hope this helps..

Regards,

Shashank

Read only

0 Likes
1,413

I do not understand, Shashank. Please re-iterate.

Read only

Former Member
0 Likes
1,413

Hi,

Try following code..

*...initialize alv grid

CALL METHOD g_grid->set_table_for_first_display

EXPORTING

is_layout = ps_layout

it_toolbar_excluding = lt_exclude

CHANGING

it_fieldcatalog = pt_fieldcat

it_outtab = pt_outtab[].

IF SY-SUBRC <> 0.

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

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

ENDIF.

SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.

*---register ENTER to raise event DATA_CHANGED.

CALL METHOD g_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Regards,

Shashank

Read only

0 Likes
1,413

Hi Shashank,

I've tried this, Sir. Nothing happens, i.e. when I run the program, change edit values on the grid and click the 'check entries' button or 'ENTER' it just displays the alv grid message 'error log' with 'Enter a valid value' (this is for column PROD_NUM'.

sy-subrc is 0 in all cases.

Regards,

Nhlanhla Ndlovu

Read only

0 Likes
1,413

Can you show the declaration part of PROD_NUM .

if you enter invalid obviously you get error from alv.

that is the reason i was asking you to show the declaration ,you need to change the data type then only it will stop throwing the error.

Regards

vijay

Read only

0 Likes
1,413

The field catalog declaration:


 CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'  
   EXPORTING                             
     i_structure_name = 'ZST_ZMODEL_PARM'
   CHANGING                              
     ct_fieldcat      = pt_fieldcat.     

PROD_NUM in structure 'ZST_MODEL_PARM':


PROD_NUM	ZLAUNCH_MTH_START	NUMC	2	0	Month of Launch Start

Vijay, I think I've played around with this data type to realize that this is probably not where the problem is. Could it be something else?

Read only

0 Likes
1,413

what are you entering.

(when you got the message what value you entered).

Regards

vijay