Skip to Content
0
Former Member
Jul 09, 2010 at 07:45 AM

getting error while calling this BAPI:Field MATNR has been transferred inco

516 Views

Hi,

I have a rquirement to upload material master data into sap for Plant 1251.(For plant 1251 we need to upload both Basi veiw and Extended View).

I am getting the following error while calling this BAPI.Field MATNR has been transferred inconsistently or is blank

the errror is :Field MATNR has been transferred inconsistently or is blank.

I have written the below logic in the program to upload material master data into SAP.

Please help me out to resolve this issue.

Thanks in advance.

Program logic which i have wriiten in the program is

LOOP AT it_rpt.

CLEAR lwa_return.

v_tabix = sy-tabix.

IF ( it_rpt-werks EQ p_werks AND

it_rpt-matnr IS INITIAL ).

  • retrieve internal number

PERFORM get_internal_number USING lc_mtart

lc_mbrsh

CHANGING it_rpt-matnr.

ENDIF.

IF NOT it_rpt-matnr IS INITIAL.

PERFORM convert_field_input CHANGING it_rpt-matnr.

ENDIF.

  • Header data

CLEAR lwa_headdata.

lwa_headdata-material = it_rpt-matnr.

lwa_headdata-ind_sector = lc_mbrsh.

lwa_headdata-matl_type = lc_mtart.

lwa_headdata-basic_view = 'X'.

IF NOT it_rpt-vkorg IS INITIAL.

lwa_headdata-sales_view = 'X'.

ENDIF.

lwa_headdata-purchase_view = 'X'.

lwa_headdata-mrp_view = 'X'.

lwa_headdata-storage_view = 'X'.

lwa_headdata-forecast_view = 'X'.

lwa_headdata-work_sched_view = 'X'.

lwa_headdata-account_view = 'X'.

lwa_headdata-cost_view = 'X'.

*Client data

CLEAR: lwa_clientdata, lwa_clientdatax.

IF it_rpt-werks EQ c_1251.

lwa_clientdata-matl_group = it_rpt-matkl.

lwa_clientdata-old_mat_no = it_rpt-bismt.

lwa_clientdata-base_uom = it_rpt-meins.

lwa_clientdata-manu_mat = it_rpt-mfrpn.

lwa_clientdata-mfr_no = it_rpt-mfrnr.

ENDIF.

lwa_clientdata-division = it_rpt-spart.

lwa_clientdata-unit_of_wt = lc_gewei.

lwa_clientdata-trans_grp = lc_tragr.

IF it_rpt-werks EQ c_1251.

lwa_clientdatax-matl_group = 'X'.

lwa_clientdatax-old_mat_no = 'X'.

lwa_clientdatax-base_uom = 'X'.

lwa_clientdatax-manu_mat = 'X'.

lwa_clientdatax-mfr_no = 'X'.

ENDIF.

lwa_clientdatax-unit_of_wt = 'X'.

lwa_clientdatax-trans_grp = 'X'.

lwa_clientdatax-division = 'X'.

  • Material Description

IF it_rpt-werks EQ c_1251.

lt_matdesc-langu = sy-langu.

lt_matdesc-matl_desc = it_rpt-maktx.

APPEND lt_matdesc.

ENDIF.

*Plant data

CLEAR lwa_plantdata.

lwa_plantdata-plant = it_rpt-werks.

lwa_plantdata-availcheck = lc_mtvfp.

lwa_plantdata-mrp_type = lc_dismm.

lwa_plantdata-mrp_group = lc_disgr.

lwa_plantdata-auto_p_ord = 'X'.

lwa_plantdata-proc_type = 'F'.

IF it_rpt-werks EQ c_1251.

it_rpt-prctr = lc_prctr. "1252

ELSEIF it_rpt-werks EQ c_1261.

it_rpt-prctr = lc_prctr1. "1262

ENDIF.

lwa_plantdata-profit_ctr = it_rpt-prctr.

lwa_plantdata-period_ind = lc_perkz.

lwa_plantdata-max_stock = it_rpt-stawn.

lwa_plantdata-countryori = it_rpt-herkl.

lwa_plantdata-sloc_exprc = it_rpt-lgfsb.

CLEAR lwa_plantdatax.

lwa_plantdatax-plant = it_rpt-werks.

lwa_plantdatax-availcheck = 'X'.

lwa_plantdatax-mrp_type = 'X'.

lwa_plantdatax-mrp_group = 'X'.

lwa_plantdatax-auto_p_ord = 'X'.

lwa_plantdatax-proc_type = 'X'.

lwa_plantdatax-profit_ctr = 'X'.

lwa_plantdata-period_ind = 'X'.

lwa_plantdatax-max_stock = 'X'.

lwa_plantdatax-countryori = 'X'.

lwa_plantdatax-sloc_exprc = 'X'.

*Valuation data

