Application Development and Automation 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: 
Read only

BDC

Former Member
0 Likes
435

Hi all ,

I am using the followin code segment to upload all my application or presentation server file in to table i_dir_list .

Buts its not getting uploaded .

Can any one plz tell me why ?

CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'

EXPORTING

full_name = p_lifnr

IMPORTING

STRIPPED_NAME = lv_filename

FILE_PATH = v_dirname1

EXCEPTIONS

X_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'

EXPORTING

dir_name = v_dirname1

  • FILE_MASK = ' '

  • IMPORTING

  • DIR_NAME = v_dirname2

  • FILE_COUNTER = v_filecounter

  • ERROR_COUNTER = v_errorcounter

tables

dir_list = i_dir_list

EXCEPTIONS

INVALID_EPS_SUBDIR = 1

SAPGPARAM_FAILED = 2

BUILD_DIRECTORY_FAILED = 3

NO_AUTHORIZATION = 4

READ_DIRECTORY_FAILED = 5

TOO_MANY_READ_ERRORS = 6

EMPTY_DIRECTORY_LIST = 7

OTHERS = 8

.

IF sy-subrc <> 0.

write : ' does not exists .'.

ENDIF.

4 REPLIES 4
Read only

Former Member
0 Likes
415

Hi,

I do not see any code for uploading file. Where is the code.

To open application server file you need OPEN DATASET and to upload file from presentation server, you need to use function modules GUI_UPLOAD (or similar ones).

Please check and let us know.

ashish

Read only

Former Member
0 Likes
415

Hi Dipankar,

Not sure abt ur FM ..but u can try instead GUI_UPLOAD...

PERFORM read_pc_file TABLES t_file1 USING p_pcfl_h.

FORM read_pc_file TABLES fp_table USING fp_filename TYPE c.

DATA: l_filenm TYPE string.

CLEAR l_filenm.

l_filenm = fp_filename.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_filenm

filetype = 'ASC'

  • read_by_lin = c_check

TABLES

data_tab = fp_table

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.

*MOD18{

  • MESSAGE e899 WITH text-004.

MESSAGE e899 WITH text-034.

*MOD18}

ENDIF.

ENDFORM. " read_pc_file

Read only

Former Member
0 Likes
415

hi dipankar,

i didnt see code for uploading data in ur program..

Please follow the procedure to upload data.

use open dataset stmt to upload the data into internal table if the file is in Application server else use GUI_UPLOAD fm if it is in Presentation server.

build the bdc data for that internal table.

populate the bdc data into the Screens of desired Tansaction.

if u want to upload/update the data of ur file into a db table

then use update <DB table> from <work area>

use Commit work stmt after this.

<b><i>Reward points if useful</i></b>

Chandra

Read only

Former Member
0 Likes
415

hi

good

go through this link,hope this ll help you solve your problem

http://www.sapfans.com/sapfans/alex.htm

reward point if helpful.

thanks

mrutyun^