Codierungen im LSMW
Fieldmapping und Umsetzungsregeln pflegen
PA30_0015_I7980 Ergänzende Zahlungen - Insert Lohnart 7980 Bussen
Zwischen dem Schritt "Daten einlesen" und "Daten umsetzen" wird diese Mail erzeugt.
Das heisst: noch bevor die Daten überhaupt verarbeitet sind. Ist noch wichtig zu wissen…
Kompletter Code
* __GLOBAL_DATA__
TYPES: BEGIN OF ty_errors,
pernr TYPE persno,
ausergtxt type ZZAUSERGTXT,
END OF ty_errors.
DATA: gt_errors TYPE TABLE OF ty_errors.
DATA: ls_errors TYPE ty_errors.
DATA: lv_check_date TYPE dats.
DATA: lv_stat2 TYPE pa0000-stat2.
data: lw_auserg type ZZAUSERG.
CLEAR: lv_check_date, lv_stat2, g_skip_transaction.
READ TABLE PA30_15 INTO DATA(ls_PA30_15) INDEX 1.
CONCATENATE ls_PA30_15-begda+6(4) ls_PA30_15-begda+3(2) '1'
INTO lv_check_date.
SELECT SINGLE stat2 FROM PA0000 INTO lv_stat2
WHERE PERNR = ls_PA30_15-pernr AND begda <= lv_check_date AND
endda >= lv_check_date.
IF lv_stat2 NE '3'.
clear: lw_auserg.
select single ZZAUSERG
into lw_auserg
from pa9030
where begda le lv_check_date
and endda ge lv_check_date
and pernr eq ls_pa30_15-pernr
and OBJPS eq space
and SPRPS eq space.
if sy-subrc eq 0.
*DATA DOMNAME TYPE DD07L-DOMNAME.
*DATA TEXT TYPE SY-MARKY.
*DATA FILL_DD07L_TAB TYPE SY-MARKY.
DATA lt_VALUES_TAB TYPE STANDARD TABLE OF DD07V.
*DATA VALUES_DD07L TYPE STANDARD TABLE OF DD07L.
clear: lt_VALUES_TAB[].
CALL FUNCTION 'GET_DOMAIN_VALUES'
EXPORTING
domname = 'ZZEREIGNIS'
TEXT = 'X'
* FILL_DD07L_TAB = ' '
TABLES
VALUES_TAB = lt_VALUES_TAB
EXCEPTIONS
NO_VALUES_FOUND = 1
OTHERS = 2
.
IF sy-subrc eq 0.
try.
ls_errors-ausergtxt = lt_VALUES_TAB[ domvalue_L = lw_auserg ]-ddtext.
catch cx_sy_itab_line_not_found.
endtry.
ENDIF.
endif.
ls_errors-pernr = ls_PA30_15-pernr.
APPEND ls_errors TO gt_errors.
g_skip_transaction = yes.
RETURN.
ENDIF.
* __END_OF_PROCESSING__
DATA ls_errors TYPE ty_errors.
DATA(lo_mail) = NEW ZCL_SEND_EMAIL( ).
DATA lv_email_to TYPE ZZEMAILTO.
DATA lv_subject TYPE SO_OBJ_DES VALUE 'LSMW IT0015 PERNR nicht aktiv'.
DATA lt_body TYPE SOLI_TAB.
DATA ls_body Type SOLI.
APPEND 'Support3rdLevel.SAP-HR@swisscom.com' TO lv_email_to.
LOOP at gt_errors INTO ls_errors.
concatenate ls_errors-pernr '-' ls_errors-AUSERGTXT into ls_body-line
separated by space.
*ls_body-line = ls_errors-pernr.
APPEND ls_body TO lt_body.
ENDLOOP.
lo_mail->send_email( EXPORTING EMAILTO = lv_email_to
SUBJECT = lv_subject
BODY = lt_body
).