05-15-2011 6:40 AM
Hello all,
I am wondering how to load IDocs for Material Master if Internal Numbering is set for a particular Material Type.
Actually it seems in our system that Internal and External Number has been set up for the Material Type. When I am in SAP Dialog creating the Material, and I do not enter a number, SAP automatically assigns a number. If I provide a External Number within the External Number Range, SAP takes that number and allows me to continue.
But when I load the IDoc for that Material Type, and I leave the Material Number blank, I get the error u201CNo material number transferredu201D.
I then entered a Material Number within the Internal Number Range and it worked to my surprise. I do not know why I was asked for the Material Number if in fact Internal Number is on along with External Number. I thought that if I do not supply a Material Number that SAP would simply assign one and I would have to go to table MARA using the Old Material Number to retrieve the Internal Number.
How can I load the Material Master IDocs if Internal Numbering is a option? I need help with this.
Thanks all.
05-15-2011 7:19 AM
05-15-2011 7:19 AM
05-15-2011 7:43 AM
Ok, this give me an idea of how I might be able to do this. I am actually using J3AMAT | /AFS/MATMAS05 to load Footwear and Apparel Materials. I am also using LSMW for the upload. With that in mind, do you know if I can call the Function u201CNUMBER_GET_NEXTu201D to get the next Internal Number, and then use that for the load? I am think that might fall in line with the technique suggested by the SAP Note.
05-16-2011 9:59 PM
yes, NUMBER_GET_NEXT is the right function module to call toget the next number in case of internal numbering into an IDOC.
05-16-2011 11:19 PM
If you are working on ECC 6.0 and using Inbound Processing function module IDOC_INPUT_MATMAS01, then create Enhancement Implementation for below enhancement point in the code:
ENHANCEMENT-POINT IDOC_INPUT_MATMAS01_G1 SPOTS ES_SAPLMV02
Use below code to get and fill the new internal material number in the IDOC segment:
DATA: LT_MATNR TYPE TABLE OF BAPIMATINR,
LS_MATNR TYPE BAPIMATINR,
LS_OLD_MATNR TYPE BAPIMATINR,
LS_E1MARAM TYPE E1MARAM,
LS_MATL_TYPE TYPE MTART.
LOOP AT IDOC_DATA WHERE SEGNAM = 'E1MARAM'.
LS_E1MARAM = IDOC_DATA-SDATA.
LS_MATL_TYPE = LS_E1MARAM-MTART.
ENDLOOP.
IF LS_E1MARAM-MATNR IS INITIAL.
CALL FUNCTION 'BAPI_MATERIAL_GETINTNUMBER'
EXPORTING
MATERIAL_TYPE = LS_MATL_TYPE
INDUSTRY_SECTOR = 'M'
REQUIRED_NUMBERS = 1
TABLES
MATERIAL_NUMBER = LT_MATNR.
READ TABLE LT_MATNR INTO LS_MATNR INDEX 1.
LOOP AT IDOC_DATA WHERE SEGNAM = 'E1MARAM'.
LS_E1MARAM = IDOC_DATA-SDATA.
LS_E1MARAM-MATNR = LS_MATNR-MATERIAL.
IDOC_DATA-SDATA = LS_E1MARAM.
MODIFY IDOC_DATA INDEX SY-TABIX.
ENDLOOP.
ENDIF.