Error in BAPI_MATERIAL_SAVEDATA - ACCOUNTING_KEYS_READ_FOR_BWKEY
Hello,
An error was occured when I use a program that transfers data form one system to another with bapi BAPI_MATERIAL_SAVEDATA.
Error is :
"Required parameters missing when calling up module ACCOUNTING_KEYS_READ_FOR_BWKEY"
I have no idea what this message means and what the solution is..
Can you help me?
Thanks..
I have found a work around. We have a custom function that called this BAPI_MATERIAL_SAVEDATA, and in the SAP R/3 4.6 we did not pass the valuationdata and valuationdatax. I found that you have to pass these. The only field you need to pass is valu_area. Check the table T001K to see what value it should be. This corresponds to "plant" as far as I can tell. Here is some of the code= ( I only show what I had to add to populate the val_area, which is bwkey.
DATA: st_valuationdata LIKE BAPI_MBEW,
st_valuationdatax LIKE BAPI_MBEWX.
move sales_org to st_valuationdata-val_area.
move sales_org to st_valuationdatax-val_area.
I also populate other structures...but this one I only move the value
of sales_org, which happens to be the same as bwkey on our system.
commented out alot of the structures before. Because of ECC 6 upgrade,
I had to uncomment the VALUATIONDATA and VALUATIONDATAX.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = st_mat_hdr
clientdata = st_clientdata
clientdatax = st_clientdatax
maybe need to use plantdata to enter plant number...
plantdata = st_plantdata
plantdatax = st_plantdatax
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
*{ INSERT SNDK900107 2
VALUATIONDATA = st_valuationdata
VALUATIONDATAX = st_valuationdatax
*} INSERT
STORAGELOCATIONDATAX =
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
salesdata = st_salesdata
salesdatax = st_salesdatax
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
IMPORTING
return = st_bapi_return
TABLES
materialdescription = tbl_mat_desc
unitsofmeasure = tbl_unitsofmeasure
unitsofmeasurex = tbl_unitsofmeasurex
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
taxclassifications = tbl_taxclassifications.
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
Now it works....So something has changed with the upgrade to make it
necessary to at least pass the plant in the valuationdata, and the valuationdatax
structures.
Chris Mason
Similar Messages
-
Unit of measure error in BAPI_MATERIAL_SAVEDATA
Hi Guru's,
i am trying to upload the material master data using BAPI...while uploading ia m getting beloow error ..please guide me anyone you..where i am doing mistake.....
1st this error i am getting while executing:
internal unit HR ,language EN is not maintained.
and afetr execution in gs_return i am getting below error:
Unit of measure ****** is not defined; check your entry
error number :490
dont get tence for code and all the values ae moving properly into BAPI...and
here i am consider the unit of mesure as HR (hour)..
here i am caliculating like ex: for employe (material) generating bill in hour basis.that is per 1hour $100.
please let me know if my question is not clear..
thanks in advance and will full points to reply....
*& Report ZERP_MATERIAL_CREATE_UPLOAD
REPORT zerp_material_create_upload.
DATA:gs_bapimathead TYPE bapimathead,
gs_clientdata TYPE bapi_mara,
gs_clientdatax TYPE bapi_marax,
gs_plantdata TYPE bapi_marc,
gs_plantdatax TYPE bapi_marcx,
gs_forecastparameters TYPE bapi_mpop,
gs_forecastparametersx TYPE bapi_mpopx,
gs_valuationdata TYPE bapi_mbew,
gs_valuationdatax TYPE bapi_mbewx,
gs_salesdata TYPE bapi_mvke,
gs_salesdatax TYPE bapi_mvkex,
gs_storagelocationdata TYPE bapi_mard,
gs_storagelocationdatax TYPE bapi_mardx,
gt_materialdescription TYPE STANDARD TABLE OF bapi_makt,
gwa_materialdescription TYPE bapi_makt,
gt_taxclassifications TYPE STANDARD TABLE OF bapi_mlan,
gwa_taxclassifications TYPE bapi_mlan,
gt_prtdata TYPE STANDARD TABLE OF bapi_mfhm,
gwa_prtdata TYPE bapi_mfhm,
gt_prtdatax TYPE STANDARD TABLE OF bapi_mfhmx,
gwa_prtdatax TYPE bapi_mfhmx,
gt_unitsofmeasure TYPE STANDARD TABLE OF bapi_marm,
gwa_unitsofmeasure TYPE bapi_marm,
gt_unitsofmeasurex TYPE STANDARD TABLE OF bapi_marmx,
gwa_unitsofmeasurex TYPE bapi_marmx,
gs_return TYPE bapiret2.
TYPES:BEGIN OF gty_itab1,
matnr(18), "material
mbrsh(1), "industry sector
mtart(4), "material type
vkorg(4), "sales org
vtweg(2), "distr chan
kondm(2), "mat prcing grp
ktgrm(2), "acc asgn grp
dwerk(4), "plant
meins(3), "base uom
tragr(4), "tarns grp
matkl(9), "mat grp
spart(2), "division
ntgew(13), "net weight
gewei(3), "weight unit
werks(4), "plant
ladgr(4), "loading grp
dismm(2), "mrp type
mtvfp(2), "available check
disgr(4), "mrp grp
dispo(3), "mrp controller
beskz(1), "procurement type
prmod(1), "forecasting mode
bklas(4), "valution class
stprs(11), "std price
vprsv(1), "price control
peinh(5), "price unit
lgort(4), "storage location
maktx(40), "mat description
taxkm(1), "tax class
planv(3), "task list usage
brgew(13), "gross weight
mtpos(4), "gen it gross grp
END OF gty_itab1.
DATA:gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES:BEGIN OF gty_itab2,
abc(178),
END OF gty_itab2.
DATA:gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
PARAMETERS:p_files TYPE string.
*START-OF-SELECTION.
START-OF-SELECTION.
*using call method uploading CSV file into internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_files
filetype = 'ASC'
TABLES
data_tab = gt_itab2
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.
LOOP AT gt_itab2 INTO gwa_itab2.
gwa_itab1 = gwa_itab2-abc(178).
APPEND gwa_itab1 TO gt_itab1.
ENDLOOP.
LOOP AT gt_itab1 INTO gwa_itab1.
SPLIT gwa_itab1 AT ',' INTO
gwa_itab1-matnr
gwa_itab1-mbrsh
gwa_itab1-mtart
gwa_itab1-vkorg
gwa_itab1-vtweg
gwa_itab1-kondm
gwa_itab1-ktgrm
gwa_itab1-dwerk
gwa_itab1-meins
gwa_itab1-tragr
gwa_itab1-matkl
gwa_itab1-spart
gwa_itab1-ntgew
gwa_itab1-gewei
gwa_itab1-werks
gwa_itab1-ladgr
gwa_itab1-dismm
gwa_itab1-mtvfp
gwa_itab1-disgr
gwa_itab1-dispo
gwa_itab1-beskz
gwa_itab1-prmod
gwa_itab1-bklas
gwa_itab1-stprs
gwa_itab1-vprsv
gwa_itab1-peinh
gwa_itab1-lgort
gwa_itab1-maktx
gwa_itab1-taxkm
gwa_itab1-planv
gwa_itab1-brgew
gwa_itab1-mtpos.
*header data
gs_bapimathead-material = gwa_itab1-matnr.
gs_bapimathead-ind_sector = gwa_itab1-mbrsh.
gs_bapimathead-matl_type = gwa_itab1-mtart.
gs_bapimathead-basic_view = 'X'.
gs_bapimathead-sales_view = 'X'.
gs_bapimathead-purchase_view = 'X'.
gs_bapimathead-mrp_view = 'X'.
gs_bapimathead-storage_view = 'X'.
gs_bapimathead-account_view = 'X'.
gs_bapimathead-cost_view = 'X'.
*sales data
gs_salesdata-sales_org = gwa_itab1-vkorg.
gs_salesdatax-sales_org = '8888'. "'X'.
gs_salesdata-distr_chan = gwa_itab1-vtweg.
gs_salesdatax-distr_chan = '88'. "'X'.
gs_salesdata-mat_pr_grp = gwa_itab1-kondm.
gs_salesdatax-mat_pr_grp = 'X'.
gs_salesdata-acct_assgt = gwa_itab1-ktgrm.
gs_salesdatax-acct_assgt = 'X'.
gs_salesdata-delyg_plnt = gwa_itab1-dwerk.
gs_salesdatax-delyg_plnt = 'X'.
*client data
gs_clientdata-base_uom = 'HR '. "gwa_itab1-meins.
gs_clientdatax-base_uom = 'X'.
gs_clientdata-trans_grp = gwa_itab1-tragr.
gs_clientdatax-trans_grp = 'X'.
gs_clientdata-matl_group = gwa_itab1-matkl.
gs_clientdatax-matl_group = 'X'.
gs_clientdata-division = gwa_itab1-spart.
gs_clientdatax-division = 'X'.
gs_clientdata-net_weight = gwa_itab1-ntgew.
gs_clientdatax-net_weight = 'X'.
gs_clientdata-unit_of_wt = gwa_itab1-gewei.
gs_clientdatax-unit_of_wt = 'X'.
gs_clientdata-item_cat = gwa_itab1-mtpos.
gs_clientdatax-item_cat = 'X'.
*Plant data
gs_plantdata-plant = '8888'. "gwa_itab1-werks.
gs_plantdatax-plant = '8888'. "'X'.
gs_plantdata-loadinggrp = gwa_itab1-ladgr.
gs_plantdatax-loadinggrp = 'X'.
gs_plantdata-mrp_type = gwa_itab1-dismm.
gs_plantdatax-mrp_type = 'X'.
gs_plantdata-availcheck = gwa_itab1-mtvfp.
gs_plantdatax-availcheck = 'X'.
gs_plantdata-mrp_group = gwa_itab1-disgr.
gs_plantdatax-mrp_group = 'X'.
gs_plantdata-mrp_ctrler = gwa_itab1-dispo.
gs_plantdatax-mrp_ctrler = 'X'.
gs_plantdata-proc_type = gwa_itab1-beskz.
gs_plantdatax-proc_type = 'X'.
gs_plantdata-period_ind = 'M'. "HARD CODED FOR PERKZ peroid indicator
gs_plantdatax-period_ind = 'X'.
gs_plantdata-inhseprodt = '0'. "hard coded for DZEIT inhouse production
gs_plantdatax-inhseprodt = 'X'.
*forecast parameeters
gs_forecastparameters-plant = '8888'. "gwa_itab1-prmod.
gs_forecastparametersx-plant = '8888'. "'X'.
gs_forecastparameters-fore_model = gwa_itab1-prmod.
gs_forecastparametersx-fore_model = 'X'.
*valution data
gs_valuationdata-val_area = '8888'. "gwa_itab1-bklas.
gs_valuationdatax-val_area = '8888'. "'X'.
gs_valuationdata-val_class = gwa_itab1-bklas.
gs_valuationdatax-val_class = 'X'.
gs_valuationdata-std_price = gwa_itab1-stprs.
gs_valuationdatax-std_price = 'X'.
gs_valuationdata-price_ctrl = gwa_itab1-vprsv.
gs_valuationdatax-price_ctrl = 'X'.
gs_valuationdata-price_unit = gwa_itab1-peinh.
gs_valuationdatax-price_unit = 'X'.
*storage location dat
gs_storagelocationdata-plant = '8888'. "gwa_itab1-lgort.
gs_storagelocationdatax-plant = '8888'. "'X'.
gs_storagelocationdata-stge_loc = gwa_itab1-lgort.
gs_storagelocationdatax-stge_loc = '8888'. "'X'.
*material discription
gwa_materialdescription-langu = 'E'.
gwa_materialdescription-matl_desc = gwa_itab1-maktx.
*tax classification
gwa_taxclassifications-taxclass_1 = gwa_itab1-taxkm.
gwa_taxclassifications-depcountry = 'US '. "HARD CODE FOR TAX
*prt data
gwa_prtdata-plant = '8888'. "gwa_itab1-planv.
gwa_prtdatax-plant = '8888'. "'X'.
gwa_prtdata-prt_usage = gwa_itab1-planv.
gwa_prtdatax-prt_usage = 'X'.
*unitsof measure
gwa_unitsofmeasure-alt_unit = 'HR '. "gwa_itab1-brgew.
gwa_unitsofmeasurex-alt_unit = 'HR '. "'X'.
gwa_unitsofmeasure-unit_of_wt = 'KG'. "gwa_itab1-brgew.
gwa_unitsofmeasurex-unit_of_wt = 'X'.
gwa_unitsofmeasurex-sub_uom = 'X'.
gwa_unitsofmeasure-gross_wt = gwa_itab1-brgew.
gwa_unitsofmeasurex-gross_wt = 'X'.
*appending workarea to table's
APPEND gwa_materialdescription TO gt_materialdescription.
APPEND gwa_taxclassifications TO gt_taxclassifications.
APPEND gwa_prtdata TO gt_prtdata.
APPEND gwa_prtdatax TO gt_prtdatax.
APPEND gwa_unitsofmeasure TO gt_unitsofmeasure.
APPEND gwa_unitsofmeasurex TO gt_unitsofmeasurex.
*calling FM BAPI for uploading the Material master data
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = gs_bapimathead
clientdata = gs_clientdata
clientdatax = gs_clientdatax
plantdata = gs_plantdata
plantdatax = gs_plantdatax
forecastparameters = gs_forecastparameters
forecastparametersx = gs_forecastparametersx
valuationdata = gs_valuationdata
valuationdatax = gs_valuationdatax
salesdata = gs_salesdata
salesdatax = gs_salesdatax
IMPORTING
return = gs_return
TABLES
materialdescription = gt_materialdescription
unitsofmeasure = gt_unitsofmeasure
unitsofmeasurex = gt_unitsofmeasurex
taxclassifications = gt_taxclassifications
prtdata = gt_prtdata
prtdatax = gt_prtdatax.
Check the return table.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / 'Error occured while creating material'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'material',gwa_itab1-matnr,'created'.
ENDIF.
ENDLOOP.Hi Aparna..
even with HUR also i am getting same error.....
is there any changes required in the SPRO .......
i mean in BAPI had ..unitofmeasure we have around 21 fields( here extra fields is DEL FLAG)
but in unitofmeasurex has only 20 fields...
we need to anything in SPRO for avoiding DEL FLAG.....
sorry if i am confusing u.....
thanks for responce and send few more inputs for resolving the issuee.... -
Hi,
I am using the BAPI_MATERIAL_SAVEDATA to create material in the material master, I am passing
ls_bapi_head-basic_view = 'X'.
ls_bapi_head-purchase_view = 'X'.
ls_bapi_head-mrp_view = 'X'.
ls_bapi_head-storage_view = 'X'.
ls_bapi_head-quality_view = 'X'.
ls_bapi_head-account_view = 'X'.
these views, I am passing the necessary details to the BAPI . But it is giving me an error ' **Unit of measure ****** is not defined; check your entry**'. plz help me how to solv the problem.
Thanks,
shekarHi Vinod,
It was very usefull for me thanks,
I have another problem i have to pass Valuation Class - bklas and in quality view nspection Type - 'art', Inspection Type - Material Combination is Active - 'aktiv'.
please let me know how to pass these values to FM
thanks,
shekar -
Error in BAPI_MATERIAL_SAVEDATA
Hello all.
Im trying to update a material using BAPI_MATERIAL_SAVEDATA, I have to update the field PLANTDATA-VARIANCE_KEY among others.
But the BAPI returns with the following error:
<i>Key fields for user data PLANTDATA and checkbox structure PLANTDATAX are different</i>
Here is my code
LOOP AT it_data WHERE result EQ 1.
CLEAR: header, w_mbew, return, return_msg.
REFRESH: return_msg.
*- Header data
header-material = it_data-matnr.
header-cost_view = 'X'.
header-purchase_view = 'X'.
header-matl_type = it_data-mtart.
*- Valuation View
w_mbew-val_area = it_data-werks.
w_mbew-qty_struct = ' '.
w_mbew-plndprice1 = it_data-zplp1.
w_mbew-price_unit = it_data-peinh.
w_mbew-price_ctrl = it_data-vprsv.
w_mbew-std_price = it_data-stprs.
w_mbew-moving_pr = it_data-verpr.
w_mbew-plndprdate1 = p_zldp1.
w_mbewx-val_area = it_data-werks.
w_mbewx-qty_struct = 'X'.
w_mbewx-plndprice1 = 'X'.
w_mbewx-price_unit = 'X'.
w_mbewx-price_ctrl = 'X'.
w_mbewx-std_price = 'X'.
w_mbewx-moving_pr = 'X'.
w_mbewx-plndprdate1 = 'X'.
* Plant data
w_marc-plant = it_data-werks.
w_marc-variance_key = it_data-awsls.
w_marcx-plant = 'X'.
w_marcx-variance_key = 'X'.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = header
plantdata = w_marc
plantdatax = w_marcx
valuationdata = w_mbew
valuationdatax = w_mbewx
IMPORTING
return = return
TABLES
returnmessages = return_msg.
Any help will be rewarded...Please try......
* Plant data
w_marc-plant = it_data-werks.
w_marc-variance_key = it_data-awsls.
<b>w_marcx-plant = it_data-werks. </b>
w_marcx-variance_key = 'X'.
The reason is that the PLANT field in the "X" structure is not a flag field, but the 4 character plant field which needs a valid plant.
Regards,
Rich Heilman -
Error while creating a material using Bapi_material_savedata
Hi,
there is an error encountered while creating a material using BAPI_MATERIAL_SAVEDATA..
The Error description is " Material description is not transfered " even after supplying the Material description and other mandatory field information like industrial sector, material type ,basic view indicator,Base UOM,Base UOM ISO code.
Please let me know the solution, if you know.Hi,
Please search the SCN for the answers
https://www.sdn.sap.com/irj/scn/advancedsearch?query=errorinBAPI_MATERIAL_SAVEDATA+&cat=sdn_all -
Error when calling BAPI_MATERIAL_SAVEDATA
Hi all,
I'm calling BAPI_MATERIAL_SAVEDATA through a RFC. I use SAP PI to call a function module and the function module calls the BAPI like this:
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = ls_headdata
clientdata = ls_clientdata
clientdatax = ls_clientdatax
plantdata = ls_plantdata
plantdatax = ls_plantdatax
salesdata = ls_salesdata
salesdatax = ls_salesdatax
warehousenumberdata = ls_warehousenumberdata
warehousenumberdatax = ls_warehousenumberdatax
tables
materialdescription = lt_materialdescription
unitsofmeasure = lt_unitsofmeasure
unitsofmeasurex = lt_unitsofmeasurex
internationalartnos = lt_internationalartnos
taxclassifications = lt_taxclassifications
returnmessages = lt_return2.
The BAPI stops processing on the line:
UPDATE MARU FROM TABLE MARU_UPD
in function MARA_ARRAY_UPDATE.
I receive the following error message in PI Communication Channel Monitoring:
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: JCO.Exception while calling ZSD_PEPE_CAT_INBOUND in remote system (RfcClient[CC_PepeSAPSDIn]):com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Data type MARU was found in a newer version than required.: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: JCO.Exception while calling ZSD_PEPE_CAT_INBOUND in remote system (RfcClient[CC_PepeSAPSDIn]):com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Data type MARU was found in a newer version than required.
ST22 tells me this:
Runtime Error TYPELOAD_NEW_VERSION
Occurred on 11.03.2009 at 13:08:11
Data type "MARU" was found in a newer version than required.
What happened?
Runtime error
The current ABAP program, "SAPLMG21", had to be terminated because one of the
statements could not be executed at runtime.
Information on where terminated
The termination occurred in the ABAP program "SAPLMG21" in "MARA_ARRAY_UPDATE".
The main program was "SAPMSSY1 ".
The termination occurred in line 44 of the source code of the (Include)
program "LMG21U02"
of the source code of program "LMG21U02" (when calling the editor 440).
Any idea what's wrong with the data type MARU?
Thanks in advance!!
Regards,
Ivo van EeJust found out that a colleague added some append fields to the mara structure. This seems to be the cause of the problem. We still don't know how to solve the problem though....
MARA:
.APPEND ZAMARA_HFL STRU 0 0 Fashion additional article master data
ZZCOLOR ZCOLOR CHAR 3 0 Color code
ZZCOLOR_DESCR ZCOLOR_DESCR CHAR 20 0 Color code description
ZZFIT ZFIT CHAR 3 0 Fit code
ZZFIT_DESCR ZFIT_DESCR CHAR 20 0 Fit code description
ZZSIZE_SCALE ZSIZE_SCALE CHAR 1 0 Size scale
ZZSIZE_DESCR ZSIZE_DESCR CHAR 20 0 Size description
ZZSIZE_POS ZSIZE_POS NUMC 2 0 Position of Size description in matrix
ZZANALYS04 ZANALYS04 CHAR 4 0 Analysis code 04
ZZANALYS04_DESCR ZANALYS04_DESCR CHAR 20 0 Analysis code 04 description
MARU:
ZZCOLOR CHAR 3 Color code
ZZCOLOR_DESCR CHAR 20 Color code description
ZZFIT CHAR 3 Fit code
ZZFIT_DESCR CHAR 20 Fit code description
ZZSIZE_SCALE CHAR 1 Size scale
ZZSIZE_DESCR CHAR 20 Size description
ZZSIZE_POS NUMC 2 Position of Size description in matrix
ZZANALYS04 CHAR 4 Analysis code 04
ZZANALYS04_DESCR CHAR 20 Analysis code 04 description -
BAPI_MATERIAL_SAVEDATA for updating Profit center giving an error message.
Hi All,
I have a requirement to update Profit Center in storage view of Material Master. So for updating Profit Center I used BAPI_MATERIAL_SAVEDATA. In this BAPI we will pass Material number, Plant and New Profit center. When I used this it is successfully updating the MM view and in the return message its showing no authorization for this transaction. For my ID I have authorization for General Plant Data / Storage, Costing and Plant/Storage Location Stock views in Material Master Change (MM02).
I want to know why it is giving error message. Do I need to have authorization for all views in MM02 if I want to update the profit center through this BAPI?
Pointers to any other BAPI which can be used for updating Profit center in storage view in such a way that I need to have authorization for any specific view in MM02 will be helpful.Hi Shyam,
Check out the Auth object for which it is saying no authorization or
Do the changing of Profit center using the transaction and check whether it is asking for Authorization object or not.
Reward Points if it is helpful.
Regards,
Kiran I -
ERROR while calling BAPI_MATERIAL_SAVEDATA
Hi Guys,
i'm trying to create Manufacturer part number for a material by using BAPI_MATERIAL_SAVEDATA.
In my return i'm getting the error as "<b>Manufacturer part number management not set for your firm's own material</b>"
I have created the material earlier using BAPI_MATERIAL_SAVEDATA itself. Should I have given some extra parameter for this material to be enabled for Manufacturer part number management ??
Kindly help me on this guys
Thanks
VarunHi Varun !
Try this:
Check the defined length of the input parameters you are filling and pad them accordingly...for e.g. if MATERIAL has a length of 18 chars, pad the material number with "0"...material number = 1234 => "00000000000001234" (14 zeros + "1234").
From the SE37 it is not necesary, but in some cases from XI, you should pad the numbers.
Regards,
Matias. -
Error Profit center doesnot exist in BAPI_MATERIAL_SAVEDATA
Dear Experts,
I am using BAPI_MATERIAL_SAVEDATA to create material using basic_view ,
sales_view
purchase_view
mrp_view
storage_view views but i am getting an error message 701 Profir center doesnot exist. Can you say me what parameter i am missing. I am passing the profit center in BAPI_MARC parameter of bapi and the corresponding profit center actually exists. when i craete manually no such error comes.keep an eye at the profit center number. you may have to add leading zeros.
-
BAPI_MATERIAL_SAVEDATA - Error when i try to create a new material
Hi.
When I try to create a new material with bapi BAPI_MATERIAL_SAVEDATA, This function return following error :
M3 - 262 - Enter a material number.
I understand that is obligatory to fill this field to create a material, but i need that the system give an automatic material number .
Is this posible with this bapi, or I need other function ?
thanks.Hello
Control will be at the Material type level.
We will define whether the number range for Material type is internal (automatic assignment) or External.
If it is set as External, we need to input the Material numebr externally.
Please check your material type selection and number range for the same during the BAPI execution.
More info :
Define Number Ranges for Each Material Type
In this step, you define the type of number assignment and the number range intervals for material master records. When creating a material master record, you must assign it a unique number. There are two ways of doing this:
internal number assignment
In this case, a number within the number range interval allowed is assigned by the SAP system.
external number assignment
Here, the user assigns a number within the number range interval allowed. You can define the intervals for external number assignment numerically and alphanumerically.
You define the number range intervals for so-called groups. You assign one or more material types to each group.
If you assign just one material type to a group, you can define both an internal and an external number range interval for the material type.
Recommendation
SAP recommends using internal number assignment. Since you can use matchcodes to select materials according to any desired criteria, it is not normally necessary to use a mnemonic external number.
However, external number assignment can be advantageous if you want to use your materials in other systems outside the SAP system. However, the field Old material number and a matchcode are also available as standard for this purpose.
Actions
1. Assign each material type to a group. Remember that you can also group together more than one material type.
2. Define the number range intervals for each group.
warm regards
Ramakrishna. -
/SAPMP/BAPI_MATERIAL_SAVEDATA return error
Hi to All,
I'm using the BAPI /SAPMP/BAPI_MATERIAL_SAVEDATA but return the following error:
"Material number xxxxxxxxx" does not exist on the database
Have you idea?
Please, help me.
Thanks & Regards,
UmbertoHi,
Are you passing material number as it is to function module.
For example if material number is '12345' then if you pass this as it is then you may encounter with such error. Material length is 18, you should pass 18 lenth material number to BAPI, like, 000000000000012345.
Use conversion exit before passing material number to BAPI.
DATA : V_MATNR TYPE MATNR.
V_MATNR = '12345'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = V_MATNR.
IMPORTING
OUTPUT = V_MATNR.
Then pass this V_MATNR to BAPI. -
Hello ,
While using the BAPI 'BAPI_MATERIAL_SAVEDATA', to extend material from one plant to another my code is throwing an error 'Currency initial v,current amount 6,000.0000 in MOVING_PR was transferred without a currency'
Enter a material number'
I have incorporated mbew-peinh, even then its throwing the same error.
I snd copy of my code.
report zmm_r018 .
*& Prog to copy n create the existing material using bapi .
tables: t001l, "Storage Locations
mara, "General Material Data
makt, "Material Descriptions
mbew, "Material Valuation
marc, "Plant Data for Material
mltx. "Purchase Order Descriptions
**parameters : new_mat like mara-matnr,
desc like makt-maktx,
*data: ref_mat like mara-matnr.
*data: xmara type mara.
**data: wamatnr like mara-matnr.
data: potext type string."Purchase Order Desc
data : ihead_data type bapimathead,
iclient_data type bapi_mara, "Client Data
iclient_datax type bapi_marax,
imakt like bapi_makt, "Mat Description
iplant_data like bapi_marc, "Plant View
iplant_datax like bapi_marcx,
iltxt type table of bapi_mltx with header line, "Pur Order Text
istoragelocationdata type bapi_mard, "Storage Location
istoragelocationdatax type bapi_mardx,
iaccounting_data like bapi_mbew, "Accounting View
iaccounting_datax like bapi_mbewx,
bapiret like bapiret2,
returnm type table of bapi_matreturn2 with header line.
**Internal Table to hold the records in the text file
types:begin of it,
matnr(18), " Material number
mbrsh(1), " Industry sector
mtart(4), " Material type
werks(4), " Plant
lgort_d(4), "Storage Location
maktx(40), " Material description
meins(3), " Base unit of measure
matkl(9) , " Material group
bismt(18), " Old Material number
spart(2), " Division
gewei(3), " Weight Unit
text1(30), " Purchasr Order Text
text2(30),
text3(30),
text4(30),
text5(30),
text6(30),
dzeinr(22), " Document
ekgrp(3), " Purchasing group
ekwsl(4), " Purchase Value Key
webaz(3), " Goods receipt processing time in days
dismm(2), " MRP Type
minbe(13), "Reorder point
dispo(3), " MRP Controller
disls(2), "Lot size (materials planning)
mabst(13), "Maximum stock level
plifz(3), " Planned delivery time in days
webaz1(3), " Goods receipt processing time in days
fhori(3), "Scheduling Margin Key for Floats
eisbe(13), "Safety stock
mtvfp(2), "Checking Group for Availability Check
lgpbe(10), "Storage Bin
qmatauth(6),"Material Authorization Group for Activities in QM
qmpur(1), " QM in Procurement is Active
qsspur(8), "Control Key for Quality Management in Procurement
bklas(4), " Valuation Class
bwtty_d(1), "Valuation Category
vprsv(1), " Price control indicator
verpr_bapi(23), "Moving average price/periodic unit price
peinh(5), "Price Unit
end of it.
data: it_data type table of it,
wa_data like line of it_data.
*Decalraing flag
data: v_flag value ''.
*DECLARING WORK AREAs TO BE PASSED TO THE FUNCTION MODULE.
data: bapi_head like bapimathead,
bapi_clientdata like bapi_mara,
bapi_clientdatax like bapi_marax,
bapi_plantdata like bapi_marc,
bapi_plantdatax like bapi_marcx,
bapi_storagelocationdata like bapi_mard,
bapi_storagelocationdatax like bapi_mardx,
bapi_salesdata like bapi_mvke,
bapi_salesdatax like bapi_mvkex,
bapi_makt like bapi_makt,
bapi_return like bapiret2.
*INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION
data: begin of it_makt occurs 0.
include structure bapi_makt.
data end of it_makt.
data:begin of it_ret occurs 0.
include structure bapiret2.
data end of it_ret.
*INTERNAL TABLE TO HOLD HEADER DATA
data: it_excel type alsmex_tabline occurs 0 with header line.
*SELECTION-SCREEN ELEMENTS
selection-screen begin of block b1 with frame title text-001.
parameter: fname type rlgrap-filename default 'c:\supplies.xls'.
parameters: p_begcol type i default '1' no-display,
p_begrow type i default '2' no-display,
p_endcol type i default '200' no-display,
p_endrow type i default '2500' no-display.
*perform f_get_data.
selection-screen end of block b1.
*DECLARATION OF EXCELAL TABLE
at selection-screen on value-request for fname.
perform f_get_file using fname.
start-of-selection.
perform f_xls_itab using fname
changing it_excel.
perform f_move_data.
perform f_get_data.
perform f_call_bapi.
*& Form F_GET_FILE
text
-->P_FNAME text
<--P_SY_SUBRC text
form f_get_file using p_fname like fname.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
changing
file_name = p_fname
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
if sy-subrc <> 0.
message e006(zhnc).
endif.
endform. " F_GET_FILE
*& Form F_XLS_ITAB
text
-->P_FNAME text
<--P_IT_EXCEL text
form f_xls_itab using p_fname
changing p_it_excel.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = 'c:\supplies.xls'
i_begin_col = p_begcol
i_begin_row = p_begrow
i_end_col = p_endcol
i_end_row = p_endrow
tables
intern = it_excel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " F_XLS_ITAB
*& Form F_MOVE_DATA
text
--> p1 text
<-- p2 text
form f_move_data .
data : lv_index type i.
field-symbols <fs>.
*--- Sorting the internal table
sort it_excel by row col.
clear it_excel.
loop at it_excel.
move it_excel-col to lv_index.
*--- Assigning the each record to an internal table row
assign component lv_index of structure wa_data to <fs>.
*--- Asigning the field value to a field symbol
move it_excel-value to <fs>.
at end of row.
append wa_data to it_data.
clear wa_data.
endat.
endloop.
endform. " F_MOVE_DATA
form f_get_data .
loop at it_data into wa_data.
move-corresponding wa_data to ihead_data.
Header
ihead_data-material = wa_data-matnr.
ihead_data-ind_sector = wa_data-mbrsh.
ihead_data-matl_type = wa_data-mtart.
ihead_data-basic_view = 'X'.
ihead_data-purchase_view = 'X'.
ihead_data-mrp_view = 'X'.
ihead_data-storage_view = 'X'.
ihead_data-quality_view = 'X'.
ihead_data-account_view = 'X'.
move-corresponding wa_data to iclient_data.
Material Description
refresh it_makt.
it_makt-langu = 'EN'.
it_makt-matl_desc = wa_data-maktx.
append it_makt.
Purchase Order Description
clear:iltxt,iltxt[].
concatenate wa_data-text1 wa_data-text2 wa_data-text3 wa_data-text4
wa_data-text5 wa_data-text6 into potext
separated by space.
iltxt-applobject = 'MATERIAL'.
iltxt-text_name = wa_data-matnr.
iltxt-text_id = 'BEST'.
iltxt-langu = sy-langu.
iltxt-langu_iso = 'EN'.
iltxt-format_col = space.
iltxt-text_line = potext.
append iltxt.
Client Data - Basic
iclient_data-matl_group = wa_data-matkl.
iclient_data-old_mat_no = wa_data-bismt.
iclient_data-base_uom = wa_data-meins.
iclient_data-document = wa_data-dzeinr.
iclient_data-unit_of_wt = wa_data-gewei.
iclient_data-division = wa_data-spart.
iclient_data-qm_procmnt = wa_data-qmpur.
iclient_data-pur_valkey = wa_data-ekwsl.
iclient_datax-matl_group = 'X'.
iclient_datax-old_mat_no = 'X'.
iclient_datax-base_uom = 'X'.
iclient_datax-po_unit = 'X'.
iclient_datax-document = 'X'.
iclient_datax-unit_of_wt = 'X'.
iclient_datax-division = 'X'.
iclient_datax-var_ord_un = 'X'.
iclient_data-pur_valkey = 'X'.
move-corresponding wa_data to iplant_data.
Plant - Purchasing
iplant_data-plant = wa_data-werks.
iplant_data-pur_group = wa_data-ekgrp.
iplant_data-gr_pr_time = wa_data-webaz.
iplant_datax-plant = wa_data-werks.
iplant_data-pur_group = 'X'.
iplant_datax-gr_pr_time = 'X'.
*MRP1 View
iplant_data-mrp_type = wa_data-dismm.
iplant_data-reorder_pt = wa_data-minbe.
iplant_data-mrp_ctrler = wa_data-dispo.
iplant_data-lotsizekey = wa_data-disls.
iplant_data-max_stock = wa_data-mabst .
iplant_datax-mrp_type = 'X'.
iplant_datax-reorder_pt = 'X'.
iplant_datax-mrp_ctrler = 'X'.
iplant_datax-lotsizekey = 'X'.
iplant_datax-max_stock = 'X'.
*MRP2 View
iplant_data-plnd_delry = wa_data-plifz.
iplant_data-sm_key = wa_data-fhori.
iplant_data-ctrl_key = wa_data-qsspur.
iplant_data-availcheck = wa_data-mtvfp.
iplant_datax-plnd_delry = 'X'.
iplant_datax-sm_key = 'X'.
iplant_data-ctrl_key = 'X'.
iplant_datax-availcheck = 'X'.
*MRP3 View
iplant_data-safety_stk = wa_data-eisbe.
iplant_data-qm_authgrp = wa_data-qmatauth.
iplant_datax-safety_stk = 'X'.
iplant_data-qm_authgrp = 'X'.
move-corresponding wa_data to istoragelocationdata.
Storage View
istoragelocationdata-plant = wa_data-werks.
istoragelocationdata-stge_loc = wa_data-lgort_d.
istoragelocationdata-stge_bin = wa_data-lgpbe.
istoragelocationdatax-plant = wa_data-werks.
istoragelocationdatax-stge_loc = wa_data-lgort_d.
istoragelocationdatax-stge_bin = 'X'.
Accounting
iaccounting_data-val_area = wa_data-werks.
iaccounting_data-price_ctrl = wa_data-vprsv.
iaccounting_data-moving_pr = wa_data-verpr_bapi.
iaccounting_data-price_unit = wa_data-peinh.
iaccounting_data-val_class = wa_data-bklas.
iaccounting_data-val_cat = wa_data-bwtty_d.
iaccounting_datax-val_area = wa_data-werks.
iaccounting_datax-price_ctrl = 'X'.
iaccounting_datax-moving_pr = 'X'.
iaccounting_datax-price_unit = 'X'.
iaccounting_datax-val_class = 'X'.
iaccounting_datax-val_cat = 'X'.
clear it_ret.
refresh it_ret.
perform f_call_bapi.
read table it_ret with key type = 'S'.
if sy-subrc eq 0.
perform f_bapi_commit.
write:/ 'MATERIAL CREATED OR UPDATED SUCESSFULLY WITH MATERIAL NO',
wa_data-matnr.
else.
*message e000(zhnc) with 'ERROR IN CREATING THE MATERIAL'.
*WRITE: / 'ERROR IN CREATIN MATERIAL',IT_RET-MESSAGE.
*PERFORM F_DOWNLOAD.
endif.
*ENDIF.
endloop.
endform. " F_GET_DATA
*& Form F_CALL_BAPI
text
--> p1 text
<-- p2 text
form f_call_bapi .
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = ihead_data
clientdata = iclient_data
clientdatax = iclient_datax
plantdata = iplant_data
plantdatax = iplant_datax
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
storagelocationdata = istoragelocationdata
storagelocationdatax = istoragelocationdatax
valuationdata = iaccounting_data
valuationdatax = iaccounting_datax
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA = istoragelocationdata
STORAGETYPEDATAX = istoragelocationdatax
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
NO_DEQUEUE = ' '
NO_ROLLBACK_WORK = ' '
importing
return = it_ret
tables
materialdescription = it_makt
UNITSOFMEASURE = it_uom
UNITSOFMEASUREX = it_uomx
INTERNATIONALARTNOS =
materiallongtext = iltxt
TAXCLASSIFICATIONS =
returnmessages = returnm.
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
append it_ret.
write: it_ret-message .
endform. " F_CALL_BAPI
*& Form F_BAPI_COMMIT
text
--> p1 text
<-- p2 text
form f_bapi_commit .
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
endform. " F_BAPI_COMMIT
Plz suggest some solution.
Best Regards,
RaviHi,
Insert Material number in the MAKT(Material Description table).
Also, check if the material number is missing somewhere else...
Regards,
Kunjal -
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. -
BAPI_MATERIAL_SAVEDATA not updating the materials
Hi Folks,
I am trying using the BAPI_MATERIAL_SAVEDATA to change the MRP Type of the existing articles. Basically to mass update the articles.I am passing the Material only to the BAPIMATHEAD parameter and also populating the BAPI_MARC where the MRP type has to be changed and I also populate the corresponding BAPI_MARCX with 'X' that has to be changed to the Function Module. I could find when debugging the error message E 091 MH 'You must use retail functions to process the article' that is generated from another function module MATERIAL_MAINTAIN_DARK 'within BAPI_MATERIAL_SAVEDATA. I am using the FM as given below.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = i_bapimathead
CLIENTDATA = i_bapimara
CLIENTDATAX = i_bapimarax
PLANTDATA = i_bapimarc
PLANTDATAX = i_bapimarcx
IMPORTING
RETURN = i_bapireturn.
TABLES
MATERIALDESCRIPTION =
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA = i_BAPIHM
PRTDATAX = i_BAPIHMX.
EXTENSIONIN =
EXTENSIONINX =
Please help me understand if I have missed anything as why I am getting this error message. Many thanks.
Regards,
TimREPORT Z_NEW_PROGRAM .
* STRUCTURE DECLARATIONS *
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 =
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.
are you using this bapi BAPI_TRANSACTION_COMMIT,
after calling the BAPI_MATERIAL_SAVEDATA .
if not use that and check it.
thanks
vijay -
Problem in using BAPI_MATERIAL_SAVEDATA
I want to extend a Material from Plant A to Plant B. I am getting the following error.
E MM 360 Key fields for user data PLANTDATA and checkbox structure PLANTDATAX are different
Please correct in the following code
data: la_headdata type BAPIMATHEAD,
la_clientdata type BAPI_MARA,
la_CLIENTDATAX type BAPI_MARAX,
la_PLANTDATA type BAPI_marc, "Plant View
la_PLANTDATAX type bapi_marcx, "Plant View
la_mbew type bapi_mbew, "Accounting View
la_mbewx type bapi_mbewx.
*la_return type BAPIRET2.
*to return messages
DATA:BEGIN OF la_RETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA:END OF la_RETURN.
data: i_materialdescription type table of BAPI_MAKT,
wa_mat_desc like line of i_materialdescription.
Header
la_headdata-MATERIAL = '000001000000004000'.
la_headdata-IND_SECTOR = 'M'.
la_headdata-MATL_TYPE = 'ZALB'.
la_headdata-basic_view = 'X'.
la_headdata-purchase_view = 'X'.
la_headdata-account_view = 'X'.
la_headdata-MRP_VIEW = 'X'.
la_headdata-STORAGE_VIEW = 'X'.
la_headdata-COST_VIEW = 'X'.
Client Data - Basic
la_clientdata-BASE_UOM = 'EA'.
la_CLIENTDATAX-BASE_UOM = 'X'.
la_clientdata-MATL_GROUP = '21001000'.
la_CLIENTDATAX-MATL_GROUP = 'X'.
la_clientdata-unit_of_wt = 'KG'.
la_clientdatax-unit_of_wt = 'X'.
la_clientdata-division = '10'.
la_clientdatax-division = 'X'.
Material Description
wa_mat_desc-langu = 'E'.
wa_mat_desc-MATL_DESC = '+TLA,FILTER KIT,BUNDLE B'.
append wa_mat_desc to i_materialdescription.
clear: wa_mat_desc.
Plant - Purchasing
la_PLANTDATA-plant = '5530'.
la_PLANTDATAX-plant = 'X'.
la_PLANTDATA-pur_group = '006'.
la_PLANTDATAX-pur_group = 'X'.
Accounting
la_mbew-val_area = '5530'.
la_mbewx-val_area = 'X'.
la_mbew-price_ctrl = 'S'.
la_mbewx-price_ctrl = 'X'.
la_mbew-std_price = '0.01'.
la_mbewx-std_price = 'X'.
*la_mbew-price_unit = '1.000'.
*la_mbewx-price_unit = 'X'.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = la_headdata
CLIENTDATA = la_clientdata
CLIENTDATAX = la_CLIENTDATAX
PLANTDATA = la_PLANTDATA
PLANTDATAX = la_PLANTDATAX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA = la_mbew
VALUATIONDATAX = la_mbewx
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
RETURN = la_return
TABLES
MATERIALDESCRIPTION = i_materialdescription
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
read table la_return with key TYPE = 'S'.
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
endif.
WRITE:/ la_RETURN-TYPE,
2 la_RETURN-ID,
22 la_RETURN-NUMBER,
25 la_RETURN-MESSAGE.Hi,
hope this code gives you an idea
*& Report ZKAR_MATMAS_BAPI
*& This program demonstrates how easy it is to create Material master
*& data using BAPI_MATERIAL_SAVEDATA
*& The program also generates a report post-execution displaying errors
*& as well as successful uploads
REPORT ZKAR_MATMAS_BAPI.
* TABLES
* FLAGS *
DATA: F_STOP. " Flag used to stop processing
* DATA DECLARATIONS *
DATA : V_EMPTY TYPE I, " No. of empty records
V_TOTAL TYPE I. " Total no. of records.
* STRUCTURES & INTERNAL TABLES
*BAPI structures
DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information
BAPI_MAKT LIKE BAPI_MAKT, " Material Description
BAPI_MARA1 LIKE BAPI_MARA, " Client Data
BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
BAPI_MARC1 LIKE BAPI_MARC, " Plant View
BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
BAPI_RETURN LIKE BAPIRET2. " Return Parameter
*--- Internal table to hold excel file data
DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*--- Internal table to hold Matetrial descriptions
DATA: BEGIN OF IT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF IT_MAKT.
*--- Internal to hold the records in the text file
DATA : BEGIN OF IT_DATA 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 IT_DATA.
* SELECTION SCREEN. *
SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT " Input File
'C:\Material_master.XLS'.
PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK SCR1.
* AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*--- Validating file
PERFORM VALIDATE_FILE USING P_FILE.
* START-OF-SELECTION
START-OF-SELECTION.
*--- Perform to convert the Excel data into an internal table
PERFORM CONVERT_XLS_ITAB.
IF NOT IT_DATA[] IS INITIAL.
*--- Perform to delete Header lines
PERFORM DELETE_HEADER_EMPTY_RECS.
ENDIF.
* END OF SELECTION. *
END-OF-SELECTION.
*--- Perform to upload Material Master data
PERFORM UPLOAD_MATMAS.
* Form : validate_input_file
* Description : To provide F4 help for file if read from PC
FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
FILE_NAME = F_FILE
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
ENDIF.
ENDFORM. " validate_input_file
*& Form CONVER_XLS_ITAB
* text
FORM CONVERT_XLS_ITAB.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_INTERN.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Perform to move the data into an internal data
PERFORM MOVE_DATA.
ENDFORM. " CONVERT_XLS_ITAB
*& Form MOVE_DATA
* text
FORM MOVE_DATA.
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS>.
*--- Sorting the internal table
SORT IT_INTERN BY ROW COL.
CLEAR IT_INTERN.
LOOP AT IT_INTERN.
MOVE IT_INTERN-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS>.
*--- Asigning the field value to a field symbol
MOVE IT_INTERN-VALUE TO <FS>.
AT END OF ROW.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form DELETE_HEADER_EMPTY_RECS
* To delete the Header and empty records
FORM DELETE_HEADER_EMPTY_RECS.
DATA: LV_TABIX LIKE SY-TABIX.
IF NOT P_HEADER IS INITIAL.
LOOP AT IT_DATA.
IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
DELETE IT_DATA FROM 1 TO P_HEADER.
* P_HEADER = 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR IT_DATA.
*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
V_EMPTY = V_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.
CLEAR IT_DATA.
*--- Total no of recs in file
DESCRIBE TABLE IT_DATA LINES V_TOTAL.
IF V_TOTAL = 0.
MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
F_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " DELETE_HEADER_EMPTY_RECS
*& Form UPLOAD_MATMAS
* to upload Material Master data
FORM UPLOAD_MATMAS .
LOOP AT IT_DATA.
* Header
UNPACK IT_DATA-MATNR TO IT_DATA-MATNR.
BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
* Material Description
REFRESH IT_MAKT.
IT_MAKT-LANGU = IT_DATA-SPRAS.
IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
APPEND IT_MAKT.
* Client Data - Basic
BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.
BAPI_MARA1-DIVISION = IT_DATA-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 = IT_DATA-WERKS.
BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
BAPI_MARCX-PLANT = IT_DATA-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
* Accounting
BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
BAPI_MBEW1-STD_PRICE = IT_DATA-STPRS.
BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
*--- BAPI to create material
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 = IT_MAKT
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
* RETURNMESSAGES =
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-MATNR.
ELSEIF BAPI_RETURN-TYPE = 'S'.
WRITE: 'Successfully created material' ,IT_DATA-MATNR.
ENDIF.
ENDLOOP.
ENDFORM. " UPLOAD_MATMAS
Regards,
V.Balaji
Reward if Usefull...
Maybe you are looking for
-
Email will not let me change fonts all of a sudden.
Email will not let me change fonts all of a sudden. It says I don't have the neccesay permissions in ~/library/preferences. this has just happened recently.
-
Hi There, I am turning on MM and SRM Extractors. I noticed there are many vendor fields like 0vendor, 0bbp_vendorm 0gn_vendor. Do you know what are the difference between these vendor fields? which vendor field I should use for reporting? since dif
-
Hi All, I am on portal version EP6.0 SP16 logging as super admin. When I try to assign user to the role it gives me error on saving "Could not save role <rolename>". Any clues on how to overcome this?
-
I have been trying to download Dreamweaver for 4 days. Today (7/24/07), Adam, from Adobe Customer Service told me to click the download button. That was not helpful. My colleague from another company also cannot download Dreamweaver. On Sunday, July
-
How to add Oracle Enterprise Scheduler Extensions to JDeveloper 11.1.1.4?
Hi, Please provide the necessary steps to add Oracle Enterprise Scheduler Extensions to JDeveloper 11.1.1.4. I have searched a lot, but the links point to Jdeveloper version 11.1.1.5.