File Format Mismatch while update into Internal table using RFC_REMOTE_FILE
Hi All,
I used RFC_REMOTE_FILE to communicate with the presentation server in Background Mode. I connected successfully and got output too.
But my requirement is to update the .csv file into internal tables.
With RFC_REMOTE_FILE i can get the data as single row. But I can't separate the fields and update into the corressponding table field.
What is the solution for the above issue. Could anyone help me.
For the above RFC Communication I followed the below link
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2&overridelayout=true
Hi All,
I used RFC_REMOTE_FILE to communicate with the presentation server in Background Mode. I connected successfully and got output too.
But my requirement is to update the .csv file into internal tables.
With RFC_REMOTE_FILE i can get the data as single row. But I can't separate the fields and update into the corressponding table field.
What is the solution for the above issue. Could anyone help me.
For the above RFC Communication I followed the below link
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2&overridelayout=true
Similar Messages
-
How to join THREE different tables into internal table using one select statement .
How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
carrid TYPE spfli-carrid ,
connid TYPE spfli-connid ,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom ,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto ,
fldate TYPE sflight-fldate ,
seatsmax TYPE sflight-seatsmax ,
seatsocc TYPE sflight-seatsocc ,
seatsmax_b TYPE sflight-seatsmax_b,
seatsocc_b TYPE sflight-seatsocc_b,
seatsmax_f TYPE sflight-seatsmax_f,
seatsocc_f TYPE sflight-seatsocc_f,
class TYPE sbook-class,
END OF ty_xx,
t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
spfli~connid
spfli~countryfr
spfli~cityfrom
spfli~countryto
spfli~cityto
sflight~fldate
sflight~seatsmax
sflight~seatsocc
sflight~seatsmax_b
sflight~seatsocc_b
sflight~seatsmax_f
sflight~seatsocc_f
sbook~class
INTO TABLE it_xx
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid
AND spfli~connid = sflight~connid
INNER JOIN sbook
ON spfli~carrid = sbook~carrid
AND spfli~connid = sbook~connid.
Thanks,
Yawa -
Download database table content into internal table using Function Module?
HI,
Experts,
I need a function module which can download ddic table content into internal table.
Thank u ,
Shabeer Ahmed.>
shabeer ahmed wrote:
> HI,
> Experts,
>
> I need a function module which can download ddic table content into internal table.
>
> Thank u ,
> Shabeer Ahmed.
Hi Shabeer,
We don't require a function module to download ddic table content to an internal table. We can use the SELECT statement for the same. Example would be:-
DATA: <INTERNAL TABLE> type table of <DATABASE>.
SELECT * FROM <DATABASE> into corresponding fields of <INTERNAL TABLE>.
Also, function module might be required when you need the data from a remote system, but then it is the developer's task create this function module and the function module should be remote enabled function module.
This remote enable function module should have the above SELECT query as its code.
Many Regards,
Ravi. -
How to upload all excel files data from one folder into internal table.
Dear All,
I have one requirement, It is like I want to upload the frontend file data into my internal table, But here my scenario is;
If I have one folder ( Called : Temp) in my frontend system, in this folder ( Called : Temp) I have 100 excel files. In each excel file I have some 1000u2019s of entries. All these data of every file I want to take into my internal table.
If I have one file I can go for, CALL METHOD cl_gui_frontend_services=>file_open_dialog and then upload method to upload. But I want to take all these excel files from that folder at a time, is there any class or any thing is there..? plz help..
Thanks...
Edited by: satishsuri on Jan 11, 2011 9:33 AMHi satishsuri ,
You will have to use 3 methods together :
CALL METHOD cl_gui_frontend_services=>directory_browse "Browse the Directory
CALL METHOD cl_gui_frontend_services=>directory_list_files "Get all the files from the directory
CALL METHOD cl_gui_frontend_services=>gui_upload "Upload each file in a loop
Example:
TYPES: BEGIN OF ty_data,
line TYPE string,
END OF ty_data.
DATA: str_file TYPE string,
str_dir TYPE string,
it_file_table TYPE STANDARD TABLE OF file_info,
wa_file_table TYPE file_info,
v_count TYPE i,
it_data TYPE STANDARD TABLE OF ty_data,
wa_data TYPE ty_data.
CALL METHOD cl_gui_frontend_services=>directory_browse
CHANGING
selected_folder = str_dir.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = str_dir
CHANGING
file_table = it_file_table
count = v_count.
LOOP AT it_file_table INTO wa_file_table.
CONCATENATE str_dir wa_file_table-filename INTO str_file SEPARATED BY '\'.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = str_file
filetype = 'ASC'
CHANGING
data_tab = it_data.
LOOP AT it_data INTO wa_data.
WRITE : / wa_data-line.
ENDLOOP.
ULINE.
ENDLOOP.
Regards,
Jovito -
Uploading EXCEL file into Internal Table Using GUI_UPLOAD
Can any one please give me an example use of FM "GUI_UPLOAD" which to upload a EXCEL file????? (not .txt)
Use the forum search option [GUI_UPLOAD FOR EXCEL|https://forums.sdn.sap.com/search.jspa?threadID=&q=GUI_UPLOADFOREXCEL&objID=c42&dateRange=all&numResults=15&rankBy=10001]) or sdn wiki/code gallery ([UPLOAD EXCEL|https://wiki.sdn.sap.com/wiki/dosearchsite.action?searchQuery.queryString=upload+Excel&searchQuery.spaceKey=conf_global]) - Same question already answered many time
GUI_UPLOAD doesnt perform such conversion (Excel, Word, PDF) and wont give you a suitable result, use one of the FM mentioned above or [office integration|http://help.sap.com/saphelp_47x200/helpdata/en/21/b53138e1ba11d2bdbe080009b4534c/frameset.htm] or OLE or convert your Excel sheet to a simpler format : txt, csv, xml.
Regards,
Raymond -
Saving .csv into internal table - using dataset (',' comes between data)
Hi experts,
I need to save .csv from application server to internal table.
i am using the below code.
gt_raw and gwa_raw are dxrawdata format.
OPEN DATASET gv_pfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
WRITE:/ 'FILE UPLOAD FAILED - ERROR NO. : ', sy-subrc.
EXIT.
ELSE.
DO.
READ DATASET gv_pfile INTO gwa_raw.
IF sy-subrc NE 0.
EXIT.
ELSE.
APPEND gwa_raw TO gt_raw.
CLEAR gwa_raw.
ENDIF.
ENDDO.
*--Close the Application server file (Mandatory).
CLOSE DATASET gv_pfile.
ENDIF.
DELETE DATASET gv_pfile.
LOOP AT gt_raw into gwa_raw.
IF SY-TABIX > 1.
SPLIT gwa_raw at ',' into gwa_cust-cust_code
gwa_cust-cust_name
gwa_cust-grp_name
APPEND gwa_cust TO gt_cust.
CLEAR: gwa_cust, gwa_raw.
ENDIF.
ENDLOOP.
My program works fine.
But when the gwa_cust-grp_name contains the value for eg. -> panasonic co., ltd.
it takes till panasonic co., only
and leaves ltd. as i am using SPLIT command.
is there any other way to do this.
plz help me to solve this issue.
thanks.Hi,
I notice you have marked the message as answered, but I just wanted to let you know there is a solution. The trick is to parse into an internal table and then to find and reassemble fields that were split because they contgain a comma. The ABAP program below is a commented example.
Rgds,
Mark
REPORT zcsv_parse.
DATA:
tokens TYPE i.
TYPES: BEGIN OF ty_result,
company TYPE char20,
compnr TYPE i,
city TYPE char30,
country TYPE char30,
END OF ty_result.
DATA:
gt_rawtab TYPE TABLE OF string,
gw_rawtab LIKE LINE OF gt_rawtab,
gt_result TYPE TABLE OF ty_result,
gw_result LIKE LINE OF gt_result,
gt_parse TYPE TABLE OF string,
gw_parse LIKE LINE OF gt_parse.
DEFINE %csvline.
gw_rawtab = &1.
append gw_rawtab to gt_rawtab.
END-OF-DEFINITION.
START-OF-SELECTION.
* Create CSV lines, some with a comma inside a token
%csvline '"CompanyOne NV",500,"Antwerp","Belgium"'.
%csvline '"CompanyTwo,Inc",600,"New York,NY","USA"'.
%csvline '"CompanyThree,Ltd",700,"Sydney,NSW","Australia"'.
* Parse the raw CSV
LOOP AT gt_rawtab INTO gw_rawtab.
REFRESH gt_parse.
SPLIT gw_rawtab AT ',' INTO TABLE gt_parse.
DESCRIBE TABLE gt_parse LINES tokens.
* If extra commas: token count higher than field count
IF tokens > 4.
PERFORM reassemble.
ENDIF.
* At this point each entry in GT_PARSE contains exactly
* one result field => build the result table
LOOP AT gt_parse INTO gw_parse.
* Strip quotes from text fields
REPLACE ALL OCCURRENCES OF '"' IN gw_parse WITH ''.
CASE sy-tabix.
WHEN 1. gw_result-company = gw_parse.
WHEN 2. gw_result-compnr = gw_parse.
WHEN 3. gw_result-city = gw_parse.
WHEN 4. gw_result-country = gw_parse.
ENDCASE.
ENDLOOP.
APPEND gw_result TO gt_result.
ENDLOOP.
* Show the formatted result
LOOP AT gt_result INTO gw_result.
WRITE: / gw_result-company, gw_result-compnr,
gw_result-city, gw_result-country.
ENDLOOP.
*& Form reassemble
* Merges tokens that were split because they contain a comma
FORM reassemble.
DATA: lastpos TYPE i,
lastchar TYPE c,
currtoken LIKE sy-tabix,
nexttoken LIKE sy-tabix,
gw_next LIKE gw_parse.
LOOP AT gt_parse INTO gw_parse.
lastpos = STRLEN( gw_parse ) - 1.
lastchar = gw_parse+lastpos(1).
* Token starts with quote but does not end with one =>
* must merge with the next token
IF gw_parse+0(1) = '"' AND lastchar <> '"'.
currtoken = sy-tabix.
nexttoken = sy-tabix + 1.
READ TABLE gt_parse INTO gw_next INDEX nexttoken.
CONCATENATE gw_parse gw_next INTO gw_parse SEPARATED BY ','.
MODIFY gt_parse FROM gw_parse INDEX currtoken.
DELETE gt_parse INDEX nexttoken.
ENDIF.
ENDLOOP.
ENDFORM. "reassemble -
Get Multiple Rows into internal Table using Webdynpro Alv Display ..
Hi guys ,
I need to find out the logic for getting all the selected rows into the internal table.
When i display the ALV Output on webdypro screen .
USer Selects multiple rows for further processing ..
Ineed to get all the rows selected by user into an internal table .
Please let me know how to achive this ...
Thanks in advance for quick reply
Regards
Saurabh GoelHi,
You need to use the method GET_SELECTED of IF_WD_CONTEXT_NODE to get the rows selected. Also ccheck for the paramters of that method, this retruns the element set.
This meets your requirement.
Regards,
Lekha. -
Getting Issue while uploading CSV file into internal table
Hi,
CSV file Data format as below
a b c d e f
2.01E14 29-Sep-08 13:44:19 2.01E14 SELL T+1
actual values of column A is 201000000000000
and columen D is 201000000035690
I am uploading above said CSV file into internal table using
the below coding:
TYPES: BEGIN OF TY_INTERN.
INCLUDE STRUCTURE KCDE_CELLS.
TYPES: END OF TY_INTERN.
CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
EXPORTING
I_FILENAME = P_FILE
I_SEPARATOR = ','
TABLES
E_INTERN = T_INTERN
EXCEPTIONS
UPLOAD_CSV = 1
UPLOAD_FILETYPE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
am getting all columns data into internal table,
getting problem is columan A & D. am getting values into internal table for both; 2.01E+14. How to get actual values without modifying the csv file format.
waiting for your reply...
thanks & regards,
abhiHi Saurabh,
Thanks for your reply.
even i can't double click on those columns.
b'se the program needs be executed in background there can lot of csv file in one folder. No manual interaction on those csv files.
regards,
abhi -
Loading Text data into internal table
I have a text file to load txt data into internal table. So how to read text data with validation and to load all text data into the internal table?
Say this is the text file:
IO_NAME, IO_TYPE, IO_SHTXT, IO_LONGTEXT, DATATYPE, DATA LENGTH
ZIO_TEST1, CHA, IO TEST1, IO TEST 1, CHAR, 20
ZIO_TEST2, CHA, IO TEST2, IO TEST 2, CHAR, 20
Regards,
Mauhi Mau,
look this code, maybe it's help u.
<b>REPORT ZTXTTOTABLE.</b>
DATA: p_file TYPE string value 'C:\teste.txt',
BEGIN OF TI_table OCCURS 0,
COD(5) TYPE C,
NAME(40),
END OF TI_table,
a(2).
PARAMETERS: sel_file(128) TYPE c
default 'C:\teste.txt' OBLIGATORY LOWER CASE.
p_file = sel_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
TABLES
data_tab = ti_table[].
format color COL_TOTAL INTENSIFIED ON.
loop at ti_table.
write: / sy-vline, ti_table-cod, at 10 sy-vline, ti_table-name,
at 60 sy-vline.
endloop.
write: / sy-uline(60).
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
top-of-page.
format color COL_HEADING INTENSIFIED ON.
uline (60).
write: / sy-vline, 'COD', at 10 sy-vline, 'NAME', at 60 sy-vline.
write: / sy-uline(60).
good luck!
Regards
Allan Cristian -
Upload file of type Spreadsheet.ods to internal table
Hi Experts,
can any body give me function module to upload file of type Spreadsheet.ods into internal table
Thanks in Advance
NarendraHi Renu,
it is not supporting this function modules.
we r using open office and its just like excel sheet.
even function module ALSM_EXCEL_TO_INTERNAL_TABLE
not supporting.
Narendra -
How to load text data into internal table
I have a text file to load txt data into internal table. So how to read text data with validation and to load all text data into the internal table?
Say this is the text file:
IO_NAME, IO_TYPE, IO_SHTXT, IO_LONGTEXT, DATATYPE, DATA LENGTH
ZIO_TEST1, CHA, IO TEST1, IO TEST 1, CHAR, 20
ZIO_TEST2, CHA, IO TEST2, IO TEST 2, CHAR, 20
Regards,
MauHi,
U can use GUI_UPLOAD for this...
Declare an internal table like
data: begin of itab occurs 0,
string(1200),
end of itab.
check the sample code:
cange as you need
DATA: DATEI_PC TYPE STRING VALUE 'C:\MATNR.TXT'.
DATA: BEGIN OF ITAB occurs 0,
TXT(1024),
END OF ITAB.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = DATEI_PC
FILETYPE = 'ASC'
CHANGING
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
NOT_SUPPORTED_BY_GUI = 17
ERROR_NO_GUI = 18
OTHERS = 19.
IF SY-SUBRC NE 0. WRITE: / 'Error in Uploading'. STOP. ENDIF.
WRITE: / 'UPLOAD:'.
LOOP AT ITAB. WRITE: / ITAB-TXT. ENDLOOP. -
Error while reading excel file from application server into internal table.
Hi experts,
My requirement is to read an excel file from application server into internal table.
Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
Now in my program I have used :
OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
DO.
READ DATASET v_filename INTO wa_tab.
The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
Error details:
A character set conversion is not possible.
At the conversion of a text from codepage '4110' to codepage '4103':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 445. If this number is 0, the second error case, as
mentioned above, has occurred.
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught and
therefore caused a runtime error.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4103' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
Regards,
KarthikHi,
Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
As I think you are uploading the file in BIN format to Application server and trying to open text file.
Regards,
Umang Mehta -
Issue with uploading XML file from application server into internal table
i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module SMUM_XML_PARSE and the error message is "line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?
TYPES: BEGIN OF T_XML,
raw(2000) TYPE C,
END OF T_XML.
DATA:GW_XML_TAB TYPE T_XML.
DATA: GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
DATA:GI_STR TYPE STRING.
data: GV_XML_STRING TYPE XSTRING.
DATA: GI_XML_DATA TYPE TABLE OF SMUM_XMLTB INITIAL SIZE 0.
data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'File does not exist' TYPE 'E'.
ELSE.
DO.
* Transfer the contents from the file to the work area of the internal table
READ DATASET LV_FILE1 INTO GW_XML_TAB.
IF SY-SUBRC EQ 0.
CONDENSE GW_XML_TAB.
* Append the contents of the work area to the internal table
APPEND GW_XML_TAB TO GI_XML_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
* Close the file after reading the data
CLOSE DATASET LV_FILE1.
IF NOT GI_XML_TAB IS INITIAL.
CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
ENDIF.
* The function module is used to convert string to xstring
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = GI_STR
IMPORTING
BUFFER = GV_XML_STRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE 'Error in the XML file' TYPE 'E'.
ENDIF.
ENDIF.
IF GV_SUBRC = 0.
* Convert XML to internal table
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = GV_XML_STRING
TABLES
XML_TABLE = GI_XML_DATA
RETURN = GI_RETURN.
ENDIF.
READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ 0.
MESSAGE 'Error converting the input XML file' TYPE 'E'.
ELSE.
DELETE GI_XML_DATA WHERE TYPE <> 'V'.
REFRESH GI_RETURN.
ENDIF.Could you please tel me why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
Becuase there will be lot of XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?> ??????
Is there any other way we can do with out removing the lines? -
Bdc upload file data into internal table problem with gui_upload fm
Hello experts,
my coding is like this ..
data : begin of itab occurs 0 .
field1 like mara-matnr,
field2......
etc,
end of itab.
data: file1 type string.
parameter :file like rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
mask = space
field_name = 'FILE'
CHANGING
file_name = file.
START-OF-SELECTION.
FILE1 = FILE . "HERE I AM PASSING INTO STRING
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FILE1
FILETYPE = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
file structure is same as the internal table.
I stored the file as .txt( ie in notepad).
my file is like this..
10000 200 323 sunndarrr.......
i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
when i am using the ws_upload it is working fine.
please guide me where i have done the mistake.
thank you so much for all the replies.Hi,
Have a look on the following code.
TABLES: kna1.
DATA: BEGIN OF itab1 OCCURS 0,
str(255),
END OF itab1.
DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'D:\ABAP EVE\ffile1.txt'
filetype = 'ASC'
TABLES
data_tab = itab1
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE:/ 'sorry'.
ELSE.
LOOP AT itab1.
SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
APPEND itab2.
ENDLOOP.
IF sy-subrc = 0.
LOOP AT itab2.
WRITE:/ itab2-kunnr,itab2-name1.
INSERT INTO kna1 VALUES itab2.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ 'inserted'.
ELSE.
WRITE:/ 'not inserted'.
ENDIF.
ELSE.
WRITE:/ 'fail'.
ENDIF.
ENDIF.
Flat file:
10001,Sadney
10003,Yogesh
20005,Madan
1.U need to define internal table with one field of max size
2.upload the flat file data into that internal table
3.split that internal table data into another internal table(having fields)
<REMOVED BY MODERATOR>
thanks,
Chandu
Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM -
Read Application server file and upload into internal table
Another help needed guys,
My file in the application server is of format
Name Marks 1 Marks 2 Marks 3............
A 10 15 20
The only thing separating the columns is space.
Actually this file was downloaded from an internal table into the app server.
Now I want to load it back into the internal table.
How do I load this into internal table so that each column goes in separate internal table field.
Currently am using cl_abap_char_utilities=>HORIZONTAL_TAB but I can get only the first column name in my field1 of the internal table.
How should I applroach this?
Points will be awarded for useful answers.
Regards
AnkitHi ankit,
i think u have uploaded the tab delimited file in the application sever.
then suppose see if u r file is in the format of name#marks1#marks2#marks3.
then in the program u do like this..
first declare one internal table with one filed.
data:
c_hextab(1) TYPE x VALUE '09'.
data:
begin of t_data occurs 0,
line(256) type c,
endof t_data.
and declare one more intternal table
data:
begin of t_itab occurs 0,
name(15) type c,
marks1(4) type c,
marks2(4) type c,
marks3(4) type c,
endof t_itab.
then
open the file with
OPEN DATASET p_file FOR INPUT IN TEXT MODE.
then between do and endo do like this..
DO.
clear t_data.
READ DATASET p_file INTO t_data.
if sy-subrc ne 0.
exit.
else.
split t_data at c_hextab
into t_itab-name
t_itab-marks1
t_itab-marks2
t_itab-marks3.
append t_itab.
endif.
enddo.
i think it will be helpful to u
Please let me know wht type of file has been uploaded into application server.(tab deleimted, comma separated or something else).
Regards,
Sunil Kumar Mutyala.
Maybe you are looking for
-
Change of tax code determination
Hello, I want to change tax code determination when shipping to customers, where to setup this in SAP ? Regards. Zied.
-
"Unknown Publisher" error message during installation
Ok, I have tried for several days and even got ahold of Microsoft on this issue. Every time i go to download Itunes the download is ok, but when it goes to install Itunes, I ALWAYS get "Unknown Publisher" error message and installation is cancelled.
-
With Firefox 3, I had no trouble downloading cross-word puzzles from the NY Times website, using the app. Across Lite. After installing Firefox 4, each attempt to download a puzzle evoked the message that the file could not be opened "because an unkn
-
Fact Design , Any Aggragation ?
Hi , this is my Fact Table | ProjectID | ProjectSeq | PlanPercentYearly | month | PlanPercentMonthly | | | | | | | | 1 | 1 | 100 | 1 | 10 | | 1 | 1 | 100 | 1 | 10 | | 1 | 1 | 100 | 1 | 5 | | 1 | 2 | 100 | 3 | 20 | | 1 | 2 | 100 | 5 | 10 | | 1 | 2 | 1
-
Adobe changes after installing Dragon
Help. I recently installed Dragon 11, i'm running Acrobat 9 on win 7. Adobe recognized the speech program, asked me questions which i now regret not thinking through, and now opens docs with text recognition - i can highlite, etc. - which i may find