Application Development and Automation 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: 
Read only

problem while using CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

Former Member
0 Likes
388

Hello all,

i have a problem, that i need to download data with respect to fieldlables using

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

data: BEGIN OF it occurs 0,

mandt type mandt,

vbeln type vbeln_va,

END OF it.

data: TABULATOR type x value '09'.

types: begin of itt ,

header type string,

end of itt.

data: w_itt type itt,

it1 type table of itt.

data: flds type STRING,

flnam type string.

types: begin of st_pro,

line type string,

end of st_pro.

data: wa_pro type st_pro,

it_pro type table of st_pro.

type-POOLs: slis.

data: gt_fieldcat type SLIS_T_FIELDCAT_ALV.

data: r_alvtab type ref to cl_salv_table,

r_col TYPE REF TO CL_SALV_COLUMNS_TABLE,

r_cols TYPE SALV_T_COLUMN_REF,

wa_col type SALV_S_COLUMN_REF,

ref_col type ref to CL_SALV_COLUMN,

lv_text type string.

START-OF-SELECTION.

SELECT mandt vbeln INTO TABLE it UP TO 10 rows from vbak.

perform get_header1 using it[] changing it1[].

*To get the headers into the table:

loop at it1 into w_itt.

wa_pro-line = w_itt-header.

concatenate wa_pro-line w_itt-header into

wa_pro-line separated by cl_abap_char_utilities=>horizontal_tab.

append wa_pro to IT_pro.

clear wa_pro.

endloop.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

EXPORTING

FILENAME = 'C:\Documents and settings\skurana\Desktop\abc.xls'

FILETYPE = 'DAT'

CHANGING

DATA_TAB = IT_pro[].

FORM get_header1 USING p_TAB type any table

changing P_HEADER type any table.

data: begin of lv_tab occurs 0,

line type string,

end of lv_tab.

CALL METHOD cl_salv_table=>factory

IMPORTING

r_salv_table = r_alvtab

CHANGING

t_table = p_TAB.

CALL METHOD r_alvtab->get_columns

receiving

value = r_col.

CALL METHOD r_col->get

receiving

value = r_cols.

loop at r_cols into wa_col.

ref_col = wa_col-r_column.

CALL METHOD ref_col->get_medium_text

receiving

value = lv_text.

lv_tab-line = lv_text.

append lv_tab.

endloop.

p_HEADER[] = lv_tab[].

ENDFORM. " get_header1

if i execut above code bellow format is coming.

ex format:

client client

salesdocument salesdocument

after that i have to send the data to same internal table.

plz help me its very urgent

Regards

Shweta

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
345

Hello Shweta,

Replace your append loop with the logic as below.

This will give you client# SalesDocument

*To get the headers into the table:

loop at it1 into w_itt.

*wa_pro-line = w_itt-header.

concatenate wa_pro-line w_itt-header into

wa_pro-line separated by cl_abap_char_utilities=>horizontal_tab.

endloop.

WA_PRO-LINE = wa_pro-line+1.

append wa_pro to IT_pro.

clear wa_pro.

Regards,

Naimesh Patel

Read only

0 Likes
345

hello Naimesh,

thank u for ur reply i made again some changes in my code.

headers r coming to internal table , now i have to move the dat respective headers.

i will do code for that

Regards

Shweta