CLEAR lwa_valuationdata.

lwa_valuationdata-val_area = it_rpt-werks.

lwa_valuationdata-price_ctrl = lc_vprsv.

lwa_valuationdata-price_unit = lc_peinh.

lwa_valuationdata-val_class = it_rpt-bklas.

CLEAR lwa_valuationdatax.

lwa_valuationdatax-val_area = it_rpt-werks.

lwa_valuationdatax-price_ctrl = 'X'.

lwa_valuationdatax-price_unit = 'X'.

lwa_valuationdatax-val_class = 'X'.

*Storage location

CLEAR lwa_storagelocation.

lwa_storagelocation-plant = it_rpt-werks.

lwa_storagelocation-stge_loc = it_rpt-lgort.

CLEAR lwa_storagelocationx.

lwa_storagelocationx-plant = it_rpt-werks.

lwa_storagelocationx-stge_loc = it_rpt-lgort.

*Tax Classifications

IF it_rpt-werks EQ c_1251.

it_rpt-tatyp = lc_tatyp. "u2018MWSTu2019

ELSEIF it_rpt-werks EQ c_1261.

it_rpt-tatyp = lc_tatyp1. "u2018UTXJu2019

ENDIF.

lt_taxclass-tax_type_1 = it_rpt-tatyp.

lt_taxclass-taxclass_1 = lc_taxkm.

lt_taxclass-tax_ind = lc_taxim.

APPEND lt_taxclass.

*Sales data

CLEAR: lwa_salesdata, lwa_salesdatax.

IF it_rpt-werks EQ c_1251.

it_rpt-vkorg = lc_vkorg.

ELSEIF it_rpt-werks EQ c_1261.

it_rpt-vkorg = lc_vkorg1.

ENDIF.

lwa_salesdata-sales_org = it_rpt-vkorg.

lwa_salesdata-distr_chan = lc_vtweg.

lwa_salesdata-cash_disc = lc_sktof.

lwa_salesdata-item_cat = lc_mtpos.

lwa_salesdatax-sales_org = it_rpt-vkorg.

lwa_salesdatax-distr_chan = lc_vtweg.

lwa_salesdatax-cash_disc = 'X'.

lwa_salesdatax-item_cat = 'X'.

*Forecast parameters

CLEAR: lwa_forecast, lwa_forecastx.

lwa_forecast-plant = it_rpt-werks.

lwa_forecast-fore_model = lc_prmod.

lwa_forecast-fore_pds = lc_anzpr.

lwa_forecast-hist_vals = lc_peran.

lwa_forecastx-plant = it_rpt-werks.

lwa_forecastx-fore_model = 'X'.

lwa_forecastx-fore_pds = 'X'.

lwa_forecastx-hist_vals = 'X'.

  • Purchasing long text

IF it_rpt-werks EQ c_1251.

IF it_rpt-tdline1 <> ' '.

lv_tdobject = 'MATERIAL'.

lv_tdid = 'BEST'.

lv_tdname = it_rpt-matnr.

PERFORM fill_longtext TABLES lt_longtext

USING lv_tdobject

lv_tdname

lv_tdid

sy-langu

it_rpt-tdline1.

ENDIF.

  • Basic long text

IF it_rpt-tdline2 <> ' '.

lv_tdobject = 'MATERIAL'.

lv_tdid = 'GRUN'.

lv_tdname = it_rpt-matnr.

PERFORM fill_longtext TABLES lt_longtext

USING lv_tdobject

lv_tdname

lv_tdid

sy-langu

it_rpt-tdline2.

ENDIF.

*Units of measure

CLEAR : lt_uom,lt_uomx.

lt_uom-alt_unit = it_rpt-meins.

lt_uom-alt_unit_iso = it_rpt-meins.

lt_uom-unit_of_wt = it_rpt-gewei.

APPEND lt_uom.

lt_uomx-alt_unit = it_rpt-meins.

lt_uomx-alt_unit_iso = it_rpt-meins.

lt_uomx-unit_of_wt = 'X'.

APPEND lt_uomx.

ENDIF.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = lwa_headdata

clientdata = lwa_clientdata

clientdatax = lwa_clientdatax

plantdata = lwa_plantdata

plantdatax = lwa_plantdatax

forecastparameters = lwa_forecast

forecastparametersx = lwa_forecastx

storagelocationdata = lwa_storagelocation

storagelocationdatax = lwa_storagelocationx

valuationdata = lwa_valuationdata

valuationdatax = lwa_valuationdatax

salesdata = lwa_salesdata

salesdatax = lwa_salesdatax

IMPORTING

return = lwa_return

TABLES

materialdescription = lt_matdesc

unitsofmeasure = lt_uom

unitsofmeasurex = lt_uomx

materiallongtext = lt_longtext

taxclassifications = lt_taxclass

returnmessages = it_messages.

Regards,

Reddy