Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Dec 13, 2011 at 10:06 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • Posted on Dec 13, 2011 at 10:12 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.