2007 May 02 12:13 AM
Hi,
I have got 54 internal tables populated at the end of the report.
I am using GUI_DOWNLOAD Function to download the data in flat files each corresponding to one internal table.
Now in GUI_DOWNLOAD Function, I know I have to mention name of file and name of table as follows:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = filenam
WRITE_FIELD_SEPARATOR = ' '
FILETYPE = 'ASC'
APPEND = ' '
TABLES
DATA_TAB = ITAB1.
Now I do not want to code GUI_DOWNLOAD 54 times since there are 54 internal tables and I have to mention the name of table always in DAT_TAB parameter.
How can I achieve this ?
Hi,
I have got 54 internal tables populated at the end of the report.
I am using GUI_DOWNLOAD Function to download the data in flat files each corresponding to one internal table.
Now in GUI_DOWNLOAD Function, I know I have to mention name of file and name of table as follows:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = filenam
WRITE_FIELD_SEPARATOR = ' '
FILETYPE = 'ASC'
APPEND = ' '
TABLES
DATA_TAB = ITAB1.
Now I do not want to code GUI_DOWNLOAD 54 times since there are 54 internal tables and I have to mention the name of table always in DAT_TAB parameter.
How can I achieve this ?
2007 May 02 12:17 AM
You can simply wrap the GUI_DOWNLOAD into a subroutine(FORM) and call this FORM over and over.
form download tables itab
using file_name type string.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = file_name
WRITE_FIELD_SEPARATOR = ' '
* FILETYPE = 'ASC'
* APPEND = ' '
TABLES
DATA_TAB = ITAB.
endform.Now just call this FORM with the parameters.
perform download tables itab1
using file_name1.
perform download tables itab2
using file_name2.
perform download tables itab3
using file_name3.Regards,
RIch Heilman
2007 May 02 12:27 AM
Or you could use a macro.
define macro_download.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = &1
WRITE_FIELD_SEPARATOR = ' '
* FILETYPE = 'ASC'
* APPEND = ' '
TABLES
DATA_TAB = &2.
end-of-definition.Then simply call it like so. I think this will work when passing an internal table.
macro_download file1 itab1[].
macro_download file2 itab2[].
macro_download file3 itab3[].
macro_download file4 itab4[].
Regards,
RIch Heilman
2007 May 02 12:46 AM
But I stuck here:
IF PTRVTGPER[] IS NOT INITIAL.
Concatenate '
bma-files-06\redirectedfolders$\tushar.shah\Desktop\TREATY_TABLE_DATA\' 'PTRVTGPER.txt' into FNAME.
perform download tables PTRVTGPER
using FNAME.
ENDIF.
I don't want to put 'PTRVTGPER.txt' in concatenate function, I want that name to be dynamcially taken when I am doing concatenation of string after initial check of internal table ?????
2007 May 02 12:59 AM
Ok, if you path is constant, then just pass the filename and concatenate inside the FORM.
[code]IF PTRVTGPER[] IS NOT INITIAL.
fname = 'ptrvtgper.txt'.
perform download tables PTRVTGPER
using FNAME.
ENDIF.
form download tables itab using fname type string.
Concatenate '
bma-files-06\redirectedfolders$\tushar.shah\Desktop\TREATY_TABLE_DATA\' fname
into FNAME.
.....
Endform.[/code]
Regards,
RIch Heilman
2007 May 02 12:56 AM
Hi,
Probably have three parameters for the subroutine..
perform download tables PTRVTGPER
<b>* Folder - File path</b>
using 'Concatenate '
bma-files-06\redirectedfolders$\tushar.shah\Desktop\TREATY_TABLE_DATA\'
<b>* File name</b>
'PTRVTGPER.txt'.
FORM download tables itab
using folder
fname.
IF NOT ITAB[] IS INITIAL.
<b> Concatenate folder fname INTO fname.</b>
Call the FM GUI_DOWNLOAD..
ENDIF.
ENDFORM.
Is this what you want??
Thanks,
Naren
2007 May 02 1:01 AM
No, I think I am trying to be too much ambitious. I wanted the name of the internal table to get populated in the .txt name and I don't have to write it. I was trying to do this because I have 54 internal tables, hence if I do the way you guys are suggesting then I have to mention name of the internal tables 54 timesbecause I ma using the name of internal table as file name, every time i concatenate....
2007 May 02 1:04 AM
Hi,
As mentioned pass the internal table name in the subroutine parameter..
Thanks,
Naren
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |