08-17-2007 9:51 AM
hi all,
am an abap guy ,am uploading a data in tran mm01 where my functional consultant is not selecting classical view can lsmw work without it coz am getting an error even my functional consultant is not sure that can it work without classical view can u plz reply now as am not able to proceed furher am just waiting plz thanks
08-17-2007 10:20 AM
you can also use BAPI_MATERIAL_SAVEDATA and programm the import. it's much better instead of lsmw for articles. just as you said. if you forget a tab or view you can start all over again. you can also start all over again in the future when you modified the screens or views for mm01 in customizing
here an example of my import for this bapi
FORM inlezen_data.
LOOP AT it_art_import INTO wa_art_import.
*INITIALISATIE van de Views
h_headdata-material = wa_art_import-material.
h_headdata-ind_sector = 'O'.
h_headdata-matl_type = c_matl_type.
IF pa_basic = 'X'.
h_headdata-basic_view = 'X'.
ENDIF.
IF pa_sales = 'X'.
h_headdata-sales_view = 'X'.
ENDIF.
* PURCHASE_VIEW
* MRP_VIEW
* FORECAST_VIEW
* WORK_SCHED_VIEW
* PRT_VIEW
IF pa_stora = 'X'.
h_headdata-storage_view = 'X'.
ENDIF.
* WAREHOUSE_VIEW
* QUALITY_VIEW
IF pa_accnt = 'X'.
h_headdata-account_view = 'X'.
h_headdata-cost_view = 'X'.
ENDIF.
* INP_FLD_CHECK
* MATERIAL_EXTERNAL
* MATERIAL_GUID
*
*BASISGEGEVENS
IF wa_art_import-matl_group IS NOT INITIAL.
h_bapi_mara-matl_group = wa_art_import-matl_group.
h_bapi_marax-matl_group = 'X'.
ENDIF.
IF wa_art_import-old_mat_no IS NOT INITIAL.
h_bapi_mara-old_mat_no = wa_art_import-old_mat_no.
h_bapi_marax-old_mat_no = 'X'.
ENDIF.
* IF wa_art_import-base_uom_iso IS NOT INITIAL.
* h_bapi_mara-base_uom_iso = wa_art_import-base_uom_iso.
* h_bapi_marax-base_uom_iso = 'X'.
* ENDIF.
IF wa_art_import-base_uom IS NOT INITIAL.
h_bapi_mara-base_uom = wa_art_import-base_uom.
h_bapi_marax-base_uom = 'X'.
ENDIF.
IF wa_art_import-dsn_office IS NOT INITIAL.
h_bapi_mara-dsn_office = wa_art_import-dsn_office.
h_bapi_marax-dsn_office = 'X'.
ENDIF.
IF wa_art_import-size_dim IS NOT INITIAL.
h_bapi_mara-size_dim = wa_art_import-size_dim.
h_bapi_marax-size_dim = 'X'.
ENDIF.
*VERKOOPGEGEGEVENS
h_bapi_mvke-sales_org = p_sales.
h_bapi_mvke-distr_chan = p_distr.
h_bapi_mvke-delyg_plnt = p_plant.
IF wa_art_import-acct_assgt IS NOT INITIAL.
h_bapi_mvke-acct_assgt = wa_art_import-acct_assgt.
h_bapi_mvkx-acct_assgt = 'X'.
ENDIF.
IF wa_art_import-mat_pr_grp IS NOT INITIAL.
h_bapi_mvke-mat_pr_grp = wa_art_import-mat_pr_grp.
h_bapi_mvkx-mat_pr_grp = 'X'.
ENDIF.
h_bapi_mvkx-sales_org = p_sales.
h_bapi_mvkx-distr_chan = p_distr.
h_bapi_mvkx-delyg_plnt = 'X'.
*PLANT GEGEVENS
h_bapi_marc-plant = p_plant.
h_bapi_marc-availcheck = 'KP'.
h_bapi_marc-neg_stocks = 'X'.
h_bapi_marc-profit_ctr = p_profit.
h_bapi_marcx-plant = p_plant.
h_bapi_marcx-availcheck = 'X'.
h_bapi_marcx-neg_stocks = 'X'.
h_bapi_marcx-profit_ctr = 'X'.
*MAGAZIJNGEGEVENS
h_bapi_mard-plant = p_plant.
h_bapi_mard-stge_loc = p_stge.
h_bapi_mardx-plant = p_plant.
h_bapi_mardx-stge_loc = p_stge.
*WAARDERINGSGEGEVENS
h_bapi_mbew-val_area = p_val.
h_bapi_mbew-val_class = '5322'.
h_bapi_mbew-price_ctrl = 'V'.
h_bapi_mbew-price_unit = '10000'.
h_bapi_mbew-plndprice1 = '0.01'.
h_bapi_mbew-plndprdate1 = '20060101'.
h_bapi_mbewx-val_area = p_val.
h_bapi_mbewx-val_class = 'X'.
h_bapi_mbewx-price_ctrl = 'X'.
h_bapi_mbewx-price_unit = 'X'.
h_bapi_mbewx-plndprice1 = 'X'.
h_bapi_mbewx-plndprdate1 = 'X'.
*TEKST TABEL
DATA: ta_bapi_makt LIKE bapi_makt OCCURS 0.
DATA: wa_bapi_makt LIKE LINE OF ta_bapi_makt.
IF wa_art_import-matl_desc IS NOT INITIAL.
CLEAR ta_bapi_makt[].
wa_bapi_makt-langu = 'NL'.
wa_bapi_makt-matl_desc = wa_art_import-matl_desc.
APPEND wa_bapi_makt TO ta_bapi_makt.
ENDIF.
*BELASTINGCLASSIFICATIE TABEL
DATA: ta_bapi_mlan LIKE bapi_mlan OCCURS 0.
DATA: wa_bapi_mlan LIKE LINE OF ta_bapi_mlan.
IF wa_art_import-taxclass_1 IS NOT INITIAL.
CLEAR ta_bapi_mlan[].
wa_bapi_mlan-depcountry = 'NL'.
wa_bapi_mlan-tax_type_1 = 'MWST'.
wa_bapi_mlan-taxclass_1 = wa_art_import-taxclass_1.
APPEND wa_bapi_mlan TO ta_bapi_mlan.
wa_bapi_mlan-depcountry = 'NL'.
wa_bapi_mlan-tax_type_1 = 'MWSI'.
wa_bapi_mlan-taxclass_1 = wa_art_import-taxclass_1.
APPEND wa_bapi_mlan TO ta_bapi_mlan.
ENDIF.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = h_headdata
clientdata = h_bapi_mara
clientdatax = h_bapi_marax
plantdata = h_bapi_marc
plantdatax = h_bapi_marcx
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
storagelocationdata = h_bapi_mard
storagelocationdatax = h_bapi_mardx
valuationdata = h_bapi_mbew
valuationdatax = h_bapi_mbewx
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
salesdata = h_bapi_mvke
salesdatax = h_bapi_mvkx
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
* FLAG_ONLINE = ' '
* FLAG_CAD_CALL = ' '
* NO_DEQUEUE = ' '
IMPORTING
return = h_return
TABLES
materialdescription = ta_bapi_makt
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
taxclassifications = ta_bapi_mlan
* RETURNMESSAGES =
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
.
WRITE h_return-message.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
CLEAR wa_art_import.
CLEAR h_bapi_mara.
CLEAR h_bapi_marc.
CLEAR h_bapi_mard.
CLEAR h_bapi_mvke.
FREE ta_bapi_mlan.
FREE ta_bapi_makt.
ENDLOOP.
kind regards