Showing results for 
Search instead for 
Did you mean: 

Generate a url from a report or function module

Former Member
0 Kudos


I'm trying to generate a url from a report and tried using the function module WWW_ITAB_TO_HTML in the report program, as , but i'm not able to get the expected results. The code is given below. Could someone please try and help me resolve this issue. Thanks in advance.

DATA: emp_name TYPE char80.

DATA: it_itabex TYPE zdb_ex_tty,
it_emp TYPE TABLE OF zis_emp,
it_org TYPE TABLE OF zis_org,
it_pos TYPE TABLE OF zis_pos,
it_pos_alloc TYPE TABLE OF zis_pos_alloc,
it_res TYPE TABLE OF zis_res,
it_res_alloc TYPE TABLE OF zis_res_alloc,
ls_itabex TYPE zdb_ex_s.

DATA: lv_filename TYPE string,
lv_path TYPE string,
lv_fullpath TYPE string,
lv_replace TYPE i.

DATA qstring LIKE it_itabex OCCURS 10.

DATA: url(200), url2(200), url3(200), fullurl(200).

FIELD-SYMBOLS: <fs_emp> LIKE LINE OF it_emp,
<fs_org> LIKE LINE OF it_org,
<fs_pos> LIKE LINE OF it_pos,
<fs_pos_alloc> LIKE LINE OF it_pos_alloc,
<fs_res> LIKE LINE OF it_res,
<fs_res_alloc> LIKE LINE OF it_res_alloc.

** Report Program to export data from database to Excel.

** Populate all the tables that have to be exported.
SELECT * FROM zis_org INTO TABLE it_org.
SELECT * FROM zis_pos INTO TABLE it_pos.
SELECT * FROM zis_pos_alloc INTO TABLE it_pos_alloc.
SELECT * FROM zis_emp INTO TABLE it_emp.
SELECT * FROM zis_res_alloc INTO TABLE it_res_alloc.
SELECT * FROM zis_res INTO TABLE it_res.

** Append the Column Header

CLEAR ls_itabex.
ls_itabex-ipp_pos_id = 'IPP Pos ID'.
ls_itabex-emp_name = 'Name'.
ls_itabex-dt_of_join = 'JoinedOn'.
ls_itabex-emp_status = 'Status'.
ls_itabex-org_name = 'Org'.
ls_itabex-prj_name = 'Project'.
ls_itabex-mgr_name = 'Line'.
ls_itabex-designation = 'Designation'.
ls_itabex-specialization = 'Specialization'.

APPEND ls_itabex TO it_itabex.

** Append all the tables into one internal table

LOOP AT it_pos_alloc ASSIGNING <fs_pos_alloc>.

CLEAR ls_itabex.
ls_itabex-ipp_pos_id = <fs_pos_alloc>-ipp_pos_id.

READ TABLE it_emp ASSIGNING <fs_emp> WITH KEY emp_guid = <fs_pos_alloc>-emp_guid.
IF sy-subrc = 0.

CONCATENATE <fs_emp>-emp_fname <fs_emp>-emp_lname INTO ls_itabex-emp_name SEPARATED BY space.

ls_itabex-dt_of_join = <fs_emp>-dt_of_join.
ls_itabex-emp_status = <fs_emp>-emp_status.
ls_itabex-specialization = <fs_emp>-specialization.

READ TABLE it_pos ASSIGNING <fs_pos> WITH KEY ipp_pos_id = <fs_pos_alloc>-ipp_pos_id.
IF sy-subrc = 0.
ls_itabex-designation = <fs_pos>-designation.
READ TABLE it_org ASSIGNING <fs_org> WITH KEY org_id = <fs_pos>-org_id.
IF sy-subrc = 0.
ls_itabex-org_name = <fs_org>-org_name.
ls_itabex-mgr_name = <fs_org>-mgr_name.

READ TABLE it_res ASSIGNING <fs_res> WITH KEY org_id = <fs_org>-org_id.
ls_itabex-org_name = <fs_org>-org_name.

APPEND ls_itabex TO it_itabex.

url = 'http://testweb/scripts/wgate/zvw10a/!?~language=en'.

url2 = '&~OkCode(LGON)=LGON&login-login_user='.

url3 = '&vbcom-vbeln='.

CONCATENATE url url2 url3 INTO fullurl.

WRITE: /'Staffing Excel'.

offset = 12
length = 10
func = fullurl
query_string = qstring
invalid_table = 1

Thanks & Regards,


Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Check the below example program :

data: begin of itab occurs 0,

matnr type mara-matnr,

mtart type mara-mtart,

matkl type mara-matkl,

groes type mara-groes,

end of itab.

data: ifields type table of w3fields with header line.

data: ihtml type table of w3html with header line.

select * into corresponding fields of table itab

from mara up to 100 rows.

call function 'WWW_ITAB_TO_HTML'






html = ihtml

fields = ifields


itable = itab


check sy-subrc = 0.

call function 'GUI_DOWNLOAD'


filename = 'c:\test.html'


data_tab = ihtml.

Reward points if it is helpful



Former Member
0 Kudos

Hi Seshu,

Thanks a lot for your support but this also doesn't give me expected results. The generated html doesn't show any output.My basic requirement is that i need to generate a url from a report or rfc enabled function module and use this url into an excel sheet using "Insert web query".

Thanks & Regards,

Preethi Santhanam.