09-29-2008 7:52 AM
Hi friends,
I have a problem regaridng check for a material.
i have
*vbap-matnr = '000000000000000234
and now i will change material no
from 000000000000000234 to 000000000000000235
ie : only when the last digit of the number is change it should go into the if condition
code :
the old value will be there in the field
*vbap-matnr = '000000000000000234
and the change value will be in
vbap-matnr = 000000000000000235
if vbap-matnr17(1) = *vbap-matnr17(1)
Endif.
if iam writing in the above way its going ito the if condition even for the last 2 digits change also instead it shouild only when last digit of the material number is change.
How can i do that.
Reagrds
PRIYANKA.
09-29-2008 8:04 AM
hi,
IF vbap-matnr+17(1) NE *vbap-matnr+17(1) AND
IF vbap-matnr(17) EQ *vbap-matnr(17).
==> only the last digit changed
ENDIF
hope this helps
ec
09-29-2008 8:03 AM
Hi
try comparing both values.
i mean last digit should not match and other digits should match. like this. it will work.
if vbap-matnr17(1) <> mara-matnr17(1)
and vbap-matnr0(17) = mara-matnr0(17).
write:
/ vbap-matnr17(1), mara-matnr17(1).
else.
write: vbap-matnr.
endif.
09-29-2008 8:04 AM
hi,
IF vbap-matnr+17(1) NE *vbap-matnr+17(1) AND
IF vbap-matnr(17) EQ *vbap-matnr(17).
==> only the last digit changed
ENDIF
hope this helps
ec
09-29-2008 8:07 AM
while looping the data u need to take old VBAP-MATNR17(1) into one variable and compare that with current VBAP-MATNR17(1).
then only ur issue will be resolved.
VBAP-MATNR+17(1) always take recent value in VBAP-MATNR.
Regards,
Ajay kumar
09-29-2008 8:09 AM
Example code.
data: lv_matnr type mara-matnr.
loop.
If vbap-matnr17(1) = lv_matnr17(1).
-
-
endif.
clear lv_matnr.
lv_matnr = vbap-matnr.
endloop.
09-29-2008 8:14 AM
Hi,
you can try this:
DATA: MATNR0 LIKE MARA-MATNR VALUE '000000000000000591'.
DATA: MATNR1 LIKE MARA-MATNR VALUE '000000000100000590'.
DATA: I TYPE I.
*
I = ABS( MATNR0 - MATNR1 ).
*
IF I BETWEEN 1 AND 9.
WRITE: / 'last digit different'.
ELSE.
WRITE: / 'last digit NOT different'.
ENDIF.
Regards, Dieter
09-29-2008 8:18 AM
hi
the old value will be there in the field
*vbap-matnr = '000000000000000234
and the change value will be in
vbap-matnr = 000000000000000235
Create one more variable to store like
data wa_next_matnr type vbap-matnr.
wa_next_matnr = *vbap-matnr + 1.
Then use it in IF statement Like
if wa_new_matnr = vbap-matnr.
endif.
Take care of alphanumaric material number in prg. otherwise you will get short dump