Skip to Content
0
Former Member
Feb 27, 2006 at 07:26 AM

Download in PDF format

136 Views

Hi all,

I have Created a function Module which creates a spool and return the OTF data stored in that spool. Now i have to show this in a HTML page. For this i am going through the weblog By Craig Cmehil : /people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp

But i am not getting the desired output.

The code of ONINPUTPROCESSING is like this :

data: ls_line type tline,

l_pdf_len type i.

data: r_string type string.

data: R_XSTRING type xstring.

data: result type tlinetab.

DATA: cached_response TYPE REF TO if_http_response.

data: guid type GUID_32 .

CALL FUNCTION 'ZSP_PO_DOWNLOAD'

EXPORTING

PO_NUM = '4500016357'

TABLES

PDF = result .

loop at result into ls_line.

CONCATENATE

r_string

ls_line-tdline

INTO r_string.

endloop.

****Convert the Character String to Binary String

call function 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = r_string

IMPORTING

buffer = R_XSTRING.

CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING

add_c_msg = 1.

l_pdf_len = xstrlen( R_XSTRING ).

cached_response->set_data( data = R_XSTRING

length = l_pdf_len ).

cached_response->set_header_field( name =

if_http_header_fields=>content_type

value = 'application/pdf' ).

cached_response->set_status( code = 200 reason = 'OK' ).

cached_response->server_cache_expire_rel( expires_rel = 180 ).

CALL FUNCTION 'GUID_CREATE'

IMPORTING

ev_guid_32 = guid.

CONCATENATE runtime->application_url '/' guid '.pdf' INTO

display_url.

cl_http_server=>server_cache_upload( url = display_url

response = cached_response ).

RETURN.

The result i am getting in my browser is like this

:

DF-1.3
%âãÏÓ
2 0 obj
/WinAnsiEncoding
endobj
3 0 obj
<<
/Type /Font
/Subtype /Type1
/BaseFont /Courier
/Name /F001
/Encodg 2 0 R
>>

endobj

4 0 obj

<<

/Type /FontDescriptor

/Ascent 720

/CapHeight 660

/Descent -270

/Flags 32

/FontBBox

/FontName /Helvetica

/ItalicAngle 0

/StemV 105

>>

endobj

5 0 obj

<<

/Type /Font

/Subtype /Type1

/BaseFont /Helveta

/Name /F002

/Encoding 2 0 R

/FirstChar 32

/LastChar 255

%Charwidth values from HPLJIIID HELVE 100 normal

/Widths

[ 278 3350 630 630 1000 760 335 335 335 630 1000 335 335 335 335 630 630 630 630 630 630 630 630 630 630 335 335 1000 1000 1000 520 1000 7400 705 720 575 555 740 720 280 555 665 535 905 720 760 595 780 650 650 630 720 720 1000 720 685 610 335 335

335 500 500 335 535 57535 575 535 370 575 575 240 240 535 240 870 575 575 575 575 350 500 370 575 555 870 555 555 480 445 500 445 1000 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 335 630 630 630 630 500 630 220 500 405 555 1000

0 500 220 220 1000 390 390 220 5550 335 220 390 405 555 1000 1000 1000 520 740 740 740 740 740 740 980 705 575 575 575 575 280 280 280 280 720 720 760 760 760 760 760000 760 720 720 720 720 685 595 610 535 535 535 535 535 535 850 535 535 535 535

535 240 240 240 240 575 575 575 575 575 575 575 10 575 575 575 575 575 555 575 555]

/FontDescriptor 4 0 R

>>

endobj

6 0 obj

<<

/Type /FontDescriptor

/Ascent 720

/CapHeight 66

/Descent -270

/Flags 32

/FontBBox

/FontName /Helvetica-Bold

/ItalicAngle 0

/StemV 105

>>

endobj

7 0 ob

<<
/Type /Font
/Subtype /Type1
/BaseFont /Helvetica-Bold
/Name /F003
/Encoding 2 0 R
/FirstChar 32
/LastChar 255
%Charwidthalues from HPLJIIID HELVE 140 bold
/Widths
[ 278 332 518 629 629 1000 761 332 332 332 629 1000 332 332 332 332 629 629 629 629 62929 629 629 629 629 332 332 1000 1000 1000 518 1000 739 629 704 721 575 557 739 721 279 557 668 536 907 721 761 593 779 646 646 629 7 721 1000 721 686 611 332 332
332 500 500 332 536 575 536 575 536 371 575 575 239 239 536 239 871 575 575 575 575 354 500 371 5757 871 557 557 482 500 500 500 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 332 629 629 629 629 500 629 2 500 407 557 1000
0 500 221 221 1000 389 389 221 593 629 332 221 389 407 557 1000 1000 1000 518 739 739 739 739 739 739 982 704 57575 575 575 279 279 279 279 721 721 761 761 761 761 761 1000 761 721 721 721 721 686 593 611 536 536 536 536 536 536 854 536 536 53636
536 239 239 239 239 575 575 575 575 575 575 575 1000 575 575 575 575 575 557 575 557]
/FontDescriptor 6 0 R
>>
endobj
8 0 o
<<
/Length 9 0 R
>>
stream
q 1 g 0 g 0.50 w 306.00 556.90 254.90 156.00 re S Q q 0.80 g 306.00 694.90 254.90 18.00 re f Q /F0 12.00 Tf 0 g BT 50.40 397.90 Td 0 Tw <20>Tj ET 0 g BT 468.00 385.90 Td 0 Tw <43757272656E637920494E52>Tj ET 0 g BT 50.40 373.90 TdTw
<5765207265717569726520616E206F726465722061636B6E6F776C6564676D656E7420666F722074686520666F6C6C6F77696E67206974656D733A>Tj ET 0 BT 50.40 367.90 Td 0 Tw
<5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F>Tj ET 0 g BT 504.00 367.90 Td 0 Tw <5F5F5F5F5F5F5F5F>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 50.40 349.90 Td <49746D>Tj ET
/F002 10.00 Tf 2.20 Tw 0 g BT 93.60 349.90 Td <4D6174657269616C>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 230.40 349.90 Td <44656372697074696F6E>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 57.60 337.90 Td <2020204F72646572207174792E2020>Tj ET /F002 10.00 Tf 2.20 Tw
g BT 187.20 337.90 Td <556E6974202020>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 280.80 337.90 Td <2020202050726963652070657220756E69742020>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 439.20 337.90 Td <204E65742076616C756520>Tj ET /F001 12.00 Tf 0 g BT
50.40 331.90 Td 0 Tw <5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F>Tj ET 0 gT 504.00 331.90 Td 0 Tw <5F5F5F5F5F5F5F5F>Tj ET 0 g BT 50.40 301.90 Td 0 Tw <3030303130>Tj ET
0 g BT 93.60 301.90 Td 0 Tw <41442D33332D333030>Tj ET 0 g BT 230.40 301.90 Td 0 Tw <20507572636861736564204D6174657269616C202D20446174652066726F6D20456666>Tj ET 0 g BT.60 289.90 Td 0 Tw <2020202020202020202020202020203130>Tj ET 0 g BT
187.20 289.90 Td 0 Tw <45616368>Tj ET 0 g BT 280.80 289.90 TdTw <20202020202020202032332E3931>Tj ET 0 g BT 439.20 289.90 Td 0 Tw <20202020202020202020203233392E3130>Tj ET 0 g BT 57.60 277.90 Td Tw <20>Tj ET 0 g BT 187.20 277.90 Td 0 Tw <20>Tj ET
0 g BT 280.80 277.90 Td 0 Tw <20>Tj ET 0 g BT 439.20 277.90 Td 0 Tw <202020202020202020202020302E3030>Tj ET 0 g BT 93.60 253.90 Td 0 Tw <5075726368617365204F7264657220746578742066726F6D20746865206D617465726961206D61737465722E>Tj ET 0 g BT
50.40 229.90 Td 0 Tw <3030303230>Tj ET 0 g BT 93.60 229.90 Td 0 Tw <41442D3333332D333030>Tj ET 0 g B230.40 229.90 Td 0 Tw <20507572636861736564204D6174657269616C202D20446174652066726F6D20456666>Tj ET 0 g BT 57.60 217.90 Td 0 Tw
<20202020202020202020202020203535>Tj ET 0 g BT 187.20 217.90 Td 0 Tw <45616368>Tj ET 0 g BT 280.80 217.90 Td 0 Tw <202020202020202020332E3931>Tj ET 0 g BT 439.20 217.90 Td 0 Tw <202020202020202020312C3331352E3035>Tj ET 0 g BT 57.60 205.90 Td 0 Tw
<20>Tj ET 0 g BT7.20 205.90 Td 0 Tw <20>Tj ET 0 g BT 280.80 205.90 Td 0 Tw <20>Tj ET 0 g BT 439.20 205.90 Td 0 Tw <20202020202020202020202020302E303Tj ET 0 g BT 93.60 181.90 Td 0 Tw
<5075726368617365204F7264657220746578742066726F6D20746865206D6174657269616C206D61737465722E>Tj E0 g BT 50.40 157.90 Td 0 Tw <3030303330>Tj ET 0 g BT 93.60 157.90 Td 0 Tw <41442D3333332D333030>Tj ET 0 g BT 230.40 157.90 Td 0 Tw
20507572636861736564204D6174657269616C202D20446174652066726F6D20456666>Tj ET 0 g BT 57.60 145.90 Td 0 Tw <20202020202020202020202020203535>Tj ET 0 g BT 187.20 145.90 Td 0 Tw <45616368>Tj ET 0 g BT 280.80 145.90 Td 0 Tw
<20202020202020202032332E3931>Tj ET 0 g BT9.20 145.90 Td 0 Tw <202020202020202020312C3331352E3035>Tj ET 0 g BT 57.60 133.90 Td 0 Tw <20>Tj ET 0 g BT 187.20 133.90 Td 0 Tw <20j ET 0 g BT 280.80 133.90 Td 0 Tw <20>Tj ET 0 g BT 439.20 133.90 Td 0 Tw
<20202020202020202020202020302E3030>Tj ET 0 g BT 93.60 1090 Td 0 Tw <5075726368617365204F7264657220746578742066726F6D20746865206D6174657269616C206D61737465722E>Tj ET /F001 12.00 Tf 0 g BT 540 685.90 Td 0 Tw <436F6D70616E79>Tj ET 0 g BT
50.40 673.90 Td 0 Tw <53502056656E646F72>Tj ET 0 g BT 50.40 661.90 Td 0 Tw <3234393043>Tj ET 0 g BT 50.40 649.90 Td 0 Tw <494E444941>Tj ET /F001 12.00 Tf 0 g BT 50.40 469.90 Td 0 Tw <506C656173652064656C6976657220743A>Tj ET 0 g BT 50.40 457.90 Td
0 Tw <4E657720596F726B>Tj ET 0 g BT 50.40 445.90 Td 0 Tw <4E657720596F726B>Tj ET 0 g BT 50.40 433. Td 0 Tw <3639312042726F6164776179>Tj ET 0 g BT 50.40 421.90 Td 0 Tw <4E455720594F524B204E5920203130303031>Tj ET /F001 12.00 Tf 0 g 309.60 469.90 Td
0 Tw <44656C697665727920646174653A2020204461792033312E30332E32303036>Tj ET /F003 14.00 Tf 3.10 Tw 0 g BT 309.607.90 Td <5075726368617365206F72646572>Tj ET /F002 8.00 Tf 1.80 Tw 0 g BT 309.60 673.90 Td <504F206E756D6265722F64617465>Tj ET
/F0012.00 Tf 0 g BT 309.60 661.90 Td 0 Tw <34353030303136333537202F2032342E30322E32303036>Tj ET /F002 8.00 Tf 1.80 Tw 0 g BT 309.60 649. Td <436F6E7461637420706572736F6E2F54656C6570686F6E65>Tj ET /F001 12.00 Tf 0 g BT 309.60 637.90 Td 0 Tw
<49444553205553412F30343021303032>Tj ET /F002 8.00 Tf 1.80 Tw 0 g BT 50.40 541.90 Td <596F75722076656E646F72206E756D6265722077697468207573>Tj ET /F001 12.00 T0 g BT 50.40 529.90 Td 0 Tw <343230>Tj ET

