Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading data

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

6 REPLIES 6

former_member404244
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

Hi that greate answer,but aster uploading that i need to trigger CORK Tcode ...how it is?pls

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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