cancel
Showing results for 
Search instead for 
Did you mean: 

Background Job - DATASET_NOT_OPEN

Former Member
0 Kudos

Hi,

We want to upload a text file placed in the application server to Ztable through background job. We searched for the code snippet, got and used that in our program. Previously, we used gui_upload. That did not work. So we switched to open and read dataset.

When we run the program using SE38, it works fine but when we configure the job and run, it gets cancelled and generates dump with the message: Dataset_not_open. As it can be run successfully using 38, there should not be any permission issue with the file. We also can view the file from AL11.

Could you help me point out where it has gone wrong?

Please find below the code snippet.

**************upload data from NIS****************************
*  CONCATENATE h_path '/nis_data1/Attd.txt' INTO file.
   file = '/usr/sap/ARP/DVEBMGS00/data/trf/nis/Attd.txt'.

   DATA : var(50).
   CLEAR : l_index, var.
*--Read the data from application server file.
   OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

   DO.
     READ DATASET file INTO l_line.
     IF sy-subrc <> 0.
       EXIT.
     ELSE.
       l_index = l_index + 1.
       it_input_nis-input_string = l_line.
**********************************************************
       IF l_index > 1.

         SPLIT it_input_nis AT ',' INTO  it_input_xls_bok_nis-sr_no
                                           it_input_xls_bok_nis-date
                                           it_input_xls_bok_nis-time
                                           it_input_xls_bok_nis-empcode
                                           it_input_xls_bok_nis-name
                                           it_input_xls_bok_nis-card_no
                                           var.

         REPLACE ALL OCCURRENCES OF '-' IN it_input_xls_bok_nis-date WITH '.'.
         TRANSLATE it_input_xls_bok_nis-date TO UPPER CASE.

         REPLACE ALL OCCURRENCES OF ':' IN it_input_xls_bok_nis-time WITH '.'.
         it_input_xls_bok_nis-time = it_input_xls_bok_nis-time(5).

         APPEND it_input_xls_bok_nis.
         CLEAR it_input_xls_bok_nis.
       ENDIF.
     ENDIF.
   ENDDO.
   CLOSE DATASET file.
*************************************************************

Regards

Palash


Accepted Solutions (1)

Accepted Solutions (1)

bpawanchand
Active Contributor
0 Kudos

Hi Palash,

I think you have posted your discussion in a wrong Space Move your discussion to

Regards

Pavan

Answers (0)