2008 Jun 13 4:24 AM
Hi Friends,
Can you just help me in this topic mentioned below. The question is 'How to download and upload structures'.
With regards
Ravi
Hi Friends,
Can you just help me in this topic mentioned below. The question is 'How to download and upload structures'.
With regards
Ravi
2008 Jun 13 5:15 AM
Hi Ravi,
pls see the link
http://wiki.ittoolbox.com/index.php/How_can_I_upload_data_to_SAP_and_download_data_to_Excel%3F
http://www.sapfans.com/sapfans/repos/neil.htm
You can upload data from presentation server to an internal table using gui_upload. Use gui_download to download from internal table to flat file.
The FILETYPE refer to the type of file format you need: For e.g 'WK1' - Excel format , 'ASC' - Text Format etc.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\test.csv'
FILETYPE = 'ASC'
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.
or
: BEGIN OF ty_data,
data TYPE char2000,
END OF ty_data.
data : it_data TYPE STANDARD TABLE OF ty_data,
wa_data type ty_data.
let
v_filepath = //pmicstc.in.com/sing/factory/1234.csv.
1234.csv has three columns data (market, product, quantity)
so declare an internal table with these three fields
TYPES : BEGIN OF ty_csv,
markt TYPE zmarket,
matnr TYPE matnr,
quan(15),
END OF ty_csv.
data it_csv type standara table of ty_csv,
wa_csv type ty_csv.
*Open the file and transfer the data into the internal table
OPEN DATASET v_filepath "file path from application server..
FOR
INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
DO.
READ DATASET v_filepath
INTO wa_data .
IF sy-subrc = 0.
APPEND wa_data TO it_data. "it_data will cotains all the rows with delimeter comma
CLEAR wa_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
Now get that file into it_csv
LOOP AT it_data INTO wa_data.
*Spliting the File and appending internal table
SPLIT wa_data AT ',' INTO wa_csv-markt
wa_csv-matnr
wa_csv-quan .
APPEND wa_csv TO it_csv.
ENDLOOP.
now you can loop on it_csv and pass data to BAPI..
This coding will work for sure
rewards if useful..
thanks
karthik
2008 Jun 13 5:53 AM
Hi Ravi,
I will give you some names of fucntion module with the help of those you can solve your purpose.
DDIF_TABL_GET :Interface to read a table from the ABAP Dictionary.
DDIF_TABL_GET: Interface to read a table from the ABAP Dictionary
DDIF_TABL_PUT: Interface to write a table in the ABAP Dictionary
DDIF_NAMETAB_GET I:nterface to Read a Runtime Object from the ABAP Dictionary
I hope with the use of these you can achieve your requirement.