Skip to Content

Extract/Display specific text within long text from a PM Task List

Apr 17 at 12:38 PM


avatar image

Hi All,

I have a requirement whereby I need to extract specific text/words within long text.

I have a PM Task List and within the header and operation there are specific instructions that the artisan needs to complete. However I only want certain sections/sentences to be printed i.e. there are sections that contain a NOTE, CAUTION and WARNING.. I only want those to print.. I was thinking of creating a custom paragraph format and assigning those instructions to the custom format and then trying to extract those.. This text will be printed on a job card for the artisan

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Hedvig Rohonyi
Apr 17 at 03:06 PM

Hi Ameet,

I hope I understand your task.

1. Via help of function READ_TEXT you can get the text in an internal table. Here you can extract the specific text ( using custom paragraph format is a good idea).

2. If you use .g. Smartforms to display the job card you can use e.g. dynamic text type to display the text

or in case Sapscript you can modify your print program and call the textelement.

Best regards, Hedvig

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Thank you very much for the feedback..

I have long text maintained in the header and operations of a PM task list and I need to display specific sentences/words/phrases on the job card at time of printing.

I have used READ_TEXT, I will have to explore the dynamic text option..

I am not sure if I should go the custom paragraph format route or find the text enclosed with special characters #NOTE#

#text under note xxxxxxxxx#



$text under caution$



Hi Ameet,

You mentioned that maybe you can use the dynamic text type so I suppose you use Smartform:

1. You can create an Abap node on your smartform to call the READ_TEXT.






To find the object and ID: please go into the text editor and here via Goto - Header. Now you can see, which is the text object of the text. 2.

2.To find the text enclosed with special characters #NOTE# you have a lot of possibilty:

Searching using Abap command "FIND IN TABLE" or

running a LOOP and using "FIND" to search the individual rows LINES-TDLINE), ....

But your idea was also good via paragraph, which is stored in LINES-TDFORMAT.

3. Then you can create a text element with type dynamic text (means SAPscript texts that are saved in an internal table with the line type TLINE)

Best regards,



@Hedvig Rohonyi


Created custom paragraph format.

used read_text FM

thereafter delete entries NE to custom paragraph format

delete lines where tdformat NE 'xx'.

xx = custom paragraph format



If this has been resolved then kindly close the question (see this blog).

Nic Teunckens Apr 17 at 05:00 PM

As Hedvig mentions, you can achieve this with SAPScript Functions.

See FM "READ_MULTIPLE_TEXTS" (Cfr. SAP-KBA 2261311) that is able to use Ranges and Wildcards. I suggest you can test if you can use Wildcards OR get As much Content as you would possibly want, and then use A RegEx to search for Specific Words ...

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks, I will have a look at this