‎2006 Nov 16 10:24 AM
Hi, experts..............
can u please chk this code once what is the mistake in it.
iam not in a position to upload to application server.
TABLES : KNA1.
data : begin of it_upload occurs 0,
kunnr like kna1-kunnr,
name1 like kna1-name1,
country like kna1-land1,
end of it_upload.
DATA : DSN type string.
PARAMETERS : pa_fend(100) TYPE c, "File from Frontend
pa_apps(100) TYPE c LOWER CASE."File on APP. Server
start-of-selection.
DSN = pa_fend.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = DSN
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_UPLOAD.
open dataset pa_fend for output in text mode encoding default.
if sy-subrc <> 0.
write :/'dataset cannot be open'.
else.
loop at it_upload.
transfer it_upload to pa_apps.
endloop.
if sy-subrc = 0.
write :/'sucess'.
endif.
close dataset dsn.
endif.
‎2006 Nov 16 10:28 AM
Hi Dasr,
Your program looks ok.
Just check if you are uploading the data at right Path and you have authorization.
Check Sy-subrc in Debug mode...
But just refer sample code below:
PARAMETERS :p_f2 LIKE rlgrap-filename.
OPEN DATASET p_f2 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
EXIT.
ENDIF.
TRANSFER wa_error TO p_f2.
CLEAR wa_error.
LOOP AT i_error INTO wa_error.
TRANSFER wa_error TO p_f2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
CLEAR wa_error.
ENDLOOP.
CLOSE DATASET p_f2.
Reward points if this helps.
Manish
Message was edited by:
Manish Kumar
‎2006 Nov 16 10:45 AM
try to declare ur parameters like this type
PARAMETERS : <b>pa_fend</b> TYPE <b>ibipparms-path</b> LOWER CASE MODIF ID 001.
"path for appl server file name
PARAMETERS : <b>pa _apps</b> TYPE <b>ibipparms-path</b> LOWER CASE MODIF ID 001.
"path for appl server file name
then
<b>dsn = pa _apps.</b>
‎2006 Nov 16 11:28 AM
Hullo,
I think your problem lies in the open dataset statement:
open dataset pa_fend for output in text mode encoding default.You declared "pa_fend" as the filename on the frontent and "pa_apps" as the one on the application server. So you should use "pa_apps" for storing the file on the AS.
Thus when saving on the AS the open dataset command should be:
open dataset pa_apps for output in text mode encoding default.Hope this helps.
‎2006 Nov 16 4:31 PM
Dasr,
declare file as
<b>DATA: FILENAME LIKE RLGRAP-FILENAME.</b>
OPEN DATASET FILENAME IN TEXT MODE FOR OUTPUT.
IF SY-SUBRC NE 0.
MESSAGE E501 WITH FILENAME.
ENDIF.
MOVE SPACE TO FILE.
LOOP AT FILE.
TRANSFER FILE TO FILENAME.
ENDLOOP.
<b> CLOSE DATASET FILENAME.</b>
it is going to work..
-ANu