on 2019 Aug 08 2:02 PM
cap-hnm-10435-open-read-error.png ;
Good Evening.
Madam/ Sir,
Check my code, these physical/local files are not reading & transferred to destination. I made a sample program to implement in Odata to zip uploaded files.Some times it execute the open statmt & some time not.
********* Step1: on reading files. error Sy-subrc = 1, open & read dataset not working ***********
LOOP AT me->pt_filetab INTO lwa_file.
lv_filename = lwa_file-filename.
lwa_bindata-filename = lv_filename.
p_filename = lv_filename.
CATCH SYSTEM-EXCEPTIONS open_dataset_no_authority = 1.
* AUTHORITY-CHECK OBJECT 'S_DATASET' ID 'PROGRAM' FIELD sy-cprog
* ID 'ACTVT' FIELD '33' "
* ID 'FILENAME' FIELD p_filename. ""
IF sy-subrc EQ 0.
OPEN DATASET p_filename FOR INPUT IN BINARY MODE. "
IF sy-subrc EQ 0.
"WRITE / 'Harshanandan Specified file is found to Uploading'.
READ DATASET p_filename INTO lv_xstring. "" Lv_filename.
ELSE.
"WRITE / 'Harshanandan Error in Searching the Attachments-(OPEN DATASET ERROR)'.
ENDIF.
CLOSE DATASET p_filename. "" Lv_filename.
ELSE.
MESSAGE lv_msg TYPE 'I'.
ENDIF.
ENDCATCH.
********* Step2: After Reading error Sy-subrc = 1, Open and Transfer Dataset not working *************
CONCATENATE lv_save add_index '.zip' INTO lv_save.
CONCATENATE lv_dest '\' lv_save INTO lv_dest.
CATCH SYSTEM-EXCEPTIONS open_dataset_no_authority = 1.
* AUTHORITY-CHECK OBJECT 'S_PATH' ID 'ACTVT' FIELD ' ' "
* ID 'FILENAME' FIELD p_filename. ""
"" lv_dest "" lv_dest_save
OPEN DATASET lv_dest FOR OUTPUT IN BINARY MODE. ""TEXT MODE ENCODING DEFAULT. "
IF sy-subrc EQ 0.
LOOP AT me->pt_zip_bin_data INTO lwa_zip_bindata.
"DO.
ASSIGN COMPONENT sy-index OF STRUCTURE lwa_zip_bindata TO FIELD-SYMBOL(<fs_line>).
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF lv_lines IS INITIAL.
lv_lines = <fs_line>.
ELSE.
lv_lines = lv_lines && ';' && <fs_line>.
ENDIF.
TRANSFER lwa_zip_bindata TO lv_dest LENGTH lv_lines.
CLEAR lv_lines.
"ENDDO.
ENDLOOP.
"" WRITE / 'Harshanandan Specified Files are Zipped to the Destination'.
"ELSE.
" WRITE / 'Harshanandan Error in Open Datasets Function'.
ENDIF.
CLOSE DATASET lv_dest.
ENDCATCH.
IF sy-subrc nE 0.
MESSAGE lv_msg1 TYPE 'I'.
ENDIF.
After using transfer dataset, do i need to use Gui download method for saving in destination folder.
*
*
But Madam, Sandra Rossi.
I'm using 'cl_abap_zip' 'cl_gui_frontend_servics' It is working fine. I want to try by using Open, Read, Transfer, Close datasets.
please suggest what i'm missing.
Request clarification before answering.
User | Count |
---|---|
42 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.