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

Editable ALV Container Error Handling

Former Member
0 Likes
6,319

Hello all, just had a simple question that I haven't been able to find an answer to.

Starting facts:

  • I'm using a module program
  • On a screen we have an ALV grid in a container using method set_table_for_first_display

So the user enters data on screen 1 for instance, then we select from the DB and then display 10 records in an editable ALV.  They can then edit the data and press save. 

My Question
What is the best way to handle errors the user has entered in the ALV field and return those errors to the user in a clear way?

For instance, when there is an error on the data they entered in line 6, can I highlight line 6, or grey out the other lines and highlight the field(s) like you can with the field/endchain in the PAI?

Right now I am looping at the table after the "check_changed_data", and then executing a FORM in the MODULE code in the PAI.  Checking the data and issuing an error message... the problem is since all fields are still in edit it is a bit confusing.  I'm putting the line on the screen in the error message, but that cannot be the best way to do this. 

Any help is appreciated!

Ronnie

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,096

Hi,

The best way is to do the SAP standard way of handling errors. Take a look at program BCALV_EDIT_03.

Regards,

Jake

Hello all, just had a simple question that I haven't been able to find an answer to.

Starting facts:

  • I'm using a module program
  • On a screen we have an ALV grid in a container using method set_table_for_first_display

So the user enters data on screen 1 for instance, then we select from the DB and then display 10 records in an editable ALV.  They can then edit the data and press save. 

My Question
What is the best way to handle errors the user has entered in the ALV field and return those errors to the user in a clear way?

For instance, when there is an error on the data they entered in line 6, can I highlight line 6, or grey out the other lines and highlight the field(s) like you can with the field/endchain in the PAI?

Right now I am looping at the table after the "check_changed_data", and then executing a FORM in the MODULE code in the PAI.  Checking the data and issuing an error message... the problem is since all fields are still in edit it is a bit confusing.  I'm putting the line on the screen in the error message, but that cannot be the best way to do this. 

Any help is appreciated!

Ronnie

6 REPLIES 6
Read only

Former Member
0 Likes
4,096

Hi Ronnie,

I agree and would deactivate the lines which are good and highlight the line/field which has the error. Use 'S' or 'I' messages with addition display-like 'E' or 'W'. 

Regards,

Shravan

Read only

0 Likes
4,096

'E' Type messages dont work in OOPS ALV. If you do, you are generally thrown out of the screen.

Also, 'I' Messages are converted to 'S' Messages.

Read only

0 Likes
4,096

Hi Chinmay,

I am not suggesting 'E' messages. I am suggesting messages of type 'S' or 'I' with DISPLAY-LIKE 'E' addition.

Regards,

Shravan

Read only

Former Member
0 Likes
4,097

Hi,

The best way is to do the SAP standard way of handling errors. Take a look at program BCALV_EDIT_03.

Regards,

Jake

Read only

Former Member
0 Likes
4,096

Hi Ronnie,

You can also add a new field to the ALV display say 'Messages'' for displaying the error messages for each line.

Give Green Traffic light for successful records and disable edit mode for them and for Error ones, give Red light and enable fields for editing.

Thanks.

Shambu

Read only

Former Member
0 Likes
4,096

Hi,

Jake +1. The best way to go is using standard class cl_alv_changed_data_protocol with add_protocol_entry & display_protocol methods. You don't need to struggle with changing ALV layout accordingly, this class will smoothly handle erroneous cells for you.

Also, a nice way for displaying the protocol could be to split your main container in 2 parts and include the protocol object in the container below. Then just collapse it if no error exists and expand it when errors are found...well just in case, like me, you don't like popups

Cheers,

Manu.