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: 

Material number from right to left 9 characters

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

I355602
Advisor
Advisor
0 Kudos

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

5 REPLIES 5

former_member183990
Active Contributor
0 Kudos

try moving the material no to type string

and then

matnr = matnr0(9)

cheers

s.janagar

Former Member
0 Kudos

USING STRLEN YOU VCAN DO UR CODING

Former Member
0 Kudos

You can use the conversion Exits for ur requirement, they will convert ur length accordingly...

CONVERSION_EXIT_MATN1_INPUT

CONVERSION_EXIT_MATN1_OUTPUT

Former Member
0 Kudos

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

I355602
Advisor
Advisor
0 Kudos

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