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: 

Problem using WWW_LIST_TO_HTML

david_fryda2
Participant
0 Kudos

Hi everyone,

I am having a problem using WWW_LIST_TO_HTML function.

I've done many writes and I want to transfer all those writes to a table.

The problem is that the table that returns from WWW_LIST_TO_HTML contains

also the old data.

For example:

<code>

DATA: gt_w3html LIKE TABLE OF w3html WITH HEADER LINE.

DO 3 TIMES.

CLEAR: gt_w3html.

REFRESH: gt_w3html.

IF sy-index = 1.

WRITE:/ 'hello1'.

ELSEIF sy-index = 2.

WRITE:/ 'hello2'.

ELSEIF sy-index = 3.

WRITE:/ 'hello3'.

ENDIF.

CALL FUNCTION 'WWW_LIST_TO_HTML'

EXPORTING

list_index = sy-lsind

TABLES

html = gt_w3html.

ENDDO.

</code>

Now when sy-index = 2, the gt_w3html contains hello1 and hello2.

When sy-index = 3, gt_w3html contains hello1, hello2 and hello3.

I would like that gt_w3html will contain only the text that is relevant :

if sy-index =3, gt_w3html should contain only hello3.

Thanks for the help.

Regards.

David

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi David,

The program will generate all the values in one list.

Even though there are 3 separate write statements, the sy-lsind will be 0 that is for the initial page.

So your report output will always contain all the values.

In case you want to see, each Hello, then you have to use Interactive report.

If you click on the first list page, it will take you to the next page thus displaying the hello2 and then hellow3 in 3rd page. But through this code, you can only generate all the Hellos in one go.

Regards,

Yogesh

5 REPLIES 5

Former Member
0 Kudos

Hi David

here the loop is running 3 times so for first run it is showing hello1

and for 2nd loop hello2 and for 3 rd loop hello3

DO 3 TIMES.

CLEAR: gt_w3html.

REFRESH: gt_w3html.

IF sy-index = 1.

WRITE:/ 'hello1'.

ENDIF.

DO 3 TIMES.

CLEAR: gt_w3html.

REFRESH: gt_w3html.

sy-index = 2.

WRITE:/ 'hello2'.

ENDIF.

ENDDO.

DO 3 TIMES.

CLEAR: gt_w3html.

REFRESH: gt_w3html.

IF sy-index = 3.

WRITE:/ 'hello3'.

ENDIF.

ENDDO

REWARD POINTS FOR HELPFUL ANSWERS,

KIRAN.M

Former Member
0 Kudos

Hi David,

The program will generate all the values in one list.

Even though there are 3 separate write statements, the sy-lsind will be 0 that is for the initial page.

So your report output will always contain all the values.

In case you want to see, each Hello, then you have to use Interactive report.

If you click on the first list page, it will take you to the next page thus displaying the hello2 and then hellow3 in 3rd page. But through this code, you can only generate all the Hellos in one go.

Regards,

Yogesh

0 Kudos

Hi Yogesh,

Thanks for the help.

Is that complicated to create interactive report ?

An ALV is an interactive report ?

Thanks.

Message was edited by:

David Fryda

0 Kudos

Hi David,

You dont really need to use an ALV for interactive purpose.

A normal report can be made interactive and not a big task at all.

You have to use the normal list events.

You can go to transaction ABAPDOCU to find some sample code of how to do it.

Example program DEMO_LIST_INTERACTIVE_1.

Regards,

Yogesh

0 Kudos

Thanks for the help!