endstream

endobj

9 0 obj

4968

endobj

10 0 obj

<<

/Type /Page

/MediaBox

/Parent 1 0 R

/Resources

<<

/ProcSet

/Font

<<
/F001 3 0 R
/F002 5 0 R
/F003 7 0 R
>>
/XObject
<<
>>
>
/Contents 8 0 R
>>
endobj
11 0 obj
<<
/Length 12 0 R
>>
stream
/F001 12.00 Tf 0 g BT 50.40 643.90 Td 0 Tw <5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F>Tj ET 0 g BT 504.00 6490 Td 0 Tw <5F5F5F5F5F5F5F5F>Tj ET /F002 10.00 Tf 2.20 Tw
0 g BT 50.40 625.90 Td <4974656D>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 93. 625.90 Td <4D6174657269616C>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 230.40 625.90 Td <4465736372697074696F6E>Tj ET /F002 10.00 Tf 2.20 0 g BT 57.60 613.90 Td
<2020204F72646572207174792E2020>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 187.20 613.90 Td <556E6974202020>Tj ETF002 10.00 Tf 2.20 Tw 0 g BT 280.80 613.90 Td <2020202050726963652070657220756E6974202020>Tj ET /F002 10.00 Tf 2.20 Tw 0 g BT 439.2013.90 Td
<204E65742076616C756520>Tj ET /F001 12.00 Tf 0 g BT 50.40 607.90 Td 0 Tw <5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F>Tj ET 0 g BT 504.00 607.90 Td 0 Tw
<5F5F5F5F5F5F5F5Fj ET 0 g BT 50.40 577.90 Td 0 Tw <3030303430>Tj ET 0 g BT 93.60 577.90 Td 0 Tw <41442D3333332D333030>Tj ET 0 g BT 230.40 577.90 Td 0w <20507572636861736564204D6174657269616C202D20446174652066726F6D20456666>Tj ET 0 g BT
57.60 565.90 Td 0 Tw <20202020202020202020202020203535>Tj ET 0 g BT 187.20 565.90 Td 0 Tw <45616368>Tj ET 0 g BT 280.80 565.90 Td 0 Tw <20202020202020202032332E3931>Tj ET 0 g 439.20 565.90 Td 0 Tw <202020202020202020312C3331352E3035>Tj ET 0 g BT
57.60 553.90 Td 0 Tw <20>Tj ET 0 g BT 187.20 553.90 Td 0 T<20>Tj ET 0 g BT 280.80 553.90 Td 0 Tw <20>Tj ET 0 g BT 439.20 553.90 Td 0 Tw <20202020202020202020202020302E3030>Tj ET 0 g BT 93.6029.90 Td 0 Tw
<5075726368617365204F7264657220746578742066726F6D20746865206D6174657269616C206D61737465722E>Tj ET 0 g BT 50.40 505.9Td 0 Tw <3030303530>Tj ET 0 g BT 93.60 505.90 Td 0 Tw <41442D3333332D333030>Tj ET 0 g BT 230.40 505.90 Td 0 Tw
<205075726368617365204D6174657269616C202D20446174652066726F6D20456666>Tj ET 0 g BT 57.60 493.90 Td 0 Tw <2020202020202020202020202020203535>Tj ET 0 g B187.20 493.90 Td 0 Tw <45616368>Tj ET 0 g BT 280.80 493.90 Td 0 Tw
<20202020202020202032332E3931>Tj ET 0 g BT 439.20 493.90 Td 0 T<202020202020202020312C3331352E3035>Tj ET 0 g BT 57.60 481.90 Td 0 Tw <20>Tj ET 0 g BT 187.20 481.90 Td 0 Tw <20>Tj ET 0 g BT 280.8081.90 Td 0 Tw <20>Tj ET 0 g BT 439.20 481.90 Td 0 Tw
<20202020202020202020202020302E3030>Tj ET 0 g BT 93.60 457.90 Td 0 Tw <50757268617365204F7264657220746578742066726F6D20746865206D6174657269616C206D61737465722E>Tj ET 0 g BT 50.40 433.90 Td 0 Tw <3030303630>Tj 0 g BT 93.60 433.90 Td 0 Tw
<41442D3333332D333030>Tj ET 0 g BT 230.40 433.90 Td 0 Tw <20507572636861736564204D6174657269616C202D246174652066726F6D20456666>Tj ET 0 g BT 57.60 421.90 Td 0 Tw <2020202020202020202020202020353532>Tj ET 0 g BT 187.20 421.90 Td 0 Tw <616368>Tj ET 0 g
BT 280.80 421.90 Td 0 Tw <20202020202020202032332E3931>Tj ET 0 g BT 439.20 421.90 Td 0 Tw <202020202020202031332C39382E3332>Tj ET 0 g BT 57.60 409.90 Td 0 Tw <20>Tj ET 0 g BT 187.20 409.90 Td 0 Tw <20>Tj ET 0 g BT 280.80 409.90 Td 0 Tw <20>Tj ET g
BT 439.20 409.90 Td 0 Tw <20202020202020202020202020302E3030>Tj ET 0 g BT 93.60 385.90 Td 0 Tw <5075726368617365204F72646572207578742066726F6D20746865206D6174657269616C206D61737465722E>Tj ET 0 g BT 50.40 379.90 Td 0 Tw
<5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F>Tj ET 0 g BT 504.00 379.90 Td 0 Tw <5F5F5F5F5F5F5F>Tj ET 0 g BT 187.20 349.90 Td 0 Tw
<546F74616C206E65742076616C7565206578636C2E2074617820494E52>Tj ET 0 g BT 410.40 349.90 T0 Tw <202020202020202020202031382C3639372E3632>Tj ET 0 g BT 187.20 337.90 Td 0 Tw <202020202020202020202020202020202020202020202020204555524F>Tj ET 0 g BT
410.40 337.90 Td 0 Tw <20202020202020202020202020202020302E3030>Tj ET /F001 12.00 Tf 0 g BT 50.40 697.90 Td Tw <53502056656E646F72>Tj ET 0 g BT 50.40 685.90 Td 0 Tw <323439332043>Tj ET 0 g BT 50.40 673.90 Td 0 Tw <494E444941>Tj ET /F002 8. Tf
1.80 Tw 0 g BT 309.60 697.90 Td <504F206E756D6265722F64617465>Tj ET /F001 12.00 Tf 0 g BT 309.60 685.90 Td 0 Tw <343530303031333537202F2032342E30322E32303036>Tj ET /F002 8.00 Tf 1.80 Tw 0 g BT 489.60 697.90 Td <50616765>Tj ET /F001 12.00 Tf 0 g BT
489.60 6.90 Td 0 Tw <32>Tj ET

