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: 

Weird Error with open dataset

Former Member
0 Kudos

I am trying to read a .csv file using WS_upload. Please see the foll code:

IF FILE1+0(1) <> '\'.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • FILENAME = dataset

FILENAME = FILE1

  • FILETYPE = 'DAT'

FILETYPE = 'ASC'

TABLES

DATA_TAB = rec.

ENDIF.

OPEN DATASET FILE1 IN TEXT MODE for INPUT.

IF sy-subrc = 0.

DO.

READ DATASET FILE1 INTO rec2.

IF sy-subrc <> 0.

EXIT.

ELSE.

  • WRITE / rec2.

rec-INFO = rec2.

APPEND REC.

ENDIF.

ENDDO.

ENDIF.

The system is behaving different when I run in foreground on our test server and it gives error while running on produciton server. The open dataset block does not execute on the test server but on production server it does. And it ahs suddenly started doing it with any CSV file.. including the ones which earlier it did not ahve any problem with. Because the open dataset block executes on the production server it adds around 10000 lines to the file... the file ofcourse contain all garbage values for eg gwrd.exe, instance.lst , car.exe, dll etc. I have no clue why this has started happening suddenly when it was not happeing 1 hour before.

please help/

thanks.

4 REPLIES 4

Former Member
0 Kudos

Hi Pranav,

For the first IF condition where you determine whether to use WS_UPLOAD or to call OPEN DATASET.

What will happen if the first IF condition is satisfied? It will trigger the WS_UPLOAD logic and after that it will also try to trigger the OPEN DATASET logic rite?

Did u check if the program is trying to trigger the OPEN DATASET also? Coz if its trying to call OPEN DATASET after trying to call WS_UPLOAD it might either end up in error or might try to read some junk.

Try to use the MESSAGE option of OPEN DATASET command and see if there is any error message issued.

Hope this helps

Cheers

VJ

Former Member
0 Kudos

Are you executing this in the background on the PROD server?

If yes, I would expect it to give a dump as WS_UPLOAD will not work in background at all.

Regards,

Ravi

Former Member
0 Kudos

Hi Pranav,

I can only give u suggestions...

1st-> use GUI_UPLOAD instead of WS_UPLOAD..

2nd-> Check the contents of FILE1 after WS_UPLOAD..

what is the OS on apllication server n on the presentation server..

For windows, '\' is used for path n for UNIX on application server, '/' is used..

So if the presentation n application OS are different, u need to change this differentiator..

I believe the path shud be alright..

Regards,

Tanveer.

<b>Please mark helpful answers</b>

Former Member
0 Kudos

Hai Pranav

Try with F.M 'GUI_UPLOAD' instead of 'WS_UPLOAD'

Thanks & regards

Sreenivasulu P