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: 

To find Filelength of the pdf

Former Member
0 Kudos
661

I have a requirement wherein i need to find the filelength of the pdf/smartform i am calling, as i need to pass the length further .

Is there any function module to know the file length of pdf file?

Or any code to find it?

I am gettting my pdf. Now i only need to find the pdf_filelen

6 REPLIES 6

Former Member
0 Kudos
222

Hello Malvika,

Please explain your rwquirement in detail...

what you have, what exactly you want...

former_member222860
Active Contributor
0 Kudos
222

Use the Strlen() function

data: len type i.

len = strlen( filename ).

Former Member
0 Kudos
222

I have a perform as-

PERFORM record_otf_for_archiving TABLES otf pdf

USING pdf_filelen

l_toa_dara.

Now in my form, pdf_filelen is not being calculated.

I want to calculate the filelength of this pdf.

Former Member
0 Kudos
222

FM:- SCMS_XSTRING_TO_BINARY

or

DATA: HLTLINES TYPE I.

DATA: FLE1(2) TYPE P.

DATA: FLE2(2) TYPE P.

DATA: HFELD(500) TYPE C.

DATA: OFF1 TYPE P.

DATA: HTABIX LIKE SY-TABIX.

DESCRIBE TABLE PDF_OUTPUT LINES HLTLINES.

DESCRIBE FIELD PDF_OUTPUT LENGTH FLE1 IN BYTE MODE .

DESCRIBE FIELD T_OBJBIN LENGTH FLE2 IN BYTE MODE .

CLEAR T_OBJBIN.

REFRESH T_OBJBIN.

CLEAR OFF1.

CLEAR HFELD.

LOOP AT PDF_OUTPUT.

HTABIX = SY-TABIX.

MOVE PDF_OUTPUT TO HFELD+OFF1.

IF HTABIX = HLTLINES.

FLE1 = STRLEN( PDF_OUTPUT ).

ENDIF.

OFF1 = OFF1 + FLE1.

IF OFF1 GE FLE2.

CLEAR T_OBJBIN.

T_OBJBIN = HFELD(FLE2).

APPEND T_OBJBIN.

SHIFT HFELD BY FLE2 PLACES.

OFF1 = OFF1 - FLE2.

ENDIF.

IF HTABIX = HLTLINES.

IF OFF1 GT 0.

CLEAR T_OBJBIN.

T_OBJBIN = HFELD(OFF1).

APPEND T_OBJBIN.

ENDIF.

ENDIF.

ENDLOOP.

Former Member
0 Kudos
222

Hi,

Move the content of the PDF file to an internal table of line type CHAR255.

Then call the FM IWB_KXF_CALC_FILESIZE .

CALL FUNCTION 'IWB_KXF_CALC_FILESIZE'

IMPORTING

FILESIZE = <integer for file size>

FLINES = <integer for file no. of lines>

TABLES

kxffile = <internal table which hold the pdf data>.

Hope this will help you.

Regards,

Smart Varghese

former_member195698
Active Contributor
0 Kudos
222

Are you not using "CONVERT_OTF_2_PDF" to convert OTF to PDF ??

This FM will give the Filesize also..in field " bin_filesize "

Regards

Aj