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: 

Error

Former Member
0 Kudos

Guys,

iam getting error with the following simple code please help on this.

IF NOT INT_INPUT-paycust IS INITIAL.

READ TABLE int_kna1 WITH KEY KUNNR = int_intput-paycust

KTOKD NE '0012'.

endif.

-


error message is "=.." expected after "KTOKD".

10 REPLIES 10

Former Member
0 Kudos

In the read statement you cannot use the operator NE .

Former Member
0 Kudos

Hi,

We can't use NE operator in the read statement. Pls try with different statement.

Regards,

Ram

0 Kudos

Even i used <> it is giving same error boss.

andreas_mann3
Active Contributor
0 Kudos

Hi,

try:

READ TABLE int_kna1 WITH KEY KUNNR = int_intput-paycust.
if int_kna1-KTOKD NE '0012'.
 ...
else.
 ...
endif.

A.

Former Member
0 Kudos

Guys,

I want to write code for this requirement.

-


loop at int_input.

Validate Customer Number

Read KNA1

Must be found.

If Account Group <> “0012” then

Read KNVH Where KUNNR = Customer Number

If found – move HKUNNR to output Customer Nbr.

Else move “Missing”.

endloop.

please help on this.

regards,

vijay

0 Kudos

hi,

READ TABLE ITAB.... can RETURN ONLY 1 RECORD. if you use <> or > or any other operator other than = ,there is a possibility that it can match more than 1 record which READ TABLE can NOT process.

Thats why you can use only = in READ TABLE.

here is the logic,

IF NOT INT_INPUT-paycust IS INITIAL.
READ TABLE int_kna1 WITH KEY KUNNR = int_intput-paycust.
 if int_kna1-KTOKD NE '0012'.
   read table KNVH with key KUNNR = Int_kna1-kunnr.
   if sy-subrc = 0.
     move HKUNNR to <variable>.
   endif.
 else.
   write 'missing'.
 endif.
endif.

regards

srikanth

Message was edited by: Srikanth Kidambi

0 Kudos

Vijay,

There are many ways to resolve the below..one of them is as indicated.

Loop at int_input.

clear int_kna1.

loop at int_kna1 where kunnr = int_input-kunnr and

acctgr <> '0012'.

Select hkunnr into outkunnr from knvh where kunnr =

int_input-kunnr.

endloop.

if sy-subrc <> 0.

outkunnr = 'Missing'.

endif.

endloop.

Former Member
0 Kudos

hi

good

wrong->

IF NOT INT_INPUT-paycust IS INITIAL.

READ TABLE int_kna1 WITH KEY KUNNR = int_intput-paycust

KTOKD NE '0012'.

right->

IF NOT INT_INPUT-paycust IS INITIAL.

READ TABLE int_kna1 WITH KEY KUNNR = int_intput-paycust

where KTOKD NE '0012'.

try this out .

thanks

mrutyun^

Former Member
0 Kudos

if KTOKD is common field to INT_INPUT and int_kna1.

Please try using the following code:

IF NOT INT_INPUT-paycust IS INITIAL

and INT_INPUT-KTOKD NE '0012'.

READ TABLE int_kna1 WITH KEY KUNNR = int_intput-paycust

KTOKD = INT_INPUT-KTOKD.

endif.

If if KTOKD is a field of int_kna1 only ,

try the following:

READ TABLE int_kna1 WITH KEY KUNNR = int_intput-paycust.

if int_kna1-KTOKD NE '0012'.

....

....

endif.

Hope it helps... pls don't forget to reward pts..

Former Member
0 Kudos

Thanks a lot for every one problem is resolved.

i will reward to every one.