endstream

endobj

12 0 obj

4373

endobj

13 0 obj

<<

/Type /Page

/MediaBox

/Parent 1 0 R/Resources

<<

/ProcSet

/Font

<<

/F001 3 0 R

/F002 5 0 R

>>

/XObject

<<

>>

>>

/Contents 11 0 R

>>

endobj

4 0 obj

<<

/Author (ANIMESH )

/CreationDate (20060227 123503)

/Creator (Form MEDRUCK EN)

/Producer (SAP R/3 Release 640 )

%SAPfoStart TOA_DARA

%FUNCTION=( )

%MANDANT=( )

%DEL_DATE=(00000000)

%SAP_OBJECT=( )

%AR_OBJECT=( )

%OBJECTD=( )

%FORM_ID=( )

%FORMARCHIV=( )

%RESEE=( )

%NOTIZ=( )

%-( )

%-( )

%-( )

%SAPinfoEnd TOA_DARA

>>

endobj

1 0 obj

<<

/Type /Pages

/Kids

[ 10 0 R

13R

]

/Count 2

>>

endobj

15 0 obj

<<

/Type /Catalog

/Pages 1 0 R

/PageMode /UseNone

>>

endobj

xref

0 16

0000000000 65535

0000013352 00000 n

0000000017 00000 n

0000000052 00000 n

0000000157 00000 n

0000000342 00000 n

0000001412 00000 n

00000016020000 n

0000002675 00000 n

0000007702 00000 n

0000007725 00000 n

0000007938 00000 n

0000012372 00000 n

0000012396 00000 n

00002597 00000 n

0000013430 00000 n

trailer

<<

/Size 16

/Root 15 0 R

/Info 14 0 R

>>

startxref

13506

%%EOF

So I need Suggestions regarding this. Any help would be highly appreciated. Thanks in advance.

Regards,

Animesh