Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10519

Re: Conflicts of having same material with different material codes

$
0
0

Hi all ;

 

You can manage your material codes with characteristics.

 

For example : Technical materials start with T7000000 , Roh materials start with R30000.

 

Code:

 

 

 

*&  Include           ZXMG0U03



*&---------------------------------------------------------------------*



DATA: TMPDAT(19).

** Get the next SAP internal number.

*if ( mmue2-mtart(1) = 'Z' ) or ( mmue2-mtart(1) = 'Y' ).

*check mmue2-mtart ne 'ZHMM'.



CALL FUNCTION 'MATERIAL_NUMBER_GET'

  EXPORTING

    NUMKR              = MMUE2-NUMKI

  CHANGING

    MATNR              = MATNR

  EXCEPTIONS

    NO_INTERNAL_NUMBER = 1

    OTHERS             = 2.

** Get rid of leading zeros

WHILE MATNR(1) = '0'.

  SHIFT MATNR.

ENDWHILE.

*** put the material type in front of the number.

CASE  MMUE2-MTART.



  WHEN 'SARF'.

    CONCATENATE 'S' MATNR INTO TMPDAT.

  WHEN 'TEKN'.

    CONCATENATE 'T' MATNR INTO TMPDAT.

  WHEN 'PACK'.

    CONCATENATE 'A' MATNR INTO TMPDAT.

  WHEN OTHERS.

    UNPACK matnr to MATNR.

    TMPDAT = MATNR.

ENDCASE.



*CONCATENATE MMUE2-MTART MATNR INTO TMPDAT.

*if mmue2-mtart = 'ZART' or mmue2-mtart = 'ZTEK'.

*SHIFT TMPDAT.

*endif.

** check that things haven't gotten too long.

IF TMPDAT+18(1) = ' '. "Number not too long

  MATNR = TMPDAT.

ENDIF.

 

 

 

 

Regards.

 

 

 

 

M.Ozgur Unal


Viewing all articles
Browse latest Browse all 10519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>