Skip to Content
0
Former Member
Jul 11, 2007 at 03:18 AM

Generate a url from a report or function module

129 Views

Hi,

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.
ENDIF.

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.
ENDIF.
ENDIF.

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.
ENDLOOP.

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'.

CALL FUNCTION 'WWW_SET_URL'
EXPORTING
offset = 12
length = 10
func = fullurl
TABLES
query_string = qstring
EXCEPTIONS
invalid_table = 1
OTHERS = 2.

Thanks & Regards,

Preethi.