cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

NTeunckens
Active Contributor
0 Kudos

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

0 Kudos

Thanks, I will have a look at this

hedvig_rohonyi
Employee
Employee
0 Kudos

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

0 Kudos

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#

#xxxxxxxxxxxxxxxxxxxxxxx#

$CAUTION$

$text under caution$

$xxxxxxxxxxxxxxxxxxxxxxxx$

hedvig_rohonyi
Employee
Employee
0 Kudos

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.

CALL FUNCTION 'READ_TEXT'

EXPORTING ID LANGUAGE

NAME OBJECT

...

TABLES LINES Type TLINE (TDFORMAT, TDLINE)

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)

https://help.sap.com/doc/saphelp_ewm94/9.4/en-US/4a/a668944a3b007fe10000000a42189c/frameset.htm

Best regards,

Hedvig

0 Kudos

@Hedvig Rohonyi

Sorted,

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

Thanks

Jelena
Active Contributor
0 Kudos

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