Code: Alles auswählen.
EPORT y_Tabein. .
*----
parameters:
p_file TYPE cffilename default 'F:\DATEN\MAIL\BKPF.txt ' .
*---- Data
DATA: BEGIN OF line OCCURS 0,
a(256).
DATA: END OF line.
data: begin of data occurs 0,
feld_a(25),
feld_b(15),
feld_c(15),
end of data.
TYPES: BEGIN OF ty_in,
str1(255) type c,
str2(255) type c,
str3(255) type c.
TYPES: END OF ty_in.
data:
i type i,
Counthal type string ,
CountSU type string ,
k_string type string ,
l_string type string ,
l_file type string ,
tabi_data type string ,
tab_data type standard table of ty_in,
wa_data like line of tab_data.
l_file = p_file .
*----
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = l_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
* HEADER_LENGTH = 0
* DAT_MODE = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
READ_BY_LINE = 'X'
* IMPORTING
* FILELENGTH =
* HEADER =
CHANGING
DATA_TAB = tab_data
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
NOT_SUPPORTED_BY_GUI = 17
ERROR_NO_GUI = 18
others = 19 .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*----
if sy-subrc ne 0 .
write: / 'Error Gui_upload:' , sy-subrc .
else.
ULINE. LOOP AT tab_data INTO wa_data.
FIND 'twa_RECEIVER-XSEXM X' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
* if data-feld_b ='X'.
* write: / 'Herr'.
* endif.
endif.
FIND 'DWA_RECEIVER-XSEXf X' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
if data-feld_b ='X'.
write: / 'Frau'.
endif.
endif.
FIND 'DW_ADDR-LINE0' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
write: / data-feld_b, data-feld_c.
else.
FIND 'DW_ADDR-LINE1' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
write: / data-feld_b, data-feld_c.
else.
FIND 'DW_ADDR-LINE2' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
write: / data-feld_b, data-feld_c.
else.
FIND 'DW_ADDR-LINE3' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
write: / data-feld_b, data-feld_c.
else.
FIND 'DW_ADDR-LINE4' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
write: / data-feld_b, data-feld_c.
else.
FIND 'DW_ADDR-LINE5' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b data-feld_c.
append data.
write: / data-feld_b, data-feld_c.
else.
FIND 'DWA_NOTE-test_NOTE' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b .
append data.
write: / data-feld_b, data-feld_c.
uline.
else.
FIND 'DWA_ITEMS-T_test' IN wa_data-str1 IGNORING CASE.
if sy-subrc = 0.
split wa_data at ' ' into data-feld_a data-feld_b .
append data.
write: / data-feld_b,data-feld_c.
uline.
endif.
endif.
endif.
endif.
endif.
endif.
endif.
endif.
ENDLOOP.
loop at tab_data into l_string.
while not i = counthal.
i = i + 1.
write: / k_string.
write: / tabi_data.
endwhile.
endloop .
endif.