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: 

how to compare values in table control

Former Member
0 Kudos

Hi Experts,

How to compare two values of a field in table control. Like the frist row of feld1 with the second row of field1.

because when ever two values are same i need to display error message that we are entring duplicate entry.

i have been tring for a very log time but not getting any solution for this.

Thanks and Regards,

Ashwin.

2 REPLIES 2

Former Member
0 Kudos

Hi

Ashwin if you are using the internal table then in the PBO module of the screen you can check the two fields of the internal table and send the error message if they are same.

Second option is intead of displaying the data in Table control you can try to display it in ALV Screen

and their it would be really easy for you to do this check and send the error message.

Regards

Neha

lijisusan_mathews
Active Contributor
0 Kudos

you need to write in code for this..

A possible solution is given below..

Suppose your internal table fields are col1 and col2.

in the loop .....endloop of yout internal table in your PAI..there will be following(if your table control is made using wizard. otherwise you might have to add it..

loop at itab.

chain.

field col1.

field col2.

"some module

endchain.

endloop.

now make changes as shown to the above code..

loop at itab.

chain.

field wa-col1.

field wa-col2.

module table_modify on chain-request.

endchain.

now in your program add module table modify.

module table_modify input.

read table itab with key col1(which shud be unique) = wa-col1 transporting no-fields.

if sy-subrc = 0. " there exists another record with the same value

message e001(your message class).

endif.

endmodule.

i guess that shud work. get back if it dosnt.

regards

Suzie