07-13-2009 11:03 AM
Hi Experts,
I have a small quiery about choosing 9 characters from material number from right to left.
In my internal table i have both numeric and alpha numeric material numbers.
for numeric material numbers i can use offset. But for alpha numeric materials i cannot use offset since it varies length.
Please suggest a solution for this.
Thanks
Mohana
07-13-2009 11:34 AM
Hi,
Refer:-
DATA lv_len TYPE i.
DATA lv_off TYPE i.
lv_len = strlen( v_matnr ).
IF lv_len > 9.
lv_off = lv_len - 9.
write : v_matnr+lv_off(lv_len).
ELSE.
write : v_matnr.
ENDIF.
Hope this helps you.
Regards,
Tarun
07-13-2009 11:05 AM
try moving the material no to type string
and then
matnr = matnr0(9)
cheers
s.janagar
07-13-2009 11:07 AM
07-13-2009 11:11 AM
You can use the conversion Exits for ur requirement, they will convert ur length accordingly...
CONVERSION_EXIT_MATN1_INPUT
CONVERSION_EXIT_MATN1_OUTPUT
07-13-2009 11:31 AM
hi
use the below code
P_matnr is your matnr
DATA: lv_matnr(9) type c.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = p_matnr
IMPORTING
OUTPUT = lv_matnr.
if P_MATNR 000000000100000171
lv_matnr 100000171
Thank you
surya
07-13-2009 11:34 AM
Hi,
Refer:-
DATA lv_len TYPE i.
DATA lv_off TYPE i.
lv_len = strlen( v_matnr ).
IF lv_len > 9.
lv_off = lv_len - 9.
write : v_matnr+lv_off(lv_len).
ELSE.
write : v_matnr.
ENDIF.
Hope this helps you.
Regards,
Tarun