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

Error opening dataset, return code: 8

Former Member
0 Likes
4,366

Hi,

I'm passing the information from a txt to a transparente table. The problem is that it throws me the following message: Error opening dataset, return code: 8 .

When I debug it the first row of information enters to the internal table but after it this erro comes.

The code is the following:

DATA: BEGIN OF record,

  • data element: TABNAME

tablename_001(030),

  • data element: DESCR40

des_002(040),

  • data element: TYKLA

tipo_003(015),

  • data element: QUANTITY_I

quan_004(011),

  • data element: PRICE

precio_005(021),

  • data element: TOT01

total_006(017),

END OF record.

      • End generated data section ***

DATA:

BEGIN OF i_tabla OCCURS 0,

dest(40),

type(15),

quan(10),

precio(15),

tot(15),

END OF i_tabla.

PARAMETERS:

p_user LIKE apqi-userid OBLIGATORY DEFAULT sy-uname,

p_fich LIKE rlgrap-filename OBLIGATORY

DEFAULT: 'C:\Documents and Settings\lseri\My Documents\Book1.txt'.

START-OF-SELECTION.

CALL FUNCTION 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

filename = p_fich

filetype = 'DAT'

TABLES

data_tab = i_tabla

EXCEPTIONS

conversion_error = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

OTHERS = 7

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

PERFORM open_dataset USING dataset.

PERFORM open_group.

LOOP AT i_tabla FROM 2.

PERFORM bdc_dynpro USING 'SAPLSETB' '0230'.

PERFORM bdc_field USING 'BDC_CURSOR'

'DATABROWSE-TABLENAME'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ANLE'.

PERFORM bdc_field USING 'DATABROWSE-TABLENAME'

record-tablename_001.

PERFORM bdc_dynpro USING '/1BCDWB/DBZSTOCK_TEST' '0101'.

PERFORM bdc_field USING 'BDC_CURSOR'

'ZSTOCK_TEST-TOTAL'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=SAVE'.

PERFORM bdc_field USING 'ZSTOCK_TEST-DES'

record-des_002.

PERFORM bdc_field USING 'ZSTOCK_TEST-TIPO'

record-tipo_003.

PERFORM bdc_field USING 'ZSTOCK_TEST-QUAN'

record-quan_004.

PERFORM bdc_field USING 'ZSTOCK_TEST-PRECIO'

record-precio_005.

PERFORM bdc_field USING 'ZSTOCK_TEST-TOTAL'

record-total_006.

PERFORM bdc_dynpro USING '/1BCDWB/DBZSTOCK_TEST' '0101'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/EBACK'.

PERFORM bdc_field USING 'BDC_CURSOR'

'ZSTOCK_TEST-DES'.

PERFORM bdc_dynpro USING 'SAPLSETB' '0230'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/EBACK'.

PERFORM bdc_field USING 'BDC_CURSOR'

'DATABROWSE-TABLENAME'.

PERFORM bdc_transaction USING 'SE16'.

ENDLOOP.

PERFORM close_group.

PERFORM close_dataset USING dataset.

Please help me!

Thanks

12 REPLIES 12
Read only

Former Member
0 Likes
2,469

Hi,

Error opening dataset, return code: 8 means the file could not be opened.

Could you please paste the codes for PERFORM open_dataset USING dataset and PERFORM open_group?

Regards,

Ferry Lianto

Read only

0 Likes
2,469

----


  • open dataset *

----


FORM OPEN_DATASET USING P_DATASET.

OPEN DATASET P_DATASET

FOR INPUT IN TEXT MODE

ENCODING DEFAULT.

IF SY-SUBRC <> 0.

WRITE: / TEXT-E00, SY-SUBRC.

STOP.

ENDIF.

ENDFORM.

----


  • create batchinput session *

  • (not for call transaction using...) *

----


FORM OPEN_GROUP.

IF SESSION = 'X'.

SKIP.

WRITE: /(20) 'Create group'(I01), GROUP.

SKIP.

  • open batchinput group

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING CLIENT = SY-MANDT

GROUP = GROUP

USER = USER

KEEP = KEEP

HOLDDATE = HOLDDATE.

WRITE: /(30) 'BDC_OPEN_GROUP'(I02),

(12) 'returncode:'(I05),

SY-SUBRC.

ENDIF.

ENDFORM.

I'm using these performs because they appeared automatically when the recording became a program.

Read only

Former Member
0 Likes
2,469

