hi all,
below is the sample code for FM GUI DOWNLOAD......
just for the heading purpose i dont want to use the statement with header line ( occurs 0) ,,, if i want to define it using TYPES, thn how should i declare it..
tables: mara, marc, mard.
DATA : components LIKE rstrucinfo OCCURS 0 WITH HEADER LINE.
data: begin of itab occurs 0,
matnr like mara-matnr,
werks like marc-werks,
lgort like mard-lgort,
labst like mard-labst,
speme like mard-speme,
end of itab.
*data: begin of heading occurs 0,*
*text1(38),*
*end of heading.*
parameters: p_werks like marc-werks.
select-options: s_matnr for mara-matnr obligatory,
s_lgort for mard-lgort.
start-of-selection.
select maramatnr marcwerks mardlgort mardlabst mard~speme
from mara
inner join marc
on maramatnr = marcmatnr
inner join mard
on marcmatnr = mardmatnr
and marcwerks = mardwerks
into table itab up to 10 rows
where mara~matnr in s_matnr
and marc~werks eq p_werks
and mard~lgort in s_lgort.
U can manually use the following appends if the itab table is not huge..But if it big, i prefer FM get_component_list*
*clear: heading.
*heading-text1 = 'Material'.
*append heading.
*heading-text1 = 'Plant'.
*append heading.
*heading-text1 = 'St.Loc'.
*append heading.
*heading-text1 = 'Unres'.
*append heading.
*heading-text1 = 'Block'.
*append heading.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'ITAB'
TABLES
components = components.
loop at components.
clear heading.
concatenate components-compname '(' components-olen ')' into heading-text1.
condense heading-text1 no-gaps.
append heading.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\corporate.xls'
FILETYPE = 'DAT'
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES = heading
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.