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

File interface inbound

Former Member
0 Likes
1,330

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.


1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,016

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

5 REPLIES 5
Read only

Former Member
0 Likes
1,017

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

Read only

0 Likes
1,016

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

Read only

0 Likes
1,016

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.

Read only

Former Member
0 Likes
1,016

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.

Read only

0 Likes
1,016

HI Karthik,

Thanks for your valuable suggestions. I got the result.

Thanks,

Ramesh Etikala