Code: Alles auswählen.
REPORT ztest31 .
DATA headdata LIKE bapimathead.
DATA return LIKE bapiret2.
DATA salesdata LIKE bapi_mvke.
DATA salesdatax LIKE bapi_mvkex.
DATA plantdata LIKE bapi_marc.
DATA plantdatax LIKE bapi_marcx.
DATA storagelocationdata LIKE bapi_mard.
DATA storagelocationdatax LIKE bapi_mardx.
DATA valuationdata LIKE bapi_mbew.
DATA valuationdatax LIKE bapi_mbewx.
DATA clientdata TYPE bapi_mara.
DATA clientdatax TYPE bapi_marax.
DATA forecastparameters TYPE bapi_mpop.
DATA forecastparametersx TYPE bapi_mpopx.
DATA taxclassifications TYPE TABLE OF bapi_mlan WITH HEADER LINE.
DATA materiallongtext TYPE TABLE OF bapi_mltx WITH HEADER LINE.
DATA materialdescr TYPE TABLE OF bapi_makt WITH HEADER LINE.
DATA unitsofmeasure LIKE bapi_marm.
DATA unitsofmeasurex LIKE bapi_marmx.
DATA internationalartnos LIKE bapi_mean.
DATA returnmessages LIKE bapi_matreturn2 OCCURS 0.
DATA prtdata LIKE bapi_mfhm.
DATA prtdatax LIKE bapi_mfhmx.
DATA extensionin LIKE bapiparex.
DATA extensioninx LIKE bapiparexx.
DATA tname TYPE tdobname.
DATA: e_rol_return LIKE bapiret2.
DATA: e_com_return LIKE bapiret2.
PARAMETERS: material TYPE mara-matnr DEFAULT '000000000000001002'.
PERFORM xtendmat.
RETURN.
*&--------------------------------------------------------------------*
*& Form Xtendmat
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM xtendmat.
* KOPF Daten (Sichten) ************************************************
headdata-material = material.
headdata-matl_type = 'HAWA'.
headdata-ind_sector ='M'.
headdata-sales_view = 'X'.
headdata-mrp_view = 'X'.
headdata-storage_view = 'X'.
headdata-account_view = 'X'.
headdata-purchase_view = 'X'.
headdata-quality_view = 'X'.
* Prognosedaten *****************************************************
forecastparameters-PLANT = '0050'.
forecastparametersx-PLANT = '0050'.
* MARA Basisdaten *****************************************************
clientdata-base_uom = 'ST'.
clientdata-base_uom_iso = 'ST'.
*CLIENTDATA-PO_UNIT
*CLIENTDATA-PO_UNIT_ISO
clientdata-matl_group = '01'.
clientdatax-base_uom = 'X'.
clientdatax-base_uom_iso = 'X'.
clientdatax-matl_group = 'X'.
* Verkaufsdaten *******************************************************
salesdata-sales_org = '0001'.
salesdata-distr_chan = '01'.
salesdata-delyg_plnt = '0050'.
salesdata-item_cat = 'NORM'.
salesdata-matl_grp_4 = 'E10'.
salesdata-matl_stats = '1'. " Statistikgruppe Material
salesdatax-sales_org = '0001'.
salesdatax-distr_chan = '01'.
salesdatax-delyg_plnt = 'X'.
salesdatax-item_cat = 'X'.
salesdatax-matl_grp_4 = 'X'.
salesdatax-matl_stats = 'X'. "Statistikgruppe Material
* Werksdaten *********************************************************
plantdata-plant = '0050'. " Werk
plantdata-iss_st_loc = '0050'. " Lagerort
plantdata-sloc_exprc = '0050'." Vorschlagslagerort f Fremdbeschaffung
plantdata-mrp_type = 'ND'. " Dispositionsmerkmal
plantdata-pur_group = '001'. " EK gruppe
plantdata-loadinggrp = '0001'. " Ladegruppe
plantdata-sourcelist = space. " Kennzeichen Orderbuchpflicht
plantdata-auto_p_ord = space. " Kz: Automatische Bestellung erlaubt
plantdata-plnd_delry = '10'. " Planlieferzeit
plantdata-profit_ctr = 'SAM'. "Profit Center
plantdatax-plant = '0050'. " Werk
plantdatax-iss_st_loc = 'X'. " Lagerort
plantdatax-sloc_exprc = 'X'. " Vorschlagslort für Fremdbeschaffung
plantdatax-mrp_type = 'X'. " Dispositionsmerkmal
plantdatax-pur_group = 'X'. " EK gruppe
plantdatax-loadinggrp = 'X'. " Ladegruppe
plantdatax-sourcelist = 'X'. " Kennzeichen Orderbuchpflicht
plantdatax-auto_p_ord = 'X'. " Kz: Automatische Bestellung erlaubt
plantdatax-plnd_delry = 'X'. " Planlieferzeit
plantdatax-profit_ctr = 'X'. "Profit Center
* Lagerort ***********************************************************
storagelocationdata-plant = '0050'.
storagelocationdata-stge_loc = '0050'.
storagelocationdatax-plant = '0050'.
storagelocationdatax-stge_loc = '0050'.
* Bewertungsdaten ****************************************************
valuationdata-val_area = '0050'. "Bewertungskreis
valuationdata-price_ctrl = 'V'. "Preissteuerungskennzeichen
*VALUATIONDATA-STD_PRICE
valuationdata-val_class = '3040'.
valuationdatax-val_area = '0050'. "Bewertungskreis
valuationdatax-price_ctrl = 'X'. "Preissteuerungskennzeichen
*VALUATIONDATA-STD_PRICE
valuationdatax-val_class = 'X'.
*** TABELLEN >
* Steuerklassifikation MLAN ******************************************
taxclassifications-depcountry = 'DE'.
taxclassifications-tax_type_1 = 'MWST'.
taxclassifications-taxclass_1 = '1'.
taxclassifications-tax_ind = space.
APPEND taxclassifications.
* Vertriebslangtext
*000000000271132151 0001 01
CONCATENATE material '000101' INTO tname.
materiallongtext-text_name = tname.
materiallongtext-applobject = 'MVKE'.
materiallongtext-text_id = '0001'.
materiallongtext-langu = 'D'.
materiallongtext-format_col = '*'.
materiallongtext-text_line = 'Hier nun der Langtext'.
APPEND materiallongtext.
* Materialkurztext(MAKT)
materialdescr-langu = sy-langu.
*LANGU_ISO
materialdescr-matl_desc = 'Abstinence in a material world'.
*materialdescr-DEL_FLAG =
APPEND materialdescr.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
plantdata = plantdata
plantdatax = plantdatax
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
storagelocationdata = storagelocationdata
storagelocationdatax = storagelocationdatax
valuationdata = valuationdata
valuationdatax = valuationdatax
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
salesdata = salesdata
salesdatax = salesdatax
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
* FLAG_ONLINE = ' '
* FLAG_CAD_CALL = ' '
* NO_DEQUEUE = ' '
IMPORTING
return = return
TABLES
materialdescription = materialdescr[]
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
materiallongtext = materiallongtext[]
taxclassifications = taxclassifications[]
returnmessages = returnmessages[]
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
.
IF return-type = 'E' OR return-type = 'A'.
WRITE:/ 'Fehler Bapi'.
WRITE:/ 'Type ', return-type.
WRITE:/ 'ID ', return-id.
WRITE:/ 'NUMBER ', return-number.
WRITE:/ return-message.
WRITE:/ '-----------------------------------------'.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = e_com_return.
IF e_com_return-type NE space.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
return = e_rol_return.
WRITE:/ 'Rollback', e_rol_return-type.
ENDIF.
ENDFORM. "Xtendmat