Code: Alles auswählen.
REPORT ZBC_EXPIRY_CHECK.
TYPES: BEGIN OF solisti1_long,
line1 TYPE String,
line2 TYPE String,
line3 TYPE String,
END OF solisti1_long.
DATA: go_tabelle TYPE REF TO cl_salv_table,
go_funktionen TYPE REF TO cl_salv_functions,
heute TYPE sy-datum,
diff TYPE i,
lt_expiry_check TYPE TABLE OF ZBC_EXPIRY_CHECK.
DATA: lv_betreff TYPE sodocchgi1,
lt_receivers TYPE STANDARD TABLE OF somlreci1,
ls_receivers TYPE somlreci1,
lt_inhalt TYPE STANDARD TABLE OF solisti1,
ls_inhalt TYPE solisti1,
lt_kopf TYPE STANDARD TABLE OF solisti1,
ls_kopf TYPE solisti1,
ls_structure_mail TYPE sopcklsti1,
lt_structure_mail TYPE STANDARD TABLE OF sopcklsti1,
ls_objtxt TYPE solisti1, " Message body
w_tab_lines TYPE i, " Table lines
ls_objpack TYPE sopcklsti1, " Packing list
t_objpack TYPE STANDARD TABLE OF sopcklsti1. " Packing list
* con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
FIELD-SYMBOLS: <G_EXPIRY_CHECK> LIKE LINE OF lt_expiry_check .
heute = sy-datum.
SELECT *
FROM ZBC_EXPIRY_CHECK
INTO TABLE lt_expiry_check.
LOOP AT lt_expiry_check ASSIGNING <G_EXPIRY_CHECK>.
diff = heute - <G_EXPIRY_CHECK>-expiry_date.
IF diff <= <G_EXPIRY_CHECK>-warn_thres_d.
* WRITE /: Diff.
LOOP AT lt_receivers INTO ls_receivers.
ls_receivers = <G_EXPIRY_CHECK>-email_to.
MODIFY lt_receivers FROM ls_receivers.
ENDLOOP.
* ls_objtxt-line = ' '.
*append ls_objtxt to lt_inhalt.
ls_objtxt-line = |The following objects are about to expire:|.
*ls_objtxt-line2 = |WARNING - | && sy-sysid && |: | && <G_EXPIRY_CHECK>-type && || && <G_EXPIRY_CHECK>-name && | expires in | && diff && | days | && <G_EXPIRY_CHECK>-expiry_date && | | .
*ls_objtxt-line3 = |This message was generated in system | && sy-sysid && | report name: ZBC_EXPIRY_CHECK (jobname may differ...) |.
*WRITE /: ls_objtxt-line1,
* ls_objtxt-line2,
* ls_objtxt-line3.
append ls_objtxt to lt_inhalt.
*
"lv_betreff-obj_descr = lv_message.
lv_betreff-obj_langu = 'E'.
lv_betreff-sensitivty = 'F'.
*
* ls_receivers-receiver = 'tesstdf@fscher.de'.
* ls_receivers-rec_type = 'U'.
* "ls_receivers-copy = 'X'.
* APPEND ls_receivers TO lt_receivers.
*
*
CLEAR ls_objpack.
ls_objpack-head_start = 1.
ls_objpack-head_num = 0.
ls_objpack-body_start = 1.
ls_objpack-body_num = 99.
ls_objpack-doc_type = 'RAW'.
APPEND ls_objpack TO t_objpack.
*CALL FUNCTION 'EFG_GEN_SEND_EMAIL'
*EXPORTING
* I_Title = 'Test'
* I_Sender = <G_EXPIRY_CHECK>-email_to
* I_Recipient =
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = lv_betreff
sender_address_type = 'U'
commit_work = ' '
TABLES
packing_list = t_objpack
object_header = lt_kopf
contents_txt = lt_inhalt
receivers = lt_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
Ich hab heute morgen mein Auto in die Kfz-Werkstatt gebracht, dem Meister den Schlüssel auf den Tisch geknallt und mit geteilt das das Auto kaputt ist und er mal danach schauen soll. Er wird schon selber heraus finden, dass die Bremse hintern rechts ab und zu festhängt.Schäfer_anfänger hat geschrieben:was aber bisher fehlgeschlagen ist.