Vous êtes sur la page 1sur 3

*&---------------------------------------------------------------------*

*& Report ZINT_LONGTEXT_UPL


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZINT_LONGTEXT_UPL.

Data: w_file type string.


Data: wa_in(2000),
it_in like table of wa_in.
data: begin of wa_data,
docno type ebeln,
ebeln type ebeln,
text(2000),
end of wa_data,
it_data like table of wa_data.
Data: wa_lines type tline,
it_lines like table of wa_lines.
Data: w_len type i.
data: w_width type i.
Data: w_ebeln like THEAD-TDNAME.
Data: wa_stream(2000),
it_stream like table of wa_stream.
Data: w_hex(10) type x.

Parameters: w_id like THEAD-TDID.

CALL FUNCTION '/SAPDMC/LSM_F4_FRONTEND_FILE'


* EXPORTING
* PATHNAME =
CHANGING
PATHFILE = w_file
* EXCEPTIONS
* CANCELED_BY_USER = 1
* SYSTEM_ERROR = 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.

CALL FUNCTION 'GUI_UPLOAD'


EXPORTING
FILENAME = w_file
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = it_in
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
OTHERS = 17
.
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 it_in into wa_in.

Split wa_in at '¦' into wa_data-docno


wa_data-text.
Move wa_data-docno+0(6) to wa_data-ebeln.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'


EXPORTING
INPUT = wa_data-ebeln
IMPORTING
OUTPUT = wa_data-ebeln.
.
Move wa_data-ebeln to w_ebeln.

Shift wa_data-text left by 1 places.


w_len = strlen( wa_data-text ).

Move wa_data-text to wa_stream.


Append wa_stream to it_stream.
CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
* EXPORTING
* LANGUAGE = SY-LANGU
TABLES
TEXT_STREAM = it_stream
ITF_TEXT = it_lines.
.
Refresh it_stream.
Clear wa_stream.
* Do.
* Move wa_data-text+w_width(62) to wa_lines-tdline.
* If sy-index = 1.
* Move '*' to wa_lines-tdformat.
* Else.
* Move '=' to wa_lines-tdformat.
* Endif.*
* Append wa_lines to it_lines.
* Clear wa_lines.
* If w_width => w_len.
* Move 0 to w_width.
* Exit.
* Endif.
* Add 62 to w_width.
* Enddo.
*
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
FID = w_id
FLANGUAGE = 'E'
FNAME = w_ebeln
FOBJECT = 'EKKO'
* SAVE_DIRECT = 'X'
* FFORMAT = '*'
TABLES
FLINES = it_lines
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 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.
Refresh it_lines.
Clear wa_data.
Clear wa_in.
Clear w_len.
Endloop.

Vous aimerez peut-être aussi