METHOD create_customer .
  DATA:
    cust TYPE bapiscunew,
    custid TYPE bapiscudat-customerid.
* Transport Dynpro-Felder --> BAPI-Felder
  cust-custname = custom-name.
  cust-form     = custom-form.
  cust-street   = custom-street.
  cust-postcode = custom-postcode.
  cust-city     = custom-city.
  cust-phone    = custom-telephone.
  cust-email    = custom-email.
  IF custom-custtype IS INITIAL.
    cust-custtype = 'P'.
  ELSE.
    cust-custtype = custom-custtype.
  ENDIF.

  CALL FUNCTION 'BAPI_FLCUST_CREATEFROMDATA'
    EXPORTING
      customer_data  = cust
    IMPORTING
      customernumber = custid
    TABLES
      return         = ret.
*
  COMMIT WORK.
* Transport BAPI-Feld --> Dynpro-Feld
  custom-id = custid.
ENDMETHOD.