07-12-2006 12:14 PM
I wanted to download the table into an xls with the fieldnames .how do i do that?
07-12-2006 4:15 PM
Hi Nilotpala,
Welcome to SDN.
You can code something like this. Let's say you want to download table MARA fieldnames.
DATA: BEGIN OF I_DFIES OCCURS 0.
INCLUDE STRUCTURE DFIES.
DATA: END OF I_DFIES.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = 'MARA'
LANGU = SY-LANGU
TABLES
DFIES_TAB = I_DFIES
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:/TEMP/MARA.XLS'
FILETYPE = 'DAT'
TABLES
DATA_TAB = I_DFIES
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.
Hope this will help.
Regards,
Ferry Lianto
Please reward points if helpful.
07-12-2006 4:15 PM
Hi Nilotpala,
Welcome to SDN.
You can code something like this. Let's say you want to download table MARA fieldnames.
DATA: BEGIN OF I_DFIES OCCURS 0.
INCLUDE STRUCTURE DFIES.
DATA: END OF I_DFIES.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = 'MARA'
LANGU = SY-LANGU
TABLES
DFIES_TAB = I_DFIES
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:/TEMP/MARA.XLS'
FILETYPE = 'DAT'
TABLES
DATA_TAB = I_DFIES
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.
Hope this will help.
Regards,
Ferry Lianto
Please reward points if helpful.
07-14-2006 9:50 AM
Hi,
Thanks a lot for the reply Ferry.
But on downloading the table fields all other attributes like the data elements are also being populated how do i get the fieldnames populated in the first row of the document.
Regards,
Nilotpala