2006 Nov 20 9:04 AM
actually i have o/p internal table like below.
DATA : BEGIN OF l_t_output_raw_header_data OCCURS 0,
seq_no(8), "Sequence Number
sys_id(6), "System Id + Client number
vbeln LIKE vbrk-vbeln, " sales and distribution document number
taxk1 LIKE vbrk-taxk1, " tax clssification 1 for customer
taxk4 LIKE vbrk-taxk4, " tax clssification 4 for customer
fkart LIKE vbrk-fkart, " billing type
inco1 LIKE vbrk-inco1, " incoterms (part1)
inco2 LIKE vbrk-inco2, " incoterms (part 2)
zterm LIKE vbrk-zterm, " terms of payment key
kunag LIKE vbrk-kunag, " sold to party
vkorg LIKE vbak-vkorg, " sales organization
auart LIKE vbak-auart, " sales document type
spart LIKE vbak-spart, " division
vtweg LIKE vbak-vtweg, " distribution channel
lfdat LIKE likp-lfdat, " delivery date.
END OF l_t_output_raw_header_data. " l_t_output_raw_header_data.
for this internal table having datas. that internal table iam going to download using gui_download functional modules.
the datas are downloaded in text file correctly.
but i want to put heading in each columns wise in that text file top, with out using functional modules download condition.
examble:
seq_no system id billing document
1 dvd 0000123
2 dvd 0000124
like that.
2006 Nov 20 9:11 AM
Hi Santosh,
You can achieve the same by calling Gui_Download twice.
1.First download the header to the file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\download.txt'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X '
tables
data_tab = itab_header.
2. Then download the data.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\download.txt'
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X '
tables
data_tab = itab_data." the internal table defined by u as
"under.
Regards,
Chetan.
PS:Reward points if this is helpful.
actually i have o/p internal table like below.
DATA : BEGIN OF l_t_output_raw_header_data OCCURS 0,
seq_no(8), "Sequence Number
sys_id(6), "System Id + Client number
vbeln LIKE vbrk-vbeln, " sales and distribution document number
taxk1 LIKE vbrk-taxk1, " tax clssification 1 for customer
taxk4 LIKE vbrk-taxk4, " tax clssification 4 for customer
fkart LIKE vbrk-fkart, " billing type
inco1 LIKE vbrk-inco1, " incoterms (part1)
inco2 LIKE vbrk-inco2, " incoterms (part 2)
zterm LIKE vbrk-zterm, " terms of payment key
kunag LIKE vbrk-kunag, " sold to party
vkorg LIKE vbak-vkorg, " sales organization
auart LIKE vbak-auart, " sales document type
spart LIKE vbak-spart, " division
vtweg LIKE vbak-vtweg, " distribution channel
lfdat LIKE likp-lfdat, " delivery date.
END OF l_t_output_raw_header_data. " l_t_output_raw_header_data.
for this internal table having datas. that internal table iam going to download using gui_download functional modules.
the datas are downloaded in text file correctly.
but i want to put heading in each columns wise in that text file top, with out using functional modules download condition.
examble:
seq_no system id billing document
1 dvd 0000123
2 dvd 0000124
like that.
2006 Nov 20 9:08 AM
Hello Santhosth,
U can try with the below code for the requirement.
Headings: TEXT-U01 ... TEXT-U28
DO 28 TIMES.
CLEAR: L_F_INDEX,L_F_NAME,L_F_HEADERS.
L_F_INDEX = SY-INDEX.
CONCATENATE 'TEXT-U' L_F_INDEX INTO L_F_NAME.
ASSIGN (L_F_NAME) TO <FS_HEADER>.
L_F_HEADERS = <FS_HEADER>.
APPEND L_F_HEADERS TO L_T_HEADERS.
ENDDO.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = SP_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = L_T_OUT
FIELDNAMES = L_T_HEADERS
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
LEAVE PROGRAM.
ELSE.
DESCRIBE TABLE L_T_OUT LINES L_F_COUNT.
MESSAGE I145 WITH L_F_COUNT SP_FILE.
ENDIF.
If useful reward.
Vasanth
2006 Nov 20 9:11 AM
Hi Santosh,
You can achieve the same by calling Gui_Download twice.
1.First download the header to the file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\download.txt'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X '
tables
data_tab = itab_header.
2. Then download the data.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\download.txt'
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X '
tables
data_tab = itab_data." the internal table defined by u as
"under.
Regards,
Chetan.
PS:Reward points if this is helpful.
2006 Nov 20 9:12 AM
2006 Nov 20 10:05 AM
hi santosh ,
see the operation has to be done this way
first when u say download option
declare the itab as
begin of itab ,
seq_no(12),
sys_id(12),
vbeln(15)
taxk1 (10),
end of itab.Declare every field as characters with text length in scope.
Now in the first iteration .
Assign the text fields ..
Itab-seq_no = Sequence.
Itab-sys_id = System ID.
Itab-vbeln = Sales Order.
....
Append itab.
Clear itab.This will bring in the header texts ..
Now assign the content fields to the it_download .
Suppose jtab is having all the values
Loop at jtab.
Itab-seq_no = jtab-seqno .
Itab-sys_id = jtab-sys_id.
Itab-vbeln = jtab-vbeln.
.
.
Append itab .
Clear itab.
Endloop.Now if u put a breakpoint and check the content on itab
It will be
seq_no system id billing document
1 dvd 0000123
2 dvd 0000124which is downloaded in to the excel directly.
follow the same ..
regards,
VIjay