Listing 7.6  ZPTB00_API_BTA_SET  Geschftsvorfall annehmen und speichern
FUNCTION zptb00_api_bta_set.
*"----------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     REFERENCE(I_STR_BTA) TYPE  ZPTB00_STR_BTA
*"  EXCEPTIONS
*"      FAILED
*"----------------------------------------------------
  DATA:
    l_str_bta TYPE zptb00_str_bta.

* assign to local variable, because we want to enrich 
* the structure
  l_str_bta = i_str_bta.

* Enrich the structure by technical fields
  CALL FUNCTION 'ZPTB00_OBJ_BTA_ENRICH'
    CHANGING
      c_str_bta = l_str_bta
    EXCEPTIONS
      failed    = 1
      OTHERS    = 2.
  IF sy-subrc <> 0.
    RAISE failed.
  ENDIF.

* Check the structure
  CALL FUNCTION 'ZPTB00_API_BTC_CHECK'
    EXPORTING
      i_str_bta = l_str_bta
    EXCEPTIONS
      failed    = 1
      OTHERS    = 2.
  IF sy-subrc <> 0.
    RAISE failed.
  ENDIF.

* Save the structure in the database table
  CALL FUNCTION 'ZPTB00_OBJ_BTA_SAVE'
    EXPORTING
      i_str_bta = l_str_bta
*     l_tab_bta =
    EXCEPTIONS
      failed    = 1
      OTHERS    = 2.
  IF sy-subrc <> 0.
    RAISE failed.
  ENDIF.

ENDFUNCTION.