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

WS_UPLOAD

Former Member
0 Likes
1,444

Hi,

I am using the FM WS_UPLOAD in 4.6C to upload a txt file.But I am unable to do that .Can someone tell why??

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

CODEPAGE = ' '

FILENAME = VA_FILEPATH

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = TB_DATA

  • 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

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

These are the parameters I am passing.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,334

Rich,I have used WS_UPLOAD FM but I am unable to load it into the internal table?

I am giving File Type as DAT.

Message was edited by:

Sneha Singh

11 REPLIES 11
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,334

Looks fine, what kind of file are you using? Can you see anything in the DATA_TAB?

Regards,

RIch Heilman

Read only

Former Member
0 Likes
1,334

Hi Sneha,

Wen you say, you are not able to upload the text file, are you geting any errors or what exactly happens?

Read only

Former Member
0 Likes
1,334

check in Debug mode --> whats the value of FILENAME = VA_FILEPATH.

regards

Peram

Read only

Former Member
0 Likes
1,334

HI,

is your text file a tab delimited or comma seperated.. ensure that it is tab delimited.. and also ensure that the lenth of the fields in the internal table are correct.

Thanks

Mahesh

Read only

Former Member
0 Likes
1,334

the File Path is correct.

I am not getting any error.But its taking some bogus data.

Its a .txt file.I am uploading the data as a dump into the internal table.

What could be the problem?

Message was edited by:

Sneha Singh

Read only

0 Likes
1,334

Not sure, but you shouldn't be using that function module anyway, use GUI_UPLOAD instead.



report zrich_0002.


data: itab type table of string with header line.


call function 'GUI_UPLOAD'
     exporting
          filename   = 'c:test.txt'
     tables
          data_tab   = itab.

loop at itab.
  write:/ itab.
endloop.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
1,334

Hi,

if the filename is wrong then Use the following code to search filename before Start-of-selection:

PARAMETERS: p_file TYPE rlgrap-filename DEFAULT text-003,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

VA_FILEPATH = p_file.

Ashvender

Read only

Former Member
0 Likes
1,334

I have to run the upload program in the background.

I saw a note in the net that when we schedule the job in the backgroung we use either WS_UPLOAD or OPEN DATA_SET according to the value of the system variable SY-BATCH.Is it true?

Read only

0 Likes
1,334

You can NOT use use WS_UPLOAD to upload in background, you need to use the DATASET statements when working with files in background. These files must also reside on the application server, and not on your frontend PC.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,335

Rich,I have used WS_UPLOAD FM but I am unable to load it into the internal table?

I am giving File Type as DAT.

Message was edited by:

Sneha Singh

Read only

0 Likes
1,334

Sorry, I meant that you CAN NOT use that function in background, you must use DATASET statements and the files must be on the appliation server directory not on the frontend PC.

Regards

Rich Heilman