determine budget biling plan for a printdoc

A short code snippet which determines the budget billing for a print doc.

FORM get_soll_datum_for_bbp USING is_doc_item TYPE erdz CHANGING cs_doc_header LIKE t_doc_header_item.
  DATA: lo_date   TYPE REF TO cl_sawe_date,
        lt_eabps  TYPE TABLE OF eabps,
        ls_erdb   TYPE erdb,
        ls_eabps  LIKE LINE OF lt_eabps,
        lv_month_name TYPE t247-ltx,
        lv_kmonth TYPE kmonth
        .

* Über ERDB den Buchungsbeleg zum Druckbeleg ermitteln.
  SELECT SINGLE * FROM erdb INTO ls_erdb WHERE opbel = cs_doc_header-opbel.

* Dann mit buchungsbeleg den abschlagsplan lesen.
  CALL FUNCTION 'ISU_S_BBP_GET_EABP'
    EXPORTING
      x_opbel         = ls_erdb-invopbel
*     IMPORTING
*       Y_EABP          =
*       Y_AUGBL         =
    TABLES
      yt_eabps        = lt_eabps
   EXCEPTIONS
     not_found       = 1
     OTHERS          = 2
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  READ TABLE lt_eabps INTO ls_eabps
    WITH KEY opupw = ls_erdb-invopupw
             opupk = ls_erdb-invopupk.

* Soll Datum der Abschlagsforderung verwenden um Abschlagsmonat zu ermittlen.
  lo_date = cl_sawe_date=>get_instance( ).

  "#13687: Abschlagsmonat über sammelbeleg ermitteln und nicht wie
  "bei der Implementierung vereinbart den ersten Einzelbeleg.
  lv_kmonth = ls_eabps-solldat.
  CALL METHOD lo_date->get_month_name
    EXPORTING
*     iv_date   =
      iv_kmonth = lv_kmonth
    IMPORTING
*     ev_stext  =
      ev_ltext  = lv_month_name.

  CONCATENATE lv_month_name ls_eabps-solldat(4)
         INTO cs_doc_header-absch_monat
    SEPARATED BY space.

ENDFORM.                    "get_soll_datum_for_bbp