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: 

If there r MULTIPLE entries of different in my_itab, throw ERROR??

Former Member
0 Kudos
87

Hi Experts,

Am filling the my_itab(which does hv 1 filed of Order), by doing some processing.

Always, the Order # shuld b the same.

If in any case, there r multiple Orders in this itab of DIFFERENT, I need throw ERROR message.

So, instead of looping the itab, checking each entry explicitly, Is there any Statement, Clause, sytax?

thanq

Edited by: Srinivas on Jul 16, 2008 1:46 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
67

Hi,

Try this..

SORT MY_ITAB BY ORDER_NO.

DELETE ADJACENT DUPLICATES FROM MY_ITAB COMPARING ORDER_NO.

* get the number of entries.
DESCRIBE TABLE MY_ITAB.

IF SY-TFILL > 1.
* Raise an error  message if the number of entries is greater than 1.
  message e208(00) with 'More than one order number'.

ENDIF.

Thanks

naren

2 REPLIES 2

Former Member
0 Kudos
68

Hi,

Try this..

SORT MY_ITAB BY ORDER_NO.

DELETE ADJACENT DUPLICATES FROM MY_ITAB COMPARING ORDER_NO.

* get the number of entries.
DESCRIBE TABLE MY_ITAB.

IF SY-TFILL > 1.
* Raise an error  message if the number of entries is greater than 1.
  message e208(00) with 'More than one order number'.

ENDIF.

Thanks

naren

Former Member
0 Kudos
67

Hi,

Declare another varialbe of the Order type and assign the value to it.

w_order = itab-order.

Loop itab where itab-order = w_order.

if w_order eq itab-order.

message 'Same order number' type 'E'.

endif.

w_order = itab-order.

endloop.

Reward if helpful.

Regards

Chandralekha