‎2008 Feb 12 7:40 AM
Hi gurus,
I want upload flatfile data into ztable.How can i do it?after uploading that should be triggerd to CORK tcode.........pls........help me with sample code..........
Thank you in advance
‎2008 Feb 12 7:45 AM
Hi,
use function module 'gui_upload'
data:
begin of ztable occurs 10,
tab type c length 200,
end of ztable.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'ur file path'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
tables
data_tab = ztable
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Plzz reward points if it helps.
‎2008 Feb 12 7:44 AM
Hi,
Declare the internal table like the structure of ztable and then use GUI_UPLOAD FM to uplaod data to ur internal table and finally update ur ztable with the internal table
update ztable from table itab.
if sy-subrc eq 0.
commit work.
endif.
Regards,
Nagaraj
‎2008 Feb 12 7:45 AM
Hi,
use function module 'gui_upload'
data:
begin of ztable occurs 10,
tab type c length 200,
end of ztable.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'ur file path'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
tables
data_tab = ztable
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Plzz reward points if it helps.
‎2008 Feb 12 7:48 AM
Hi that greate answer,but aster uploading that i need to trigger CORK Tcode ...how it is?pls
‎2008 Feb 12 7:47 AM
Hi
To upload a flatfile u can use FM 'GUI_UPLOAD'. Here is the sample code.
DATA: i_file like rlgrap-filename value 'C:/tmp/file.txt'.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = i_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
Regards
Gaurav
‎2008 Feb 12 7:47 AM
Hi Ramkrishna,
No need to write a program to upload data into a z table. Instead you can use tools like SCATT. Use the following idiots guide to SCATT: http://www.qsands.com/QSandS_CATT_Step_By_Step.pdf
Reward if useful
rgds,
Harikrishna
‎2008 Feb 12 8:01 AM
Hi
After uploading the file .... instead of Tcode CORK to create Process Order confirmation, you can use the fm 'BAPI_PROCORD_CREATE' passing the parameters from internal table
Regards
Gaurav