‎2007 Feb 02 4:37 PM
I am reading a table from a database into an internal table.
one of the fields in this table is MATNR and is displayed as ****( 4 to 8 character digit). I am comparing it agnist an other internal table field matnr which is '000000000000*****) 18 char field.
my problem is when i compare these fields they do not match because of the extra zero.
i.e 12345 <> 000000000000012345
how can i change the program to mach these fields..
VJ
‎2007 Feb 02 4:40 PM
Hi,
Use function module CONVERSION_EXIT_ALPHA_INPUT. And pass the material no to it before comapiring.
This will solve your problem.
Reward points if helpful answer.
Ashvender
Message was edited by:
Ashvender Kumar
‎2007 Feb 02 4:39 PM
Hi,
You can use this FM CONVERSION_EXIT_MATN1_INPUT to add leading zeros for matnr or FM CONVERSION_EXIT_MATN1_OUTPUT to delete leading zeros for matnr.
Then you can compare both fields.
Regards,
Ferry Lianto
‎2007 Feb 02 4:39 PM
Hi VJ,
Use Conversion exit on MATNR before doing comparision.
For this use FM 'CONVERSION_EXIT_MATN1_INPUT' to add leading zeros and compare this field with inerntal table field.
Thanks,
Vinay
‎2007 Feb 02 4:40 PM
Hi,
Use function module CONVERSION_EXIT_ALPHA_INPUT. And pass the material no to it before comapiring.
This will solve your problem.
Reward points if helpful answer.
Ashvender
Message was edited by:
Ashvender Kumar
‎2007 Feb 02 4:42 PM
Hi,
You can also use use SHIFT for the field MATNR which has the format "000000000000******".
Example
-
DATA: V_MATNR TYPE MATNR VALUE '000000000TEST'.
SHIFT V_MATNR LEFT DELETING LEADING '0'.
Thanks,
Naren
‎2007 Feb 02 4:56 PM
Hi,
this should solve your problem.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = V_MATNR
IMPORTING
OUTPUT = V_MATNR.
Regards
Vara
‎2007 Feb 02 5:26 PM
HI,
simple code...
<b>LOOP AT ITAB.
UNPACK ITAB-MATNR TO ITAB-MATNR.
MODIFY ITAB TRANSPORTING MATNR.
ENDLOOP.</b>
now u can compare...
or u can use those conversion exits also.
<b>LOOP AT ITAB.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ITAB-MATNR
IMPORTING
output = ITAB-MATNR.
MODIFY ITAB TRANSPORTING MATNR.
ENDLOOP.</b>
now itab-matnr has also..000000000001234 = 0000000000001234 ( table field)
Regards
SAB
‎2007 Nov 29 4:11 PM
"UNPACK ITAB-MATNR TO ITAB-MATNR" is the fast method rather then calling FM each time thru the loop.