Skip to Content
avatar image
Former Member

Material number from right to left 9 characters

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Jul 13, 2009 at 10: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

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 13, 2009 at 10:05 AM

    try moving the material no to type string

    and then

    matnr = matnr0(9)

    cheers

    s.janagar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 13, 2009 at 10:07 AM

    USING STRLEN YOU VCAN DO UR CODING

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 13, 2009 at 10: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 13, 2009 at 10: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

    Add comment
    10|10000 characters needed characters exceeded