Create Material With BAPI_MATERIAL_SAVEDATA
Hi,
I New To SAP I'm Trying To Create Material With BAPI_MATERIAL_SAVEDATA . When I Execute The Code I am Getting Message That ' Bytes Transfered' But When I Checking The MARA Table I Cannot Find The Enteries..
*************************************************************CODE*********************************************************************************
TABLES: bapimathead,
bapi_mara,
bapi_marax,
bapiret2.
TYPES: BEGIN OF lsmw_material_master,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
maktx TYPE makt-maktx,
meins TYPE mara-meins,
END OF lsmw_material_master.
DATA: it_master TYPE TABLE OF lsmw_material_master,
wa_master TYPE lsmw_material_master,
it_materialdesc TYPE TABLE OF bapi_makt WITH HEADER LINE,
it_return LIKE bapiret2.
SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK a1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
DATA: it_tab TYPE filetable,
iv_subrc LIKE sy-subrc.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select Source File'
CHANGING
file_table = it_tab
rc = iv_subrc
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_tab INTO p_file.
ENDLOOP.
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = it_master
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_master INTO wa_master.
bapimathead-material = wa_master-matnr.
bapimathead-ind_sector = wa_master-mtart.
bapimathead-matl_type = wa_master-mbrsh.
bapimathead-basic_view = 'X'.
bapi_mara-base_uom = wa_master-meins.
bapi_marax-base_uom = 'X'.
it_materialdesc-matl_desc = wa_master-maktx.
APPEND it_materialdesc.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = bapimathead
clientdata = bapi_mara
CLIENTDATAX = bapi_marax
IMPORTING
return = it_return
TABLES
materialdescription = it_materialdesc
ENDLOOP.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
* ELSE.
WRITE:/ 'Error'.
* CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
* IMPORTING
* RETURN =
ENDIF.
*************************************************************FILE >>>>>check.text.********************************************************************************
Cooinfl_Fan
E
FERT
FANS
PC
Bathing_Fan
E
FERT
FANS
PC
Please pass following values:
it_materialdesc-matl_desc = wa_master-maktx.
it_materialdesc-langu = 'E'.
it_materialdesc-langu_iso = 'EN'.
APPEND it_materialdesc.
Regards
Similar Messages
-
Create material using bapi_material_savedata
Hi.
I'm having prob with creation of material using bapi_material_savedata. When creating new material we use internal numbering so I use first bapi_material_getintnumber'. the number from that bapi is what i used in bapi_material_savedata. However, I getting an error that says 'matnr <from bapi>does not exists', why is this so? do i need to put the commit after the bapi_material_getintnumber and before calling the bapi_material_savedata?
Please help.
thnx.hi
good
go through this example and use accordingly
REPORT ZBAPIMM01 LINE-SIZE 255 NO STANDARD PAGE HEADING
LINE-COUNT 065(001).
TABLES: T001L, "Storage Locations
MARA, "General Material Data
MAKT, "Material Descriptions
MBEW, "Material Valuation
MARC. "Plant Data for Material
DATA: BAPI_HEAD LIKE BAPIMATHEAD,
BAPI_MAKT LIKE BAPI_MAKT, "Material Description
BAPI_MARA1 LIKE BAPI_MARA, "Client Data
BAPI_MARAX LIKE BAPI_MARAX,
BAPI_MARC1 LIKE BAPI_MARC, "Plant View
BAPI_MARCX LIKE BAPI_MARCX,
BAPI_MBEW1 LIKE BAPI_MBEW, "Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX,
BAPI_RETURN LIKE BAPIRET2.
DATA: BEGIN OF INT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF INT_MAKT.
DATA: BEGIN OF INT_MAT OCCURS 100,
WERKS(4), "Plant
MTART(4), "Material type
MATNR(18), "Material number
MATKL(9) , "Material group
MBRSH(1), "Industry sector
MEINS(3), "Base unit of measure
GEWEI(3), "Weight Unit
SPART(2), "Division
EKGRP(3), "Purchasing group
VPRSV(1), "Price control indicator
STPRS(12), "Standard price
PEINH(3), "Price unit
SPRAS(2), "Language key
MAKTX(40), "Material description
END OF INT_MAT.
SELECT-OPTIONS:
PLANT FOR MARC-WERKS OBLIGATORY MEMORY ID PLT,
MATERIAL FOR MARA-MATNR MEMORY ID MAT,
MATLTYPE FOR MARA-MTART MEMORY ID MTY,
DIVISION FOR MARA-SPART MEMORY ID DIV.
PARAMETERS: F_FILE LIKE RLGRAP-FILENAME
DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
IF GETDATA = 'X'.
PERFORM DOWNLOAD_DATA.
PERFORM DOWNLOAD_FILE.
ENDIF.
IF UPDDATA = 'X'.
PERFORM UPLOAD_FILE.
PERFORM UPDATE_MM.
ENDIF.
FORM DOWNLOAD_DATA.
SELECT * FROM MARC WHERE LVORM EQ ' '
AND WERKS IN PLANT
AND MATNR IN MATERIAL.
CLEAR MARA.
SELECT SINGLE * FROM MARA WHERE MATNR = MARC-MATNR.
CHECK MATLTYPE.
CHECK DIVISION.
CLEAR MBEW.
SELECT SINGLE * FROM MBEW WHERE MATNR = MARC-MATNR
AND BWKEY = MARC-WERKS.
CLEAR MAKT.
SELECT SINGLE * FROM MAKT WHERE SPRAS = 'EN'
AND MATNR = MARC-MATNR.
WRITE:/ MARC-WERKS, "Plant
MARA-MTART, "Material type
MARA-MATNR, "Material number
MARA-MATKL, "Material group
MARA-MBRSH, "Industry sector
MARA-MEINS, "Base unit of measure
MARA-GEWEI, "Weight Unit
MARA-SPART, "Division
MARC-EKGRP, "Purchasing group
MBEW-VPRSV, "Price control indicator
MBEW-STPRS, "Standard price
MBEW-PEINH, "Price unit
MAKT-SPRAS, "Language key
MAKT-MAKTX. "Material description
INT_MAT-WERKS = MARC-WERKS. "Plant
INT_MAT-MTART = MARA-MTART. "Material type
INT_MAT-MATNR = MARA-MATNR. "Material number
INT_MAT-MATKL = MARA-MATKL. "Material group
INT_MAT-MBRSH = MARA-MBRSH. "Industry sector
INT_MAT-MEINS = MARA-MEINS. "Base unit of measure
INT_MAT-GEWEI = MARA-GEWEI. "Weight Unit
INT_MAT-SPART = MARA-SPART. "Division
INT_MAT-EKGRP = MARC-EKGRP. "Purchasing group
INT_MAT-VPRSV = MBEW-VPRSV. "Price control indicator
INT_MAT-STPRS = MBEW-STPRS. "Standard price
INT_MAT-PEINH = MBEW-PEINH. "Price unit
INT_MAT-SPRAS = MAKT-SPRAS. "Language key
INT_MAT-MAKTX = MAKT-MAKTX. "Material description
APPEND INT_MAT.
CLEAR INT_MAT.
ENDSELECT.
ENDFORM.
FORM DOWNLOAD_FILE.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Download Successfully to your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPLOAD_FILE.
call function 'WS_UPLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Upload Successfully from your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPDATE_MM.
LOOP AT INT_MAT.
Header
BAPI_HEAD-MATERIAL = INT_MAT-MATNR.
BAPI_HEAD-IND_SECTOR = INT_MAT-MBRSH.
BAPI_HEAD-MATL_TYPE = INT_MAT-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
Material Description
REFRESH INT_MAKT.
INT_MAKT-LANGU = INT_MAT-SPRAS.
INT_MAKT-MATL_DESC = INT_MAT-MAKTX.
APPEND INT_MAKT.
Client Data - Basic
BAPI_MARA1-MATL_GROUP = INT_MAT-MATKL.
BAPI_MARA1-BASE_UOM = INT_MAT-MEINS.
BAPI_MARA1-UNIT_OF_WT = INT_MAT-GEWEI.
BAPI_MARA1-DIVISION = INT_MAT-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
Plant - Purchasing
BAPI_MARC1-PLANT = INT_MAT-WERKS.
BAPI_MARC1-PUR_GROUP = INT_MAT-EKGRP.
BAPI_MARCX-PLANT = INT_MAT-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
Accounting
BAPI_MBEW1-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEW1-PRICE_CTRL = INT_MAT-VPRSV.
BAPI_MBEW1-STD_PRICE = INT_MAT-STPRS.
BAPI_MBEW1-PRICE_UNIT = INT_MAT-PEINH.
BAPI_MBEWX-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
WRITE:/ BAPI_HEAD, BAPI_MARC1.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA = BAPI_MVKE1
SALESDATAX = BAPI_MVKEX
STORAGETYPEDATA =
STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = INT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error Message ', BAPI_RETURN.
ENDIF.
ENDLOOP.
ENDFORM.
*---End of Program
thanks
mrutyun^ -
Create material with reference using BAPI
Hi
I need to create material using refrence to another material for all material Views. Can I use BAPI_MATERIAL_SAVEREPLICA.
Which parameter I need to fill for reference materia
Moderator message: please do your own research before asking.
Edited by: Thomas Zloch on Jan 12, 2011 3:18 PMHi Goutam,
You can use the BAPI BAPI_MATERIAL_SAVEDATA, which will create/update the material. You can pass the reference material in the filed BAPI_MARA-PL_REF_MAT. And you can pass reference material for all view like this. -
Profit Center Disabled while Creating Material with Custom Trnx
Hi all,
I am trying to extend material to a another Plant with Custom trnx to create material.
I am able to create / extend material for some plants. But, for few plants, I am getting error to input data for 'Profit' Center' field in 'Sales:General / Plant' view' as 'MARC-PRCTR' is not ready for input. The field is in disable (grayed out) mode. But, for other materials, I am able to extend the material successfully.
The Profit center value is same which used for previous materials, extended successfully. Except the target Plant , all the details are same.
Coudl some one can help on this.
Regards
SPthis is most probably because of missing customizing of field selection in OMS9 transaction
-
How to create material using BAPI_material_savedata.
hi,
i try to create the material by using a bapi BAPI_MATERIAL_SAVEDATA , every thing i s going good material is created but only the MFRPN (manufacrurer part number ) is not updated.
thanks in advance.Hi Ritesh,
Plz check out this link;
[Creation of BAPI using BAPI_material_savedata|https://wiki.sdn.sap.com/wiki/display/Snippets/Tutorial%2CMM01UploadusingBAPI]
But plz check the mandatory fields to be passed to the BAPI.
with regards,
Mamta
Edited by: Mamta Kumari on Aug 20, 2009 3:14 PM -
Create Material with cost center
Dear SAP Gurus,
I want to create new materials with specific cost center but I do not know how can this be done. Is it possible for someonw to help me...?
This is MM or more CO module?
kind regards
Oliver FHi,
Materials are not linked to cost centres. Whenever, you issue a material, you can select the relevant cost centre in the time of the goods issue.
Regards,
Eli -
Create Material with reference
Hi all. I have the next requeriment:
On a Z program, a user creates a relation between 2 material in 2 different plants, when the material on the 2nd plant doesn't exist must be created as a copy of the original material. For example:
Original MATNR --> MATERIAL01
Original WERKS --> IN55
Copy MATNR --> MATERIAL02
Copy WERKS --> IN25
In this case, the material MATERIAL02 doesn't exist in the IN25 Plant, so it must be created as a copy of the MATERIAL01.
This could be done manually on MM01 trx and adding the MATERIAL01 value as the reference material, but this needs to be done automatically, and the easiest way to do it is using BAPI.
Does anybody know a BAPI to do this??
Thanx.
JesusYou can use the BAPI_MATERIAL_SAVEDATA. You will have to get all of the data for the reference material, then swap the material number, then call the BAPI.
Regards,
Rich Heilman -
Report problem with BAPI_MATERIAL_SAVEDATA (help required)
hi all,
i am using this source code to create material using
BAPI_MATERIAL_SAVEDATA.
when i am executing the program,
i am getting message the material no 512 transferred without leading 0.
but when i am checking the mara table i am not getting the material 512 created.
my program is as follows plz check where i am wrong ? why i am not able to create the material using this program.what changes i have to make in this program so that i will be successful in creating material.?
*& Report ZCREATE_MATERIAL
*& Developer
*& Date: &DATE
STRUCTURE DECLARATIONS *
Report:zcreate_material.
TABLES: BAPIMATHEAD, "Headerdata
BAPI_MARA, "Clientdata
BAPI_MARAX, "Clientdatax
BAPI_MARC, "Plantdata
BAPI_MARCX, "Plantdatax
BAPI_MAKT, "Material description
BAPIRET2. "Return messages
DATA:V_FILE TYPE STRING.
DATA:
BEGIN OF LSMW_MATERIAL_MASTER,
MATNR(018) TYPE C, "Material number
MTART(004) TYPE C, "Material type
MBRSH(001) TYPE C, "Industry sector
WERKS(004) TYPE C, "Plant
MAKTX(040) TYPE C, "Material description
DISMM(002) TYPE C, "Extra Field Added In the Program as
*itsrequired
MEINS(003) TYPE C, "Base unit of measure
MATKL(009) TYPE C, "Material group
SPART(002) TYPE C, "Division
LABOR(003) TYPE C, "Lab/office
PRDHA(018) TYPE C, "Product hierarchy
MSTAE(002) TYPE C, "X-plant matl status
MTPOS_MARA(004) TYPE C, "Gen item cat group
BRGEW(017) TYPE C, "Gross weight
GEWEI(003) TYPE C, "Weight unit
NTGEW(017) TYPE C, "Net weight
GROES(032) TYPE C, "Size/Dimensions
MAGRV(004) TYPE C, "Matl grp pack matls
BISMT(018) TYPE C, "Old material number
WRKST(048) TYPE C, "Basic material
PROFL(003) TYPE C, "DG indicator profile
KZUMW(001) TYPE C, "Environmentally rlvt
BSTME(003) TYPE C, "Order unit
VABME(001) TYPE C,
EKGRP(003) TYPE C, "Purchasing group
XCHPF(001) TYPE C, "Batch management
EKWSL(004) TYPE C, "Purchasing key value
WEBAZ(003) TYPE C, "GR processing time
MFRPN(040) TYPE C, "Manufacturer part number
MFRNR(010) TYPE C, "Manufacturer number
VPRSV(001) TYPE C, "Price control indicator
STPRS(015) TYPE C, "Standard price
BWPRH(014) TYPE C, "Commercial price1
BKLAS(004) TYPE C, "Valuation class
END OF LSMW_MATERIAL_MASTER.
INTERNAL TABLE DECLARATIONS *
*to store the input data
DATA:
BEGIN OF it_matmaster OCCURS 0.
INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
DATA:END OF it_matmaster.
*for material description
DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
INCLUDE STRUCTURE BAPI_MAKT .
DATA:END OF IT_MATERIALDESC.
*to return messages
DATA:BEGIN OF IT_RETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA:END OF IT_RETURN.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
TO UPLOAD THE DATA *
START-OF-SELECTION.
V_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT_MATMASTER
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA POPULATIONS *
LOOP AT IT_MATMASTER.
BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
BAPIMATHEAD-BASIC_VIEW = 'X'.
BAPIMATHEAD-PURCHASE_VIEW = 'X'.
BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.
BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-OLD_MAT_NO = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-BASIC_MATL = 'X'.
BAPI_MARAX-MFR_NO = 'X'.
BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.
BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
IT_MATERIALDESC-LANGU = 'EN'.
IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
append IT_materialdesc.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = BAPIMATHEAD
CLIENTDATA = BAPI_MARA
CLIENTDATAX = BAPI_MARAx
PLANTDATA = BAPI_MARc
PLANTDATAX = BAPI_MARcx
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
RETURN = IT_RETURN
TABLES
MATERIALDESCRIPTION = IT_MATERIALDESC
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
Bapi to commit the changes
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
WRITE:/ IT_RETURN-TYPE,
2 IT_RETURN-ID,
22 IT_RETURN-NUMBER,
25 IT_RETURN-MESSAGE.
IT_RETURN-LOG_NO,
IT_RETURN-LOG_MSG_NO,
IT_RETURN-MESSAGE_V1,
IT_RETURN-MESSAGE_V2,
IT_RETURN-MESSAGE_V3,
IT_RETURN-MESSAGE_V4,
IT_RETURN-PARAMETER,
IT_RETURN-ROW,
IT_RETURN-FIELD,
IT_RETURN-SYSTEM.
ENDLOOP.
thanks
sanjeevActually your COMMIT call not at all executed.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
The sy-subrc = 0 after the BAPI executed, the right way is after BAPI call check the bapi RETURN table has any error, if not commit the BAPI otherwise rollback. -
Error while creating material thru MM01
when i try to create material with accounting and costing views , i am not able to save the material
i get an error message saying
" no cost estimate number could be assigned"
the explanation in help for this is
"If you create accounting data or costing data for a material for the first time, a so-called cost estimate number for the material is assigned by the system.
However, no such number could be assigned for this material."
any ideas on solving this problem
Regards
MangeshHi Mangesh,
Is the material you are dealing with related to REM?
Can you also type in the error message number.
Regards,
Prasobh -
Same material with Different qualities
Dear Experts,
Please give me the solution for mentioned issue ....
I have to maintain the same material which has different qualities (grades) and according to these qualities, the material rate is different. i have near about 50 different qualities for the same material and 50 different rates.
My every vendor is supplying this material for 50 different qualities and rates. So in this case to maintain the individual material prices is big challenge.
If i will maintain Info records, i have to maintain 200000 info record. and also there is possibility of price change for every three months.
So please give me any other alternative solution for the problem.Hi Vijay,
Variant Configuration may work in your case. I collected some links, please go thru the links:
http://help.sap.com/saphelp_47x200/helpdata/en/92/58d455417011d189ec0000e81ddfac/plain.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/LOVC/LOVC.pdf
http://sap-img.com/sap-sd/steps-for-sd-variant-configuration.htm
http://www.slideshare.net/arun_bala1/variant-configuration-overview
http://www.sap-topjobs.com/VARCONFG%5B1%5D.pdf
Purchasing:-
1. MATERIAL MASTER
Create Material with material type as HALB Transaction code MM01
Enter Material code as ZMAL.
Select the following views Basic data1, Basic data2, Purchasing, MRP1, Storage1, Storage2, Accounting1, Accounting2, Costing1, Costing2.
Basic Data1 Select General Item Category Group as 0002
Basic Data2 Activate the field Material Configurable
Remaining fields data is as applicable.
2. VENDOR MASTER
Create Vendor Master Transaction code XK01
Enter Vendor code as ZVEN
3. Classification Characteristics
Create Characteristics Transaction code CT04
Characteristics created as
i) ZMALCOLOURRED after entering the description click on the tab Addnl data & then fill up the data in Table name = MMCOM & Field name = VKOND then save the characteristic.
ii) ZMALCOLOURBLUE enter the description & save the data, do not enter any data on Addnl data tab strip.
Save the data
4. Classification
Create Class as ZMALCLASS Transaction code CL01
Class as ZMALCLASS, Class Type as 300
Assign the above two characteristics ZMALCOLOURRED & ZMALCOLOURBLUE to class ZMALCLASS.
Save the data
5. Configuration Profile
Create Configuration Profile Transaction code CU41
Enter the material code as ZMAL,
on the next screen enter Priority 10, Profile Name ZMALPROFILE, Class 300. Select the line & click on the push button Class Assignment, assign the class ZMALCLASS come back to main screen
Select the profile line item & click on the Profile Detail
then click on the push button dependency assignment
on the screen input dependency as ZMALDEPENDANCY &
then click on the push button Dependency editor
input the syntax as
$self.ZMALCOLOURRED = 'RED' IF ZMALCOLOURBLUE = 'BLUE'
save data
6. Pricing Procedure ( SPRO )
Pricing condition types like VA00 - Variants/Quantity & VA01 Variants % is included in the pricing procedure with following settings
Sr. No. DATA VA00 CONDITION VA01 CONDITION
Control Data 1
Condition Class A A
Calculate Type C A
Condition Category O O
Changes can be made
Manual Entries C C
Item Condition Active Active
Delete Active Active
Amount / Percent Active Active
Scales
Scale Basis C C
Control Data 2
Variant Condition Active Active
Access Sequence Variants Variants
These conditions will appear in the pricing when variant configuration is made active in vendor Info Record.
7. Vendor Info Record
Create Vendor Info record Transaction code XK01.
Input Fields like Vendor, Material, Purchasing Organisation and Plant.
Click on the push button Variant Configuration In the pop-up window input the variant condition.
Select the line & click on push button choose the pop-up window will display the two condition VA00 & VA01, select the relevant condition, click on choose then save the data.
Input all other relevant data for creation of vendor info record
8. Purchase Order
Create Purchase Order Transaction Code ME21N.
Input all relevant like Vendor, Material, PO quantity, price etc.
Select the Material Data tab strip in Item & click on the push button configuration the characteristic of variant configuration will appear input the required value,
Go to the condition tab you will find variant configuration condition has appeared in pricing condition.
Save the purchase order.
Reg,
Ashok -
Will it make any sense to create materialized view on top of a MOLAP cube?
Hi,
We have developed few MOLAP cubes for our reporting environment.
Now we are planning to create materialized with query rewrite enabled for faster performance?
Is this a correct approach? Will it make any sense? I mean will i get any performance improvement if i create MV on top of a MOLAP cube?
Thanks and Regards,
PadmanabhAdding a rewrite MV does not change the raw performance of a cube. The only reason to add one is if you want to write your SQL queries against the base relational tables and have the database rewrite your queries against the cube. If you are able to query the cube views directly, then there is no particular benefit to a rewrite MV.
Adding a refresh-only MV does have benefits even if your queries use the cube views. A refresh-only MV tracks the staleness of the cube and lets you run 'fast' refreshes, which can be useful if you are only modifiying a handful of rows in your fact table. -
Split valuation - material with price control V
Hi,
I have created material with split valuation ,ie val category as Z (auto batch).. and i did gr. and in mm03 i have maintained the pr control as V .. and later po and gr . when i checked in MM60 its showing the parent material and the child mat ie valu types/ batch materials are also in V... it suppost to have with S.. is there any customization need to have S price control for the child/ val type materials?? pls suggestHi UJ ,
Different price control are possible for different valuation types based on Valuation category , but this doesn't hold good for Valuation Category X- Auto Batch as there are no valutaion types linked to it in Config.
Therefore system proposes the same price control as that of parent material incase of Valuation Category(X)- Auto Batch
Regards
Ramesh Ch -
About creating material problem
hi guys:
When creating a material,at last view,I get a message that 'Create basic view first'.I want to know which views are
basic views.I have choosed 'basic data1,basic data2,purchasing,MRP1,MRP2,MRP3,MRP4,Gerneral plant data /storage1 and
storage 2.
Can anybody tell me why?Thanks!
Edited by: foxconn_jerry on Jul 23, 2009 2:36 PMHi,
While creating material, you are unable to create material and save. You missed some basic data to enter. When you are creating material with MM01 t.code by entering industry sector and material type with selection organization levels, You need to select the Basic data View {Baiscdata-1 and basic data2 viewu201D} with other views as you required.
In Basic data view you need to enter like material description, Base unit of measure, Material group, Division etcu2026u2026are basic data of material master.
For more check the link:
http://www.synactive.de/docu_e/doc_multi_mm01.html
Regards,
Biju K -
Create Material Master Data with BAPI
Hi,
I don't know using of BAPI. I want using BAPI_MATERIAL_SAVEDATA bapi for creating material master data for Basic Data1, Basic Data2, Purchasing and MRP views. Does anybody can help me ?
Thank you
Good nightHi,
Please refer to the documentation below:
BAPI_MATERIAL_SAVEDATA
Short Text
Create and Change Article Master Data
Functionality
You use this method to create new material master data or to change existing material master data. The data on a material can be transferred for each call.
When creating material master data, you must transfer the material number, the material type, and the industry sector to the method. You must also enter a material description and its language.
When changing material master data, you need enter only the material number.
In the header data, you must select at least one view for which data is to be created. Depending on the view selected, you must maintain other required parameters. If you do not enter values for all of the required parameters, the method is ended with an error message.
The corresponding fields in the tables (such as CLIENTDATA) must first be supplied with data by the calling program. An indicator must also be set for each of these fields so that the data is written to the database by the method. This requires the calling program to supply the corresponding field with the indicator in a checkbox table (for example, CLIENTDATAX). Checkbox tables exist for tables that do not contain any language-dependent texts (MAKT, MLTX), International Article Numbers (MEAN), or tax classifications (MLAN). Several data records for a material can be created in these tables.
If a structure contains fields for units of measurement (such as structure CLIENTDATA, field BASE_UOM), language indicators (such as structure MATERIALDESCRIPTION, field LANGU), or country indicators (such as structure TAXCLASSIFICATIONS, field DEPCOUNTRY), there is always a field of the same name with the ending _ISO. This makes it possible to transfer either the internally used SAP code or a standardized ISO code for the units of measurement, language indicators, or country indicators. ISO codes are converted to an SAP code internally for further processing. The ISO code is used only if the SAP code is not transferred. If you use ISO codes, there must be a unique assignment of the ISO code to the SAP code in the following activities in Customizing for Global Parameters:
Check Units of Measurement
Define Countries
If you want to maintain long texts (basic data texts, internal comments, purchase order texts, material memos, or sales texts) or customer-defined fields for a material, some special conditions have to be observed. They are described in the documentation for parameters MATERIALLONGTEXT and EXTENSIONIN.
Parameters
HEADDATA
CLIENTDATA
CLIENTDATAX
PLANTDATA
PLANTDATAX
FORECASTPARAMETERS
FORECASTPARAMETERSX
PLANNINGDATA
PLANNINGDATAX
STORAGELOCATIONDATA
STORAGELOCATIONDATAX
VALUATIONDATA
VALUATIONDATAX
WAREHOUSENUMBERDATA
WAREHOUSENUMBERDATAX
SALESDATA
SALESDATAX
STORAGETYPEDATA
STORAGETYPEDATAX
FLAG_ONLINE
FLAG_CAD_CALL
NO_DEQUEUE
NO_ROLLBACK_WORK
RETURN
MATERIALDESCRIPTION
UNITSOFMEASURE
UNITSOFMEASUREX
INTERNATIONALARTNOS
MATERIALLONGTEXT
TAXCLASSIFICATIONS
RETURNMESSAGES
PRTDATA
PRTDATAX
EXTENSIONIN
EXTENSIONINX
Exceptions
Function Group
1001UEB
Thanks,
Sandeep. -
Creating a material with just the basic view using BAPI
Hi
I intend to create a new material with just the basic view using BAPI BAPI_MATERIAL_SAVEDATA -
To do this - I believe I have to fill in the structure HEADDATA data - ( mandatory ) with the required values - I fill values for fields IND_SECTOR, MATL_TYPE & basic view ( check this field ) and leave the MATERIAL field as blank (assuming internal numbering ) and then fill values of the CLIENTDATA structure with values for the basic data view.
Is this correct ? Will my material number created be returned in the RETURN structure - how do I look for the material number exclusively in my RETURN structure ?hi
good
go through this progarm which ll give you detail idea about BAPI_MATERIAL_SAVEDATA
REPORT ZBAPIMM01 LINE-SIZE 255 NO STANDARD PAGE HEADING
LINE-COUNT 065(001).
TABLES: T001L, "Storage Locations
MARA, "General Material Data
MAKT, "Material Descriptions
MBEW, "Material Valuation
MARC. "Plant Data for Material
DATA: BAPI_HEAD LIKE BAPIMATHEAD,
BAPI_MAKT LIKE BAPI_MAKT, "Material Description
BAPI_MARA1 LIKE BAPI_MARA, "Client Data
BAPI_MARAX LIKE BAPI_MARAX,
BAPI_MARC1 LIKE BAPI_MARC, "Plant View
BAPI_MARCX LIKE BAPI_MARCX,
BAPI_MBEW1 LIKE BAPI_MBEW, "Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX,
BAPI_RETURN LIKE BAPIRET2.
DATA: BEGIN OF INT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF INT_MAKT.
DATA: BEGIN OF INT_MAT OCCURS 100,
WERKS(4), "Plant
MTART(4), "Material type
MATNR(18), "Material number
MATKL(9) , "Material group
MBRSH(1), "Industry sector
MEINS(3), "Base unit of measure
GEWEI(3), "Weight Unit
SPART(2), "Division
EKGRP(3), "Purchasing group
VPRSV(1), "Price control indicator
STPRS(12), "Standard price
PEINH(3), "Price unit
SPRAS(2), "Language key
MAKTX(40), "Material description
END OF INT_MAT.
SELECT-OPTIONS:
PLANT FOR MARC-WERKS OBLIGATORY MEMORY ID PLT,
MATERIAL FOR MARA-MATNR MEMORY ID MAT,
MATLTYPE FOR MARA-MTART MEMORY ID MTY,
DIVISION FOR MARA-SPART MEMORY ID DIV.
PARAMETERS: F_FILE LIKE RLGRAP-FILENAME
DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
IF GETDATA = 'X'.
PERFORM DOWNLOAD_DATA.
PERFORM DOWNLOAD_FILE.
ENDIF.
IF UPDDATA = 'X'.
PERFORM UPLOAD_FILE.
PERFORM UPDATE_MM.
ENDIF.
FORM DOWNLOAD_DATA.
SELECT * FROM MARC WHERE LVORM EQ ' '
AND WERKS IN PLANT
AND MATNR IN MATERIAL.
CLEAR MARA.
SELECT SINGLE * FROM MARA WHERE MATNR = MARC-MATNR.
CHECK MATLTYPE.
CHECK DIVISION.
CLEAR MBEW.
SELECT SINGLE * FROM MBEW WHERE MATNR = MARC-MATNR
AND BWKEY = MARC-WERKS.
CLEAR MAKT.
SELECT SINGLE * FROM MAKT WHERE SPRAS = 'EN'
AND MATNR = MARC-MATNR.
WRITE:/ MARC-WERKS, "Plant
MARA-MTART, "Material type
MARA-MATNR, "Material number
MARA-MATKL, "Material group
MARA-MBRSH, "Industry sector
MARA-MEINS, "Base unit of measure
MARA-GEWEI, "Weight Unit
MARA-SPART, "Division
MARC-EKGRP, "Purchasing group
MBEW-VPRSV, "Price control indicator
MBEW-STPRS, "Standard price
MBEW-PEINH, "Price unit
MAKT-SPRAS, "Language key
MAKT-MAKTX. "Material description
INT_MAT-WERKS = MARC-WERKS. "Plant
INT_MAT-MTART = MARA-MTART. "Material type
INT_MAT-MATNR = MARA-MATNR. "Material number
INT_MAT-MATKL = MARA-MATKL. "Material group
INT_MAT-MBRSH = MARA-MBRSH. "Industry sector
INT_MAT-MEINS = MARA-MEINS. "Base unit of measure
INT_MAT-GEWEI = MARA-GEWEI. "Weight Unit
INT_MAT-SPART = MARA-SPART. "Division
INT_MAT-EKGRP = MARC-EKGRP. "Purchasing group
INT_MAT-VPRSV = MBEW-VPRSV. "Price control indicator
INT_MAT-STPRS = MBEW-STPRS. "Standard price
INT_MAT-PEINH = MBEW-PEINH. "Price unit
INT_MAT-SPRAS = MAKT-SPRAS. "Language key
INT_MAT-MAKTX = MAKT-MAKTX. "Material description
APPEND INT_MAT.
CLEAR INT_MAT.
ENDSELECT.
ENDFORM.
FORM DOWNLOAD_FILE.
call function 'WS_DOWNLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Download Successfully to your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPLOAD_FILE.
call function 'WS_UPLOAD'
EXPORTING
FILENAME = F_FILE
FILETYPE = 'DAT'
FILETYPE = 'WK1'
tables
data_tab = INT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
FORMAT COLOR COL_GROUP.
WRITE:/ 'Data Upload Successfully from your local harddisk'.
SKIP.
ENDIF.
ENDFORM.
FORM UPDATE_MM.
LOOP AT INT_MAT.
Header
BAPI_HEAD-MATERIAL = INT_MAT-MATNR.
BAPI_HEAD-IND_SECTOR = INT_MAT-MBRSH.
BAPI_HEAD-MATL_TYPE = INT_MAT-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
Material Description
REFRESH INT_MAKT.
INT_MAKT-LANGU = INT_MAT-SPRAS.
INT_MAKT-MATL_DESC = INT_MAT-MAKTX.
APPEND INT_MAKT.
Client Data - Basic
BAPI_MARA1-MATL_GROUP = INT_MAT-MATKL.
BAPI_MARA1-BASE_UOM = INT_MAT-MEINS.
BAPI_MARA1-UNIT_OF_WT = INT_MAT-GEWEI.
BAPI_MARA1-DIVISION = INT_MAT-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
Plant - Purchasing
BAPI_MARC1-PLANT = INT_MAT-WERKS.
BAPI_MARC1-PUR_GROUP = INT_MAT-EKGRP.
BAPI_MARCX-PLANT = INT_MAT-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
Accounting
BAPI_MBEW1-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEW1-PRICE_CTRL = INT_MAT-VPRSV.
BAPI_MBEW1-STD_PRICE = INT_MAT-STPRS.
BAPI_MBEW1-PRICE_UNIT = INT_MAT-PEINH.
BAPI_MBEWX-VAL_AREA = INT_MAT-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
WRITE:/ BAPI_HEAD, BAPI_MARC1.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA = BAPI_MVKE1
SALESDATAX = BAPI_MVKEX
STORAGETYPEDATA =
STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = INT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error Message ', BAPI_RETURN.
ENDIF.
ENDLOOP.
ENDFORM.
*---End of Program
thanks
mrutyun^
Maybe you are looking for
-
Error while explicit creating relation object
Hello all ... i am using forms6i i.e. 'Forms [32 Bit] Version 6.0.8.8.0 (Production)' on Windows NT. it is not such a big problem, but ofcource affecting work. i am modifying a form that has a master block and five child blocks, while i am trying to
-
Videos Will Not Load - 'HTTPS:' only valid workaround on certain sites
Windows 7, 32-bit Firefox 12, 32-bit Flash Player Version 11.2.202.235 I'm unable to load videos from many sites right now, and I've done everything else I can possibly think to do except ask for help here. The problem started spontaneously. Nothing
-
Hi,can anybody help me my curve has 4 flashing lights i had a look at my battery and found the bottom white sticker had turned pink and 4 red x's on it I replaced the battery with a new one but still have these 4 flashing lights also have carried ou
-
Need help to calling a form from a report
I would like to call a form from the report preview, that is there will be button on that report preview and when click on that button then another form will start running. Another problem is, without clicking on that button report will not allow to
-
If I buy my Iphone from apple for sprint will I be able to keep my current number
I will also be using an upgrade to do this can I still apply the upgrade over apples site and keep my current number?