REPORT ZFILENAME_TEST. TABLES : MARA. *************************INTERNAL TABLE DECLARATION***************** TYPES : BEGIN OF ITAB, MATNR TYPE MARA-MATNR, MEINS TYPE MARA-MEINS, ERNAM LIKE MARA-ERNAM, AENAM LIKE MARA-AENAM, MTART LIKE MARA-MTART, END OF ITAB. DATA : IG_ITAB type ITAB OCCURS 0. DATA : V_FILE TYPE STRING. DATA : T_FILE TYPE RLGRAP-FILENAME. ***********************RETRIVE DATA FROM DATABASE******************* break sgopal. SELECT MATNR MEINS ERNAM AENAM MTART FROM MARA INTO CORRESPONDING FIELDS OF TABLE IG_ITAB up to 10 rows. *****************CALLING FUNCTION MODULES************************** CALL FUNCTION 'F4_FILENAME' "PASS THE FILE NAME AS U NEED. EXPORTING * PROGRAM_NAME = SYST-CPROG * DYNPRO_NUMBER = SYST-DYNNR FIELD_NAME = 'T_FILE' IMPORTING FILE_NAME = T_FILE. V_FILE = T_FILE. "STRING CONVERSION ***************CALLING GUI DOWNLOAD TO EXTRACT********************* CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING * BIN_FILESIZE = filename = V_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 = ' ' * TRUNC_TRAILING_BLANKS_EOL = 'X' * WK1_N_FORMAT = ' ' * WK1_N_SIZE = ' ' * WK1_T_FORMAT = ' ' * WK1_T_SIZE = ' ' * IMPORTING * FILELENGTH = tables data_tab = IG_ITAB * FIELDNAMES = 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.
Serkan AKKAVAK Computer Engineer ABAP Developer & SAP MM SD Consultant Contact : serkurumsal@yandex.com
Social Plugin