Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module to convert the Read_Text of SAP script to normal text

Former Member
0 Kudos

Hi,

I need to send longtext to crsytal reports .

1. Longtext which i am fetching contains the html tags in ecc itself ,i need to remove those tags and send to crystal report via FM

Scenario : Using FM READ_TEXT we get the text as

<(><<)>ol><(><<)>li><(><<)>h2> asfdfsdfdsfdgfdsgfdgsfgdfg<(><<)>/h2><(><<)>/li><(><<)>/ol>

I need to get the output

asfdfsdfdsfdgfdsgfdgsfgdfg

I have searched many FM but iam not able to get the desired output.

Appreciate for your response and guarantee of points .......

Urgent requirement i need to submit to my client.=> Thread Locked

Edited by: kishan P on Dec 13, 2011 10:52 PM

8 REPLIES 8

former_member216611
Participant
0 Kudos

I think no function module is available to delete unnecessary data,

Please check this logic once .

First get the total data in string then first find the < ( position ) ( because html start with < end ends with />)

then find the next > (position) and remove the statements using remove .

in your example

<(><<)>ol><(><<)>li><(><<)>h2> asfdfsdfdsfdgfdsgfdgsfgdfg <(><<)>/h2><(><<)>/li><(><<)>/ol>

the first position will be 1 and check for > so position 3 then delete the data between those finally you get the text . once you check the main data is not between <> it is i between > <.

I think it is helped , if your prb is not solved let me know.

Regards

Siva

0 Kudos

SIva,

Thxs for the reply

But my concern is i need only asfdfsdfdsfdgfdsgfdgsfgdfg with ur logic i hope we will get the data 'ol' in " <(><<)>ol>" . I dont require it.

If you really think it works can u send me the sample code .......

I will implement it.

0 Kudos

no you dont get those values also, in the bottom I already said that need to delete from first position to end position .

the main data is not between <> its between < > .

< (ol) / > if it sample text

here you need to delete from 1 to 10 position , spaces are also count , remove text from 1 to 10

let me know once

Regards

Siva

0 Kudos

Siva,

<(><<)>ol><(><<)>li><(><<)>h2> asfdfsdfdsfdgfdsgfdgsfgdfg<(><<)>/h2><(><<)>/li><(><<)>/ol>

1. <(>

2. <<)>

3. then how to proceed

I get the data in many lines thats why iam clarifying with u

0 Kudos

Hi Swetha,

please see the example program .

data : l_val type i,

l_val2 type i.

data : l_string type

string value '<(><<)>ol><(><<)>li><(><<)>h2> asfdfsdfdsfdgfdsgfdgsfgdfg<(><<)>/h2><(><<)>/li><(><<)>/ol>'.

search l_string for '<'. l_val = sy-fdpos .search l_string for '>'.l_val2 = sy-fdpos .

REPLACE SECTION OFFSET l_val LENGTH l_val2 of :

l_string WITH space.

in the above code you need to write some conditions this is just example how to replace from one position to another position

the system attribute sy-fdpos holds the position of the value . debug and check . loop this until all special are characters are removed for this find '<'. if sy-subrc = o then process .

let me know if it is not solved

if prb is solved close the threadLeave this to the OP. Already warned before.

Edited by: kishan P on Dec 13, 2011 10:54 PM

arseni_gallardo
Active Participant
0 Kudos

Swetha,

The sample text you have provided is clearly ill formed. It should be:

<OL><LI><H2>ASFDFSDFDSFDGFDSGFDGSFGDFG</></></>

When the text is well structured the function CONVERT_ITF_TO_ASCII does what you need.

Kind regards

0 Kudos

Arseni,

while printing it is showing you correct

<OL><LI><H2> ASFDFSDFDSFDGFDSGFDGSFGDFG </H2></LI></OL>

iam getting the output as this

but i require with out that tags in fm level it is showing

<OL><LI><H2>

ASFDFSDFDSFDGFDSGFDGSFGDFG

</H2></LI></OL>

I need to send it to crystal report where it is displaying as in fm level thats the problem

Edited by: Swetha Chevuru on Dec 13, 2011 11:20 AM

0 Kudos

Swetha,

The sample text you have provided is clearly ill formed. It should be:

<OL><LI><H2>ASFDFSDFDSFDGFDSGFDGSFGDFG

Sorry! I don't know how to post the correct text. It should end with < / > repeated 3 times and without the inner spaces.

When the text is well structured the function module CONVERT_ITF_TO_ASCII does what you need.

Kind regards