2008 Sep 22 5:24 AM
Hi all,
We are having 7 businesses for which files are generated. These 7 files need to be consolidated into a single output file. Is there any standard FM or others to achieve this functionality?
Any pointers in this case would be greatly helpful.
Thanks in Advance,
Thanks & Regards
Gowthami
2008 Sep 22 5:53 AM
Hi Gouthami,
I dont think there is a stadard FM for this, but you can write your own code with GUI_UPLOAD and GUI_DOWNLOAD to consolidate and store it in a single file.
Revert back if u need more clarification.
Search SDN with GUI_UPLOAD and GUI_DOWNLOAD to find examples.
Regards
Karthik D
2008 Sep 22 5:56 AM
Hi Karthik,
Thanks for the reply. I would get back to you in case of any clarifications.
Thanks & Regards
Gowthami
2008 Sep 22 3:17 PM
Hi Gowthami,
Welcome To SDN,
Use GUI_DOWNLOAD and GUI_UPLOAD FM's.
Get all the 7Files data into One single internal table using GUI_UPLOAD and then Download that internal table to a local File using GUI_DOWNLOAD.
Check this Sample code for GUI_DOWNLOAD
*"Selection screen elements............................................
Parameter:
p_file TYPE string. " Filename for PS
*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Work variables *
*"--------------------------------------------------------------------*
DATA:
w_data(72) TYPE c. " Data storage
*"--------------------------------------------------------------------*
* Internal table to hold data from table BKPF. *
*"--------------------------------------------------------------------*
DATA :
BEGIN OF t_bkpf OCCURS 0,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Accounting Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
blart TYPE bkpf-blart, " Document type
bldat TYPE bkpf-bldat, " Document date in document
budat TYPE bkpf-budat, " Posting date in document
monat TYPE bkpf-monat, " Fiscal period
cpudt TYPE bkpf-cpudt, " Accounting Document entry date
END OF t_bkpf.
*"--------------------------------------------------------------------*
* START-OF-SELECTION EVENT *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
Select * from bkpf into corresponding fields of t_bkpf.
* in this place use GUI_UPLOAD and get the data into internal table and pass that internal table in the following FM.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = w_file
* FILETYPE = 'ASC'
* APPEND = ' '
write_field_separator = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* IMPORTING
* FILELENGTH =
TABLES
data_tab = t_bkpf
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. " IF SY-SUBRC NE 0.
Please revert back if any questions.
Hope this would solve your issue.
Good luck
Narin