2008 Mar 11 7:12 AM
Hi,
I have to upload data into an Internal table from Application Server. Is there any FM to do the same. please help me its urgent..
Regards,
2008 Mar 11 7:13 AM
To upload file from PC :
**Internal table matching columns in XLS
DATA: BEGIN OF itab OCCURS 0,
field1(10) TYPE c,
field2(10) TYPE c,
END OF itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'E:\Vaibhav\PivotTableEg.xls'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Reward points..
2008 Mar 11 7:15 AM
Hi,
Check this code. It might help you.
TYPES : BEGIN OF x_file,
matnr like mara-matnr, "Material Number
werks like mard-werks, "Plant
budat(10) type c, "Posting Date
bldat(10) type c, "Document Date
bmeng like stko-bmeng, "Base Quantity
bom_matnr like mara-matnr, "Material Number
bom_bmeng like stko-bmeng, "Base QUantity
END OF x_file.
Data : it_file TYPE STANDARD TABLE OF x_file INITIAL SIZE 0,
wa_file TYPE x_file.
FORM dataset_open USING p_filename.
OPEN DATASET p_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string,wa_file.
READ DATASET p_filename INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO : wa_file-matnr
wa_file-werks
wa_file-bmeng
wa_file-budat
wa_file-bldat
wa_file-bom_matnr
wa_file-bom_bmeng.
APPEND wa_file TO it_file.
ENDIF.
ENDDO.
CLOSE DATASET p_file.
ENDIF.
ENDFORM. " dataset_open
Regards,
Omkar.
2008 Mar 11 7:16 AM
You can not do that using FM's, rather you need to use the statements
Open Dataset, read dataset, transfer, and close dataset statements to write the data from app server file to internal table.
You can either use the tcode CG3Y to download file data on appl server to your local PC.
Regards
Gopi
2008 Mar 11 7:30 AM
Hai Saritha
Just USe This Function Module C13Z_APPL_TO_FRONT_END
it Will just ASk For File paths.
If Found Helpfull.
Do Reward.
Regards.
Eshwar.
2008 Mar 11 8:10 AM
Hi saritha,
use this FM
call function 'F4_DXFILENAME_TOPRECURSION'
exporting
i_location_flag = 'A'
i_server = 'RPMSAP3_RES_00'
I_PATH =
filemask = '.'
fileoperation = 'R'
importing
O_LOCATION_FLAG =
O_SERVER =
o_path = p_file_path
ABEND_FLAG =
exceptions
rfc_error = 1
error_with_gui = 2
others = 3
.
reward points if helpful,
kushagra