Code: Alles auswählen.
IF sy-subrc = 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'ST'
language = ls_spras
name = ls_name
object = 'TEXT'
* IMPORTING
* header = header
TABLES
lines = t_lines
EXCEPTIONS
not_found = 4
OTHERS = 8.
IF sy-subrc <> 0.
ELSE.
LOOP AT t_lines INTO ls_line.
IF ls_line CS '&VBAK-VDATU&' .
REPLACE '&VBAK-VDATU&' IN ls_line WITH lv_datum.
ENDIF.
IF ls_line CS '&KNA1-NAME1&' .
REPLACE '&KNA1-NAME1&' IN ls_line WITH lv_kna1_ze-name1.
ENDIF.
IF ls_line CS '&KNA1-STRAS&' .
REPLACE '&KNA1-STRAS&' IN ls_line WITH lv_kna1_ze-stras.
ENDIF.
IF ls_line CS '&KNA1-PSTLZ&' .
REPLACE '&KNA1-PSTLZ&' IN ls_line WITH lv_kna1_ze-PSTLZ.
ENDIF.
IF ls_line CS '&KNA1-ORT01&' .
REPLACE '&KNA1-ORT01&' IN ls_line WITH lv_kna1_ze-ort01.
ENDIF.
IF ls_line CS '&KNA1-TELF1&' .
REPLACE '&KNA1-TELF1&' IN ls_line WITH lv_kna1_ze-telf1.
ENDIF.
append ls_line to lt_lines.
ls_order_text-text_id = 'ZKEI'.
ls_order_text-langu = ls_spras.
ls_order_text-text_line = ls_line-tdline.
ls_order_text-format_col = '*'.
ls_order_text-function = '005'.
APPEND ls_order_text TO lt_order_text.
ENDLOOP.
ENDIF.
Code: Alles auswählen.
ls_header-TDOBJECT = 'VBBK'.
ls_header-TDID = 'ZKEI'.
ls_header-TDSPRAS = ls_spras.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
HEADER = ls_header
INSERT = 'X'
* SAVEMODE_DIRECT = ' '
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
LINES = lt_lines
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* OBJECT = 4
* OTHERS = 5
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Der wird beim Verbuchen des Beleges eh ausgeführt.ewx hat geschrieben:Den SAVE_TEXT darfst du gar nicht machen.