[ABAP] Daten zu einem Material (MATNR) ermitteln

DATA: lv_material_general_data TYPE bapimatdoa.
DATA: lv_return	TYPE bapireturn.
DATA: lv_materialplantdata TYPE bapimatdoc.
DATA: lv_materialvaluationdata TYPE bapimatdobew.

* Materialdaten holen
CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'
  EXPORTING
    material              = '000000001234567890'   " MATNR
    valuationarea         = '01'                   " Werk
  IMPORTING
    material_general_data = lv_material_general_data
    return                = lv_return
    materialplantdata     = lv_materialplantdata
    materialvaluationdata = lv_materialvaluationdata.

* Fehlermessage
WRITE: / lv_return-type, lv_return-code, lv_return-message.

* Kurzbezeichnung
WRITE: / lv_material_general_data-matl_desc.

* Preis
WRITE: / SWITCH string( lv_materialvaluationdata-price_ctrl
                        WHEN 'S' THEN lv_materialvaluationdata-std_price
                        ELSE lv_materialvaluationdata-moving_pr ), lv_materialvaluationdata-currency.