Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Read PDF files with Open DataSet(to avoid error corrupted file)

$
0
0

I solved this error today, was looking in the web for this solution and could not find, I just found a lot of people with the same issue, after upload the PDF and try to open in the server or attached the file or sending the file we got an error saying that the file has a error and could not be fixed, the reason is the file size, the open dataset is getting the sy-subrc <> to 0 at the last record and the record is not getting into the table. At the moment to exit we have to append the last row in the table.

 

I hope this help anyone.

 

TYPES: BEGIN OF hex_record,

        field(1024)  TYPE x,

       END OF hex_record.

 

lt_tab_ex2       TYPE STANDARD TABLE OF hex_record WITH HEADER LINE,

 

OPEN DATASET lv_fname FOR INPUT IN BINARY MODE.

      IF SY-subrc EQ 0.

        DO.

          READ DATASET lv_fname INTO lt_tab_ex2-field.

          IF SY-subrc EQ 0.

            append lt_tab_ex2.

          ELSE.

            append lt_tab_ex2.

            EXIT.

          ENDIF.

        ENDDO.

        CLOSE DATASET lv_fname.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>