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: 

HTML to ITAB

Former Member
0 Kudos
679

Hi All,

Is there a FM/Method that I can use to download HTML file data into an ITAB or a STRING? I want the function to remove all the HTML tags in the file.

Thanks,

Sougata.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
306

Hi ,

You could try it this way:

Use FM GUI_UPLOAD or "open dataset" to read the file .

Then aply the similar logic in ABAP as used in following link:-

http://www.codeproject.com/asp/removehtml.asp

Thanks & Regards,

Ankur

10 REPLIES 10

Former Member
0 Kudos
306

Try if 'CALL TRANSFORMATION' helps. You can find details on this in SAP help portal: help.sap.com

I have used this for XML to ABAP transformations but not for HTML though.

0 Kudos
306

The CALL TRANSFORMATION documentation clearly states:

Using a transformation, you can transform:

1. XML documents into XML documents

2. XML documents into ABAP program data (data objects and objects)

3. ABAP program data into XML documents

4. ABAP program data into ABAP program data

Thanks for your tip but I usually don't adopt the "Trial & Error" method with a business system.

athavanraja
Active Contributor
0 Kudos
306

<i>FM/Method that I can use to download HTML file data into an ITAB or a STRING</i>

is this html file just in your frontend or it has to be from a web address?

front end: use gui_upload

web address: FM HTTP_GET OR HTTP_POST

Class = cl_http_client

as far removing html tags, i am not sure if any standard tool is available.

if you could explain a little bit more about the scenario may be we could come with different ideas

Regards

Raja

0 Kudos
306

Hi Raja,

Thanks for replying. Source sends data (PO) to customer to create sales orders (SO). They used to send text files in the past but now changed to HTML format! They are unable to send in XML format.

Customer has an ABAP which reads the text file (PO) to create SO in SAP. Now I need to change this program to read the new HTML format instead. Problem is the HTML file is not fixed length...everything is variable including data positions etc. and of course its full of tags.

I need a function to remove the tags then load the HTML file content into an ITAB; OR convert the HTML file into Text file first then read the text file in the ABAP.

Thanks,

Sougata.

0 Kudos
306

if i understand you correctly you just want to read the values only from html document.

for example.

<table>

<tr>

<td>po number</td>

<td>12345</td>

</tr>

<table>

out of this html you want to read the first column and read the corresponding value in the second column and map this to a bap variable for po number.

this is going to be really tricky unless otherwise the receiver and sender agrees upon a standard format of html.

but better option would be to request the sender to send it in XML format. (when they can generate HTML hey can very well generate XML - irrespective of the tool that they use)

Regards

Raja

0 Kudos
306

I agree with you totally. Not only its tricky but its quite impossible to ascertain field contents in the HTML file if position, index etc. are going to vary in each file!

I've requested an XML format before posting this issue here, let's see if they can do it.

Cheers.

0 Kudos
306

if you are not expecting more from the forum for this question, you can close this thread.

Regards

Raja

0 Kudos
306

Hello Raja.

I have the requirment like how to capture HTML source code into an Internal Table or a String.

I have the HTML File on my Desktop. I need to get the source code of that HTML into an Internal Table or String.

How I can use

front end: use gui_upload

web address: FM HTTP_GET OR HTTP_POST

Class = cl_http_client

For getting the Data into an internal Table.

Can you please give me some sample code.

For Example this is the below source code for the HTML File which is on the desktop.

I need to capture this one into an internal table or string.

<HTML>

<BODY>

hello World

</BODY>

</HTML>

Regards,

B. Krishna.

Former Member
0 Kudos
307

Hi ,

You could try it this way:

Use FM GUI_UPLOAD or "open dataset" to read the file .

Then aply the similar logic in ABAP as used in following link:-

http://www.codeproject.com/asp/removehtml.asp

Thanks & Regards,

Ankur

0 Kudos
306

Thanks Ankur. Yes, I could keep on programming that way for ever and remove all the tags but I strongly feel the program will error out at some stage as the file format is <u>not</u> an agreed one between the sender and the receiver.

What happens, for eg, the source changes a field position/length/label which is mandatory in SAP to create a SO? I think it will be a waste of time to do anything with this file at this stage because it will be a temporary solution that way.

I'll keep this thread open for a few days more, in case someone comes up with something new!

Cheers,

Sougata.