Listing 7.9  ZPTB00_API_DOC_RUN  Ungebuchte Geschftsvorflle verarbeiten
FUNCTION zptb00_api_doc_run .
*"----------------------------------------------------
*"*"Lokale Schnittstelle:
*"  EXCEPTIONS
*"      FAILED
*"----------------------------------------------------

  DATA:
    l_tab_bta TYPE zptb00_tty_bta,
    l_tab_doc TYPE zptb00_tty_doc.

  CALL FUNCTION 'ZPTB00_API_BTA_LOAD'
*   EXPORTING
*     I_BOOKED        = '1'
    IMPORTING
      e_tab_bta       = l_tab_bta
    EXCEPTIONS
      failed          = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
    RAISE failed.
  ENDIF.

  CALL FUNCTION 'ZPTB00_OBJ_DOC_BOOK'
    EXPORTING
      i_tab_bta = l_tab_bta
    IMPORTING
      e_tab_doc = l_tab_doc
    EXCEPTIONS
      failed    = 1
      OTHERS    = 2.
  IF sy-subrc <> 0.
    RAISE failed.
  ENDIF.

  CALL FUNCTION 'ZPTB00_OBJ_DOC_SAVE'
    EXPORTING
*     i_str_doc =
      i_tab_doc = l_tab_doc
    EXCEPTIONS
      failed    = 1
      OTHERS    = 2.
  IF sy-subrc <> 0.
    RAISE failed.
  ENDIF.

  CALL FUNCTION 'ZPTB00_API_BTA_MARK_AS_BOOKED'
    EXPORTING
      i_tab_bta = l_tab_bta
    EXCEPTIONS
      failed    = 1
      OTHERS    = 2.
  IF sy-subrc <> 0.
    RAISE failed.
  ENDIF.

ENDFUNCTION.