Top Banner
Getting Started Newsletters Store Products Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation Log On Join Us Hi, Guest Search the Community Activity Browse Enterprise Asset Management (SAP EAM) 0 Tweet 0 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. Long text reporting / extraction We have 2 options to get long text in PM reports 1. Development done on standard reports - adding additional column(s) for long text - this activity needs to be done by developers 2. Creation of SAP query with small piece of ABAP coding inside. This is the scenario which I will describe bellow. As the background, you should be familiar with SAP Queries functionality (SQ01, SQ02, SQ03 transactions). Following links can be helpful: SAP Adhoc Query SQ01 SQ02 SQ03 Using Infoset Query, SAP Query and Quick Viewer Steps to be done: Step 1. Create Infoset (SQ02) I will not describe this step, as setup of tables can be different for each requirement. You should base here documents linked above. Step 2. Create and program additional field in infoset. In this step, you need to add new field to infoset. From the main screen you need to navigate to 'Extras' Than create new field ... Long Texts in Plant Maintenance - extraction Posted by Henryk Skrobol in Enterprise Asset Management (SAP EAM) on Sep 19, 2013 4:04:11 PM Share Share 0 Like Like Page 1 of 6 Long Texts in Plant Maintenance - extraction | SCN 12-Sep-14 http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance
6
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Faq Long Texts

Getting Started Newsletters Store

Products Services & Support About SCN Downloads

Industries Training & Education Partnership Developer Center

Lines of Business University Alliances Events & Webinars Innovation

Log On Join UsHi, Guest Search the Community

Activity

Browse

Enterprise Asset Management (SAP EAM)

0 Tweet 0

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.

Long text reporting / extraction

We have 2 options to get long text in PM reports

1. Development done on standard reports - adding additional column(s) for long text - this activity needs to be done by

developers

2. Creation of SAP query with small piece of ABAP coding inside. This is the scenario which I will describe bellow.

As the background, you should be familiar with SAP Queries functionality (SQ01, SQ02, SQ03 transactions).

Following links can be helpful:

SAP Adhoc Query SQ01 SQ02 SQ03

Using Infoset Query, SAP Query and Quick Viewer

Steps to be done:

Step 1. Create Infoset (SQ02)

I will not describe this step, as setup of tables can be different for each requirement. You should base here documents

linked above.

Step 2. Create and program additional field in infoset.

In this step, you need to add new field to infoset.

From the main screen you need to navigate to 'Extras'

Than create new field ...

Long Texts in Plant Maintenance - extraction

Posted by Henryk Skrobol in Enterprise Asset Management (SAP EAM) on Sep 19, 2013 4:04:11 PM

ShareShare 0LikeLike

Page 1 of 6Long Texts in Plant Maintenance - extraction | SCN

12-Sep-14http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance

Page 2: Faq Long Texts

And define parameters for this field

From list of additional fields select the newly created one (by placing the cursor on it and 'click') and go to coding section

Here you have to place a little bit of ABAP code ...

Page 2 of 6Long Texts in Plant Maintenance - extraction | SCN

12-Sep-14http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance

Page 3: Faq Long Texts

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 = sy-mandt

id = 'AVOT'

language = SPRAS

name = name

object = 'AUFK'

archive_handle = 0

* LOCAL_CAT = ' '

IMPORTING

header = txtheader

TABLES

lines = txtlines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 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.

As you can see, they work is done by function module READ_TEXT.

At the end of this post I will describe the way how to get feeding parameters for this FM in case of different reference

objects for Long Text.

Step 3. Add new field to fields group.

This action is as for the standard fields. Basically you will see newly created field in catalog on the left side of the screen

and you need to add this field to one of the catalogs which will be visible in Query. Use drag&drop technique ...

Page 3 of 6Long Texts in Plant Maintenance - extraction | SCN

12-Sep-14http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance

Page 4: Faq Long Texts

Step 4. Assign infoset to user group (SQ03 or SQ02)

Step 5. Create Query based on newly created infoset (SQ01)

Step 6. Enjoy ....

In the order we have:

And in Query :

Parameters for FM READ_TEXT

To get the parameters for function module, while being in long text editor please choose following path.

Page 4 of 6Long Texts in Plant Maintenance - extraction | SCN

12-Sep-14http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance

Page 5: Faq Long Texts

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)

And ... That's All Folks !!!

Hope it will help you a little bit with long text reporting & extraction.

Remarks:

I'm not ABAP consultant, so for sure this piece of code is not optimized and could be done in better way

In case of really long long texts you can face some issues due to capacity of ALV field (I think, it can contain up to 255

characters. In this case maybe you will need to split long text into 2 display fields (each for 255 characters)

Page 5 of 6Long Texts in Plant Maintenance - extraction | SCN

12-Sep-14http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance

Page 6: Faq Long Texts

Follow SCNSite Index Contact Us SAP Help Portal

Privacy Terms of Use Legal Disclosure Copyright

Average User Rating

(0 ratings)

0 Tweet 0

heniek

1849 Views Topics: enterprise_asset_management Tags: pm, sq02, sq01, sq03, sap_query, long_text

ShareShare 0LikeLike

There are no comments on this post

0 Comments

Page 6 of 6Long Texts in Plant Maintenance - extraction | SCN

12-Sep-14http://scn.sap.com/community/eam/blog/2013/09/19/faq-long-texts-in-plant-maintenance