Professional Documents
Culture Documents
Page 1 of 6
Hi, Guest
Log On Join Us
Products
About SCN
Downloads
Industries
Partnership
Developer Center
Lines of Business
University Alliances
Innovation
Activity
Browse
Tweet
Like
Introduction
As most of you know, in many objects related to plant maintenance module (technical objects as equipment, functional
location but also notifications, orders, confirmations) we can fulfill long text field. The functionality itself is really nice and
helpful but very painful in terms of reporting / extraction activities.
http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance
12-Sep-14
Page 2 of 6
From list of additional fields select the newly created one (by placing the cursor on it and 'click') and go to coding section
http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance
12-Sep-14
Page 3 of 6
The example code (in case of extraction long text for operation within PM order) looks like bellow.
CLEAR ltext.
***************************************************
* Data definition for input parameters
***************************************************
DATA:
name LIKE thead-tdname,
spras like STXH-tdspras.
***************************************************
* Data definition for output
***************************************************
DATA BEGIN OF txtheader.
INCLUDE STRUCTURE thead.
DATA END OF txtheader.
DATA BEGIN OF txtlines OCCURS 15.
INCLUDE STRUCTURE tline.
DATA END OF txtlines.
***************************************************
* Getting parameter 'name' which in case of operation long text
* is combination of mandant, routing number and general counter
***************************************************
CONCATENATE afvc-mandt afvc-aufpl afvc-aplzl
INTO name.
***************************************************
* Determining language which has been used for long text
* (assuming, that there is only one used
***************************************************
Select single TDspras into spras from STXH where TDOBJECT = 'AUFK'
AND TDID = 'AVOT' and TDNAME = name.
***************************************************
* Reading long text into internal table
***************************************************
CALL FUNCTION 'READ_TEXT'
EXPORTING
client
id
= sy-mandt
= 'AVOT'
language
name
= SPRAS
= name
object
= 'AUFK'
archive_handle
* LOCAL_CAT
=0
=''
IMPORTING
header
TABLES
= txtheader
lines
EXCEPTIONS
id
= txtlines
=1
language
name
not_found
=2
=3
=4
object
=5
reference_check
=6
wrong_access_to_archive = 7
OTHERS
= 8.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
***************************************************
* Concatenating long text rows from internal table
* into one, output field
***************************************************
LOOP AT txtlines.
CONCATENATE ltext txtlines-tdline INTO ltext SEPARATED BY space.
ENDLOOP.
REFRESH txtlines.
http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance
12-Sep-14
Page 4 of 6
And in Query :
http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance
12-Sep-14
Page 5 of 6
All 3 parameters marked bellow will be different for different reference object of long text.
Parameters in red are describing type of object (AUFK - Orders, AVOT - operations in order).
Text name (In yellow) is identifying single long text segment (in this case single operation). This field is tricky one and in
fact you have to resolve the quiz how it's build (sometimes it's easy - ex. are materials or equipments, sometimes more
complicated ...)
Example for equipment long text (text name is pure equipment number with leading zeroes)
http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance
12-Sep-14
Page 6 of 6
heniek
1849 Views
Share
Share
Tweet
Like
0 Comments
There are no comments on this post
Site Index
Privacy
Contact Us
Terms of Use
Copyright
http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance
Follow SCN
12-Sep-14