Hi,

Can you explain your problem in detail ? If the file is getting picked from the Presentation Server (FM Upoad) then why r you trying to use Open Dataset ?

Regards,

Mukul

Read only

0 Likes
2,469

You are uploading the data from presentation server and again opening another file, don't know why is this ? Are you manipulating with data from the application server file too...post your code fully...

Error opening dataset, return code 8 is because its undable to open the file in application server.

I rather prefer to upload the data from the application server file to an internal table and then do the manipulations in your code .

Read only

0 Likes
2,469

How can it be that the program is unavaiable to get the data from the txt if the data appeas in the internal table? I believe the problem is when I try to move the data from the internal table to the transparent table.

Read only

0 Likes
2,469

your Program flow is confusing...What is that you are doing after opening the file on the application server ?

Read only

Former Member
0 Likes
2,469

Hi Lucila,

Please try this.


...

PERFORM open_dataset USING dataset.
PERFORM open_group.

LOOP AT i_tabla FROM 2.

PERFORM bdc_dynpro USING 'SAPLSETB' '0230'.
PERFORM bdc_field USING 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ANLE'.
PERFORM bdc_field USING 'DATABROWSE-TABLENAME'
record-tablename_001.
PERFORM bdc_dynpro USING '/1BCDWB/DBZSTOCK_TEST' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ZSTOCK_TEST-TOTAL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'ZSTOCK_TEST-DES'
record-des_002.
PERFORM bdc_field USING 'ZSTOCK_TEST-TIPO'
record-tipo_003.
PERFORM bdc_field USING 'ZSTOCK_TEST-QUAN'
record-quan_004.
PERFORM bdc_field USING 'ZSTOCK_TEST-PRECIO'
record-precio_005.
PERFORM bdc_field USING 'ZSTOCK_TEST-TOTAL'
record-total_006.
PERFORM bdc_dynpro USING '/1BCDWB/DBZSTOCK_TEST' '0101'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/EBACK'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ZSTOCK_TEST-DES'.
PERFORM bdc_dynpro USING 'SAPLSETB' '0230'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/EBACK'.
PERFORM bdc_field USING 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
PERFORM bdc_transaction USING 'SE16'.

ENDLOOP.

PERFORM close_group.
*PERFORM close_dataset USING dataset.

...

FORM OPEN_DATASET USING P_DATASET.
  DATA: WA_LINES TYPE STRING.

  OPEN DATASET P_DATASET FOR INPUT IN TEXT MODE.
 
  IF SY-SUBRC <> 0.
    WRITE: / TEXT-E00, SY-SUBRC.
    STOP.
  ELSE.
    DO.
      READ DATASET P_DATASET INTO WA_LINES.
      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.
 
      I_TABLA = WA_LINES.
      APPEND I_TABLA.
    ENDDO.
  ENDIF.

  CLOSE DATASET  P_DATASET.

ENDFORM.

Regards,

Ferry Lianto

Read only

amit_khare
Active Contributor
0 Likes
2,469

Hi,

If your return code is 8 measn you dont have authorization to write to that network location.

Ask your BASIS to check that.

I once faced the same problem.

Regards,

Amit

Read only

Former Member
0 Likes
2,469

Now I deleted the perform PERFORM open_dataset USING dataset and PERFORM close_dataset USING dataset. When I execute the program the following appears:

Open session Return code 0

Insert transaction SE16 Return code = 0 RECORD: 0

The insert transaction appears for every line of the txt. Doesn't that mean that the data traveled OK to the transparent table? But what happens is that it doesn't appear in that table.

Read only

0 Likes
2,469

How can you insert the data directly to SE16 transaction ? I don't think you can write a BDC on it. Through the program using the SQL Statements you can add, delete or modify the data but not directly on se16.

Read only

0 Likes
2,469

Hi,

You cannot write BDC for SAPLSETB. Its a function pool and not a transaction/report program.

I think you want to upload data into some table, then use the Tcode for accordingly. BDC cannot be wriiten for Tcodes like SE11, SE12, SE16 etc.

Regards,

Amit

Read only

Former Member
0 Likes
2,469

make sure that the file is in application server and the delimeter in the file is same as the delimiter you specified in file.

plz check ur Application server path and dirctory on the application server .

is that dirctory is existed or not.

If that directory on the application server is existed then check that u are auth. to use that directory.

or u can take basis people help for that if u are not auth.

hope this help you.

sri