cancel
Showing results for 
Search instead for 
Did you mean: 

How to get PDF file From SAP and displaying it in ASP.Net webpage

Former Member
0 Kudos
638

Hello experts,

I have a requirement to get PDF payslips from sap and displaying it in .net web page.

Can some one suggest me the procedure to do this task.

What format of data should i request my ABAP team to consume it in the .net

Regards ,

siva

0 Kudos

Hi

Former Member,

I also have a situation like you.Can you tell me how to solve this problem

Accepted Solutions (1)

Accepted Solutions (1)

former_member197445
Contributor
0 Kudos

The way we do it is with an RFC that returns a Binary String.  Then the .NET code simply writes the binary data to the HttpResponse.

Response.Clear()

Response.ClearContent()

Response.ClearHeaders()

Response.ContentType = String.Format("application/pdf; filename=""{0}.pdf""", docNumber)

 

Response.BinaryWrite(obj_pdf)

I will try and locate a sample of the ABAP-side, too

Former Member
0 Kudos

Hello Case Ahe,

Thank you reply .

Can you please make it little detail about Response.BinaryWrite(obj_pdf). And whit kind of data type do we use to receive the pdf file.


Regards ,


siva.

Former Member
0 Kudos

Hi Case Ahe,

I found a way to pass PDF file in SAP using SOLIX_TAB the pdf binary value in rows for  IRFCtable and converted that into Data table. Concatenated all the rows

but it takes that Binary value as string or object data type.

When i convert that into Byte array and pass value to Response.BinaryWrite(<byte>) but still not generating PDF file.

please help me to solve this task.

Regards,

sivakumar.

former_member197445
Contributor
0 Kudos

The binary string needs to be converted from OTF, if you can manage it.  I use the following function call to convert the OTF of the PDF into a string:

CALL FUNCTION 'CONVERT_OTF'

     EXPORTING

       FORMAT                 = 'PDF'

     IMPORTING

       BIN_FILESIZE           = GV_BIN_FILESIZE

       BIN_FILE               = binstring

     TABLES

       OTF                    = GT_OTF

       LINES                  = GT_PDF_TAB

     EXCEPTIONS

       ERR_MAX_LINEWIDTH = 1

       ERR_FORMAT = 2

       ERR_CONV_NOT_POSSIBLE = 3

       OTHERS = 4.


The output should look something similar to "255044462D312E330D0A25E2E3CFD30D0A3... " etc. 


My output type for "BINSTRING" by the way is "XSTRING"


Hope that helps.

Former Member
0 Kudos

Hi Case Ahr,

My requirement is solved, Thanks for support.

Regards,

Sivakumar

Answers (0)