The reason we cannot use the READ_TEXT function in an ABAP mapping is twofold:
It requires table parameters - which cannot be used in ABAP dataflows
It does raise exceptions if no data is found - a condition which would be okay for us
Therefore the solution could be to write a new SAP function module using the READ_TEXT function inside but doing exactly what we want it to do.
FUNCTION Z_AW_READ_TEXT_ALL.
*"----------------------------------------------------------------------
*
"*"
Local Interface:
*" IMPORTING
*" REFERENCE(ID) TYPE THEAD-TDID
*" REFERENCE(LANGUAGE) TYPE THEAD-TDSPRAS
*" REFERENCE(NAME) TYPE THEAD-TDNAME
*" REFERENCE(OBJECT) TYPE THEAD-TDOBJECT
*" EXPORTING
*" REFERENCE(TEXT) TYPE CHAR2000
*"----------------------------------------------------------------------
DATA BEGIN OF TEXTHEADER.
INCLUDE STRUCTURE THEAD.
DATA END OF TEXTHEADER.
DATA BEGIN OF TEXTLINES OCCURS
10
.
INCLUDE STRUCTURE TLINE.
DATA END OF TEXTLINES.
CLEAR TEXTHEADER.
data: l_name type TDOBNAME."TR
l_name = name."TR
CALL FUNCTION
'READ_TEXT'
EXPORTING
OBJECT = OBJECT
ID = ID
LANGUAGE = LANGUAGE
NAME = l_NAME "TR
IMPORTING
HEADER = TEXTHEADER
TABLES
LINES = TEXTLINES
EXCEPTIONS
ID =
1
LANGUAGE =
2
NAME =
3
NOT_FOUND =
4
OBJECT =
5
REFERENCE_CHECK =
6
WRONG_ACCESS_TO_ARCHIVE =
7
OTHERS =
8
.
LOOP AT TEXTLINES.
CONCATENATE TEXT TEXTLINES into TEXT SEPARATED BY space.
ENDLOOP.
ENDFUNCTION.
This function does not have any exceptions by itself, so even if the READ_TEXT function does raise one, it will finish successfully and return an empty text.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin