FUNCTION z_bapi_create_customer.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(CUSTOM) TYPE  SCUSTOM
*"  EXPORTING
*"     VALUE(CUSTOMID) TYPE  SCUSTOM-ID
*"  TABLES
*"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
*"----------------------------------------------------------------------
  DATA:
    bcustom TYPE bapiscunew,
    custid TYPE bapiscudat-customerid.
* Transport Dynpro-Felder --> BAPI-Felder
  bcustom-custname = custom-name.
  bcustom-form     = custom-form.
  bcustom-street   = custom-street.
  bcustom-postcode = custom-postcode.
  bcustom-city     = custom-city.
  bcustom-phone    = custom-telephone.
  bcustom-email    = custom-email.
  bcustom-custtype = custom-custtype.

  CALL FUNCTION 'BAPI_FLCUST_CREATEFROMDATA'
    EXPORTING
      customer_data  = bcustom
    IMPORTING
      customernumber = custid
    TABLES
      return         = return.

* Transport BAPI-Feld --> Dynpro-Feld
  customid = custid.
ENDFUNCTION.