Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report ZINFOMAIL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zinfomail.
DATA zinfomail TYPE zinfomail.
DATA: dd03t TYPE dd03t.
DATA: dd03l TYPE dd03l.
FIELD-SYMBOLS: <ztabname> TYPE ANY.
DATA : ztabname(50) TYPE c.
FIELD-SYMBOLS: <zfieldname> TYPE ANY.
DATA : zfieldname(50) TYPE c.
DATA zeilen TYPE i.
DATA: header TYPE sodocchgi1.
DATA: zreceiver TYPE TABLE OF somlreci1.
DATA: receiver TYPE somlreci1.
DATA: zdata TYPE TABLE OF solisti1.
DATA: data TYPE solisti1.
SELECT * FROM zinfomail INTO zinfomail.
header-obj_name = zinfomail-struktur.
SELECT SINGLE ddtext FROM dd02t INTO header-obj_descr
WHERE tabname = zinfomail-struktur
AND as4local = 'A'
AND ddtext <> ''.
REFRESH zreceiver.
receiver-receiver = zinfomail-verteiler.
receiver-express = 'X'.
receiver-rec_type = 'U'.
APPEND receiver TO zreceiver.
REFRESH zdata.
data-line = '<html>'.
APPEND data TO zdata.
data-line = '<head>'.
APPEND data TO zdata.
CONCATENATE '<title>' header-obj_descr '</title>' INTO data-line.
APPEND data TO zdata.
data-line = '</head>'.
APPEND data TO zdata.
data-line = '</html>'.
APPEND data TO zdata.
data-line = ''.
APPEND data TO zdata.
data-line = '<table border="1">'.
APPEND data TO zdata.
data-line = '<tr>'.
APPEND data TO zdata.
CLEAR data.
SELECT * FROM dd03l INTO dd03l
WHERE tabname = zinfomail-struktur
AND as4local = 'A'
ORDER BY position.
SELECT SINGLE ddtext FROM dd03t INTO data-line
WHERE tabname = zinfomail-struktur
AND as4local = 'A'
AND fieldname = dd03l-fieldname.
CONCATENATE '<th>' data-line '</th>' INTO data-line.
APPEND data TO zdata.
CLEAR data.
ENDSELECT.
data-line = '</tr>'.
APPEND data TO zdata.
CLEAR ztabname.
MOVE zinfomail-struktur TO ztabname.
ASSIGN (ztabname) TO <ztabname>.
SELECT * FROM (zinfomail-struktur) INTO <ztabname>.
SELECT * FROM dd03l INTO dd03l
WHERE tabname = zinfomail-struktur
AND as4local = 'A'
ORDER BY position.
UNASSIGN <zfieldname>.
CLEAR zfieldname.
ASSIGN dd03l-fieldname TO <zfieldname>.
IF sy-subrc = 0.
CONCATENATE '<th>' <ztabname>-<zfieldname> '</th>' INTO data-line.
APPEND data TO zdata.
CLEAR data.
ENDIF.
ENDSELECT.
ENDDO.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_type = 'HTM'
commit_work = 'X'
document_data = header
TABLES
object_content = zdata
receivers = zreceiver
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 = 99.
WRITE sy-subrc.
ENDSELECT.
Code: Alles auswählen.
data lr_line type ref to data.
create data lr_line type (ztabname).
assign lr_line->* to <ztabname>.
Code: Alles auswählen.
field-symbols <la_field> type any.
assign component dd03l-fieldname of structure <ztabname> to <la_field>.
Code: Alles auswählen.
data ld_text type string.
ld_text = <la_field>.
CONCATENATE '<td>' ld_text '</td>' INTO data-line.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Adrian