Application Development 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: 

FB03 GOS, PDF can't be read after attaching in BKPF

Former Member
0 Kudos

Dear ABAPers,

First of all thank you very much for such a useful code. I tried the code and did the attachment for FI documents showing in FB03 where OBJTYPE = ‘BKPF’ and OBJKEY = ‘combination of company code, document no and fiscal year’.

We are getting documents created from another .net application, which is creating .bmp, .jpg, .doc and .pdf documents. All documents are uploaded successfully except few PDF documents.

The difference between the 2 PDFs, first one is a scanned images as PDF which is uploaded successfully, second one is the PDF having table format which was created by .net application with the help of HTML coding.

I am facing the problem when uploading the second PDF file, it is uploading successfully but when I am opening it, it is corrupted. I took the PDF from AL11, when I saw the PDF after downloading it from AL11, PDF is opening finely.

Is there two different ways to upload the PDF with scanned images and PDF with table format created by HTML format ?

Please help.

Regards,
Prameet Gopal Verma

3 REPLIES 3

Former Member
0 Kudos

One more finding, when I am reading dataset to variable of type CHAR255, it is reading only first 128 charcters of a line. Code block is given below.

data : lv_filepath TYPE char256,

wa_content LIKE soli,

it_content LIKE STANDARD TABLE OF soli,

TRY.
OPEN DATASET lv_filepath FOR INPUT IN BINARY MODE.
WHILE sy-subrc = 0.
READ DATASET lv_filepath INTO wa_content.
APPEND wa_content TO it_content.
ENDWHILE.
CLOSE DATASET lv_filepath.
CATCH cx_sy_file_access_error.
MESSAGE 'Error reading file' TYPE 'E'.
ENDTRY.

I guess there is a problem in open dataset statement but could not figure it out. Please help, in the mean time I am also trying to figure out the things on my own.

Former Member
0 Kudos

One more finding, when I am reading dataset to variable of type CHAR255, it is reading only first 128 charcters of a line. Code block is given below.

data : lv_filepath TYPE char256,

wa_content LIKE soli,

it_content LIKE STANDARD TABLE OF soli,

TRY.
OPEN DATASET lv_filepath FOR INPUT IN BINARY MODE.
WHILE sy-subrc = 0.
READ DATASET lv_filepath INTO wa_content.
APPEND wa_content TO it_content.
ENDWHILE.
CLOSE DATASET lv_filepath.
CATCH cx_sy_file_access_error.
MESSAGE 'Error reading file' TYPE 'E'.
ENDTRY.

I guess there is a problem in open dataset statement but could not figure it out. Please help, in the mean time I am also trying to figure out the things on my own.

Former Member
0 Kudos

Got the solution myself, calculating wrong file size. I used FM "EPS_GET_DIRECTORY_LISTING" to get the file size and it got corrected.

,

Got the solution, I am calculating the file size wrongly. Now I get the file size from the FM "EPS_GET_DIRECTORY_LISTING".