cancel
Showing results for 
Search instead for 
Did you mean: 

how to compare field values are same or different

Former Member
0 Kudos

Hi Expert,

I have a requirement. which needs to be compare the values of the field in the loop or read statement.

Thanks in Advance,

venkat

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

i am assuming Itab as:

vendor

v1

v2

v3

v4

....

and Ktab as

__Vendor_ Quota_

V1 Q1

V2 Q2

V3 Q3

V4 Q4

...................................

So you want to compare that Q1,Q2,Q3,Q4 are equal or not...if so then you can do it in this way

Loop at ITAB into wa_itab.

read table ktab into wa_ktab with key vendor = wa_itab-vendor.

if sy-subrc = 0.

if temp_quota is initial.

temp_quota = wa_ktab-quota.

elseif temp_quota = wa_ktab-quota. "Same quota as for the previous record

<whatever processing you want>

elseif temp_quota <> wa_ktab-quota. "Different quota as for the previous record

<whatever processing you want>

endif.

As youe requirement is not very clear i could suggest you this much only but inthis way you can set a flag for differnt values of quota or same values .

endloop.

Former Member
0 Kudos

or simply you can apply

Select Distinct over Quota field into an internal table and just check how many entries it has, if one then all have the same quota value else it will give the different values of quota in the table.

Depending upon your requirement you can adopt the approach.

Former Member
0 Kudos

Hi Neha,

thanks for your reply, i hope u understood properly..

here i already got quota records in ktab table based on the quota arrangement number from itab.

now i want to check wether all quota values are different or same.

ex:- if i go to md04..there i will give material, werks, then i will see the quota arrangement for that material. if i click on quota arrangement ..i will see list of quota items...vendors...quota values..

ex:-

1 vendor1 quota1

1 vendor2 quota1

ex:-

1 vendor1 quota1

2 vendor2 quota2

so this is the way i will hav the values..

now i want to check my internal table(ktab) which contain quota values and vendors...

is there all quota values are same...or differnet?

so how to check.

Thanks in Advance,

Venkat

Former Member
0 Kudos

hiii

i think for this prblem you use the concept of for all entries ...thru this you compare both the table......

Former Member
0 Kudos

hi..

try this

DATA: HEX1(3) TYPE X VALUE '34B7A1',

HEX2(1) TYPE X VALUE 'F0'.

IF HEX2 > HEX1.

...

ENDIF.

Former Member
0 Kudos

For me the question is not clear explain that in detail.

Former Member
0 Kudos

Hi Murthy,

my requirement is..

i have valid vendors in 'itab' table.

for that valid vendors i have different quota values in 'ktab' table

there is a possibility that may be all the quota values are same for all the vendors.

so i want to check wether quota field values are same or different for vendors which are available in itab table.

so how can i check it.

Thanks in Advance,

venkat