Code: Alles auswählen.
... Anweisungen ...
loop at tab where fehler gt 0.
at first.
... Anweisungen, write, skip (mehr nicht) ...
endat.
... Anweisungen, write, skip (mehr nicht) ...
endloop.
perform open_group.
loop at tab where fehler eq 0.
at first.
... Anweisungen, write, skip (mehr nicht) ...
endat.
... Anweisungen, write, Erstellung / Daten für die BI-Mappe ...
endloop.
... Anweisungen ...
Code: Alles auswählen.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = filename
i_begin_col = p_bcol
i_begin_row = p_brow
i_end_col = p_ecol
i_end_row = p_erow
tables
intern = xlsdaten
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
loop at xlsdaten.
case xlsdaten-col.
when '0001'.
move xlsdaten-value to tab-pernr.
select single * from pa0001 where pa0001~pernr eq xlsdaten-value.
if sy-subrc eq 4.
tab-fehler = 4.
endif.
when '0003'.
move xlsdaten-value to tab-begda.
when '0004'.
move xlsdaten-value to tab-endda.
when '0006'.
move xlsdaten-value to tab-stdzl.
when '0007'.
move xlsdaten-value to tab-stdne.
endcase.
at end of row.
append tab.
clear tab.
fehler = 0.
endat.
endloop.
write: / 'Benutzername: ', sy-uname.
write: / 'SAP-System: ', sy-sysid.
write: / 'Datum: ', sy-datum.
loop at tab where fehler gt 0.
at first.
skip.
format color col_negative.
write: / 'Nicht hinzugefügte Datensätze wg. Fehlern:'.
format color col_heading.
write: / 'Personalnummer', 20 'Anfang', 31 'Ende', 42 'Zähler', 50 'Nenner'.
format color off.
endat.
write: / tab-pernr, 20 tab-begda, 31 tab-endda, 42 tab-stdzl, 50 tab-stdne.
endloop.
perform open_group.
loop at tab where fehler eq 0.
at first.
skip.
format color col_negative.
write: / 'Der Batch-Inputmappe hinzugefügte Datensätze:'.
format color col_heading.
write: /42 'Infotyp 8', 60 'Infotyp 7'.
write: / 'Personalnummer', 20 'Anfang', 31 'Ende', 42 'Zähler', 50 'Nenner', 60 'Arbeitszeitplan'.
format color off.
endat.