‎2014 Oct 28 5:58 AM
HI guys,
Please help me on my issue regarding file interfaces.when i am uploading file from application server it showing sy-subrc = 8 .
but file is already exist in application server.
the code i written is
PARAMETERS p_path type dxlpath.
AT SELECTION-SCREEN on VALUE-REQUEST FOR p_path.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
* EXPORTING
* I_LOCATION_FLAG = ' '
* I_SERVER = '?'
* I_PATH =
* FILEMASK = '*.*'
* FILEOPERATION = 'R'
IMPORTING
* O_LOCATION_FLAG =
* O_SERVER =
O_PATH = p_path
* ABEND_FLAG =
EXCEPTIONS
RFC_ERROR = 1
ERROR_WITH_GUI = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
START-OF-SELECTION.
OPEN DATASET p_path for INPUT in TEXT MODE ENCODING DEFAULT.
if sy-subrc = 0.
do.
read dataset p_path into lv_line.
if sy-subrc = 0.
split lv_line at ',' into gw_vbak-vbeln
gw_vbak-auart
gw_vbak-audat
gw_vbak-vkorg
gw_vbak-vtweg
gw_vbak-spart
gw_vbak-kunnr.
append gw_vbak to gt_vbak.
CLEAR gw_vbak.
else.
exit.
endif.
enddo.
else.
MESSAGE 'File does not process' type 'I'.
endif.
CLOSE DATASET p_path.
Thanks in advance,
Ramesh.
‎2014 Oct 28 6:04 AM
check in debug if path is correct, also use error handling in the open dataset.
DATA mess TYPE string.
OPEN DATASET `` FOR INPUT IN BINARY MODE MESSAGE mess.
IF sy-subrc = 8.
MESSAGE mess TYPE 'I'.
ENDIF.
try this and see what message it gives.let us know the message it throws
‎2014 Oct 28 6:04 AM
check in debug if path is correct, also use error handling in the open dataset.
DATA mess TYPE string.
OPEN DATASET `` FOR INPUT IN BINARY MODE MESSAGE mess.
IF sy-subrc = 8.
MESSAGE mess TYPE 'I'.
ENDIF.
try this and see what message it gives.let us know the message it throws
‎2014 Oct 28 6:11 AM
Hi Kartik,
I used the code what ur suggesting . even i am getting information message with sy-subrc = 8.
OPEN DATASET p_path for INPUT in TEXT MODE ENCODING DEFAULT.
if sy-subrc = 8.
MESSAGE 'Problem in uploading file' TYPE 'I'.
else.
do.
read dataset p_path into lv_line.
if sy-subrc = 0.
split lv_line at ',' into gw_vbak-vbeln
gw_vbak-auart
gw_vbak-audat
gw_vbak-vkorg
gw_vbak-vtweg
gw_vbak-spart
gw_vbak-kunnr.
append gw_vbak to gt_vbak.
CLEAR gw_vbak.
else.
exit.
endif.
enddo.
endif.
CLOSE DATASET p_path.
Thanks in advance,
Ramesh
‎2014 Oct 28 6:16 AM
dont use hardcoded message.
Pls use " MESSAGE mess" addition with open dataset as I suggested and then when sy-subrc is 8 print "Mess", this will give you a hint on why the open dataset is failing.
‎2014 Oct 28 6:20 AM
This can mostly happen when there is no sufficient authorization to READ/WRITE from the application server file path where file is present. You can check with your SECURITY team if any authorization is missing. Also make sure that the file you are trying to OPEN is not already OPEN by another OPEN DATASET statement.
FM 'AUTHORITY_CHECK_DATASET' can be used to check if any authorization is missing.
‎2014 Oct 29 6:05 AM
HI Karthik,
Thanks for your valuable suggestions. I got the result.
Thanks,
Ramesh Etikala