cancel
Showing results for 
Search instead for 
Did you mean: 

Display PDF. Note etc.. found in the table SRGBTBREL using BSP HTMLB

Former Member
0 Kudos

Hi all,

First thanks to you all for helping me threw my BSP project!

I am calling PDF which are found in the table Toa01to Toa03. And hve no problem getting the documnet to be showen, as long as its a PDF. I fill a htmlb tableview with the information found in the table and then call the function to show the selected document. I get the popup to select what program should be used to call the selected data. Like Acrobat etc.. and have no problems.

I do that this way:

select * from toa01

INTO CORRESPONDING FIELDS OF TABLE cmm_toa01

where object_id eq pono_pdf .

if sy-subrc eq 0.

CREATE DATA outtab_tmp TYPE TABLE OF cmm_toa01.

ASSIGN outtab_tmp->* TO INDEX index INTO wa_doc.

      • URL für Dokumentenanzeige generieren

CALL FUNCTION 'SCMS_URL_GENERATE'

EXPORTING

command = 'get'

contrep = wa_doc-archiv_id

docid = wa_doc-arc_doc_id

accessmode = 'r'

signature = 'X'

docprot = ''

security = 'B'

IMPORTING

absolute_uri = src.

My newest problem is, I found out that in the table SRGBTBREL there are also PDF, Notes, ATTA URL etc... which can be called from different transactions in SAP.

Till now I have not been able to find a function, method or such which can be used to call the different things found in the table SRGBTBREL.

I have been trying something like above as well as the coding below but till now have not been able to call the selected infoprmation once I have selected this from the table SRGBTBREL.

data cmm_SRGBTBREL type table of SRGBTBREL.

data SRGBTBREL_tmp type SRGBTBREL.

DATA: wa_doc TYPE table of SRGBTBREL.

select * from SRGBTBREL

INTO CORRESPONDING FIELDS OF TABLE cmm_SRGBTBREL

where INSTID_A eq pono_pdf.

if sy-subrc eq 0.

CREATE DATA outtab_tmp TYPE TABLE OF SRGBTBREL.

ASSIGN outtab_tmp->* TO INDEX 1 INTO wa_doc.

DATA urls TYPE STANDARD TABLE OF sood4.

CALL FUNCTION 'SO_DOCUMENTS_MANAGER'

EXPORTING

activity = 'DISP'

TABLES

documents = wa_doc.

I have seen a lot of differnet classes, functions and such which are mentioned in SDN. I just have not had any luck finding the right function. Can anyone help me on this one?

Thanks in advance

Mark Wright

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi All,

I need HELP!!!!

As BSP is new for me I still have not found a way to show PDF Data from the table SRGBTBREL. I debuged the ME23N and found a function that works there but not from a BSP Program. Does anyone have an Idea how I can show a PDF Doc from the table SRGBTBREL in BSP? I am also looking for a way to look at notes and other things that are also stored inthe table SRGBTBREL.

Thanks in advance

Mark Wright

athavanraja
Active Contributor
0 Kudos

use FM BDS_BUSINESSDOCUMENT_GET_TAB

to get the content.

parameters to this FM


LOGICAL_SYSTEM                  <your logical system>             
CLASSNAME                       BUS0012                SRGBTBREL-TYPEID A

CLASSTYPE                       BO                     
CLIENT                          sy-mandt                    
OBJECT_KEY                     SRGBTBREL-INSTID_A         
BINARY_FLAG                     X                      
TEXT_AS_STREAM                  ''                      

Regards

Raja

athavanraja
Active Contributor
0 Kudos

also check this weblog.

<a href="/people/siddhartha.jain/blog/2007/01/16/how-to-retrieve-a-generic-object-services-gos-or-sapoffice-document-display-it-in-a-bsp-webdynprojava-application">How to retrieve a Generic Object Services (GOS) or SAPOffice document & display it in a BSP / WebDynpro(JAVA) Application</a>

Regards

Raja

Former Member
0 Kudos

Hello Raja,

The Fm tables are comming back empty. This is also for getting information. I am already calling the table SRGBTBREL and get my table view for selection. I now need a way to call the selected document by calling the PDF as I do for a TAO01 Document.

I will have a look at the other Mail you sent and see if there is any useful information for me there.

What I need is a way to show a given document when selecting this from the table view.

Here is how I call my TOA01 and then call the PDF to look at the Documnet.

  • look in the table to fill the HTMLB table

select * from SRGBTBREL

INTO CORRESPONDING FIELDS OF TABLE cmm_SRGBTBREL

where INSTID_A eq pono_pdf.

if sy-subrc eq 0.

CREATE DATA outtab_tmp TYPE TABLE OF SRGBTBREL.

ASSIGN outtab_tmp->* TO

  • outprocessing

event = cl_htmlb_manager=>get_event( runtime->server->request ).

tableview_event ?= event.

      • Markierte Zeile ermitteln

index = tableview_event->selectedrowindex.

READ TABLE INDEX index INTO wa_doc.

        • URL für Dokumentenanzeige generieren

CALL FUNCTION 'SCMS_URL_GENERATE'

EXPORTING

command = 'get'

contrep = wa_doc-archiv_id

docid = wa_doc-arc_doc_id

accessmode = 'r'

signature = 'X'

docprot = ''

security = 'B'

IMPORTING

absolute_uri = src.

Thanks fo rthe Info

Mark

athavanraja
Active Contributor
0 Kudos

BDS_BUSINESSDOCUMENT_GET_TAB

does it throw any exception, or just come back blank

Raja

Former Member
0 Kudos

Hi Raja,

it come back blank. I had a problem setting the class name if I use the typedid_a so I changed it to call the id given in the table. I am also not using the logical system as it is optional and I do not know how to set this as this is used in

data: i_signature type table of bapisignat.

data: i_components type table of bapicompon .

CALL FUNCTION 'BDS_BUSINESSDOCUMENT_GET_TAB'

EXPORTING

  • LOGICAL_SYSTEM =

  • classname = SRGBTBREL_tmp-TYPEID_A

classname = 'BUS2012'

classtype = SRGBTBREL_tmp-CATID_A

  • CLIENT = SY-MANDT

OBJECT_KEY = SRGBTBREL_tmp-INSTID_A

BINARY_FLAG = 'X'

TEXT_AS_STREAM = ' '

tables

signature = i_signature

components = i_components

  • CONTENT =

  • ASCII_CONTENT =

EXCEPTIONS

NOTHING_FOUND = 1

PARAMETER_ERROR = 2

NOT_ALLOWED = 3

ERROR_KPRO = 4

INTERNAL_ERROR = 5

NOT_AUTHORIZED = 6

OTHERS = 7.

regards

Mark

athavanraja
Active Contributor
0 Kudos

though logical system is optional, it doestn work without that.

get the logical system using

OWN_LOGICAL_SYSTEM_GET

and use the same in the other FM

Raja

Former Member
0 Kudos

Hi Raja,

The logical system is now filled but the fm get_tab is still empty.

data: i_signature type table of bapisignat.

data: i_components type table of bapicompon .

data: log_sys type TBDLS-LOGSYS.

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

IMPORTING

OWN_LOGICAL_SYSTEM = log_sys.

  • EXCEPTIONS

  • OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1

  • OTHERS = 2

CALL FUNCTION 'BDS_BUSINESSDOCUMENT_GET_TAB'

EXPORTING

LOGICAL_SYSTEM = log_sys

  • classname = SRGBTBREL_tmp-TYPEID_A

classname = 'BUS2012'

classtype = SRGBTBREL_tmp-CATID_A

  • CLIENT = SY-MANDT

OBJECT_KEY = SRGBTBREL_tmp-INSTID_A

BINARY_FLAG = 'X'

TEXT_AS_STREAM = ' '

tables

signature = i_signature

components = i_components

regards

Mark

athavanraja
Active Contributor
0 Kudos

uncomment client .

CALL FUNCTION 'BDS_BUSINESSDOCUMENT_GET_TAB'

EXPORTING

LOGICAL_SYSTEM = log_sys

  • classname = SRGBTBREL_tmp-TYPEID_A

classname = 'BUS2012'

classtype = SRGBTBREL_tmp-CATID_A

CLIENT = SY-MANDT

OBJECT_KEY = SRGBTBREL_tmp-INSTID_A

BINARY_FLAG = 'X'

TEXT_AS_STREAM = ' '

tables

signature = i_signature

components = i_components

Raja

Former Member
0 Kudos

Hi Raja,

still nothing.

is the OBJECT_KEY = SRGBTBREL_tmp-INSTID_A correct ? as here the record number is showen.

regards

Mark

athavanraja
Active Contributor
0 Kudos

its the key of the documentreocrd. go to SWO1 and enter your business object BUS2014 and click display. now expand key fields. what do you see there. purchaing document? right. is the key from SRGBTBREL_tmp-INSTID_A (this should be the pur doc number) is 10 chars long?

Raja

Former Member
0 Kudos

Hi Raja,

Correct

But the Field INSTID_A is type SIBFBORIID and has CHAR 70 lenght in the table SRGBTBREL.

regards

Mark

athavanraja
Active Contributor
0 Kudos

that may be a problem (because i only tested from SE37)

BUS2012 the key field is of type EBELN.

may be try creating a temp variable.

data: temp_po type EBELN .

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = xxx- INSTID_A

importing

output = temp_po.

now use temp_po in the other FM .

Regards

Raja

Former Member
0 Kudos

Nope,

I already tried that. When I shorten the field I get a type conflict between 'OBJECT_KEY' and 'BDS_BUSINESSDOCUMENT_GET_TAB'

regards

Mark

athavanraja
Active Contributor
0 Kudos

sorry about the silly mistake.

all you have to make sure is that the po number is in internal format.

for example ebeln is 10 chars long.

if your po number is say 123456 then while passing the object_key you should pass

'0000123456' .

is this is true in your case and still you dont get the value back?

Raja

Former Member
0 Kudos

Hi Raja,

my record is 4500008300 and is showen in SRGBTBREL-INSTID_A as such, even thow the field INSTID_A has as a length of 70.

You don't have to say sorry. I'm glad your taking time to help me out!

regards

Mark

athavanraja
Active Contributor
0 Kudos

can you manually go to ME23 and see whether you can see the attachment . for this PO

Raja

Former Member
0 Kudos

HI,

I know I can see the doc's from the me23. I have to be able to select the same table and see the documents in a BSP enviroment as I do when using the me23.

I have found that the table used is SRGBTBREL. This is the table that I show the users. Now I have to be able to select a document as in me23. The users want to skip the me23 part and go directly to the table and select the documents from there. As I said I can call and see everything that is in a TOA01 table, I just can't do this with the SRGBTBREL table. I need to get the url so that I can show the documents here as well. Or I need to have another way to call the table SRGBTBREL and show the selected documents when selected.

regards

Mark

athavanraja
Active Contributor
0 Kudos

i just asked about ME23 is to make sure that the particular attachment can be view without problem from transaction.

in this case, if the system is configured in such a way that the documents are stored in external content server HTTP enabled , then you can generate URL for that (WEB_BDS_BUILD_URL_FOR_AL) and use it in your case. if not you have to get the binary content of the ducment (using the FM i mentioned earlier) and then show the document.

i have tested the FM which i suggested and it works fine in my case.

options at this point: try debuggin the FM i mentioned to see whats going wrong.

two: did you check out the other weblog i had mentioned.

Regards

Raja

Former Member
0 Kudos

Hi Raja,

The records are stored locally and external. SO I guess I'm going to have to try and get teh binary information for the local documents to give this to the url.

I have an appointment and will not be here the rest of the day. I'll get back with you tomorrow.

I have been looking at the link side. Very interesting. I just have to see how I can use this to get the documents I have.

Thanks once again for your help

Mark

Former Member
0 Kudos

Hello Raja,

I tried the WEB_BDS_BUILD_URL_FOR_AL but as the records do not have a archive ID this will not work for me.

Do you know if there is a way to build a URL from the information given in the table SRGBTBREL?

I'm going to go threw the link you sent earlier and see if I can use anything from there to get my data to be showen.

I also debuged the Fm and did not find any problem. Everything went fine, just that in a couple cases no data was found when calling a Method. It looks like a Archive ID is needed there as well.

Kind regards

Mark

Former Member
0 Kudos

Hi Raja,

Just wanted to thank you. The link you mentioned help me out a lot. I can now show ATTA's and NOTE'S in my BSP program. Now I just have to find out how to get the URL'S to be showen from the table SRGBTBREL.

Do you know how I can get teh url's to be showen as well?

Here is what I ahve so far to get the ATTA'S and Notes:

CALL FUNCTION 'SO_DOCUMENT_READ_API1'

EXPORTING

document_id = docid

  • document_id = s

  • FILTER = 'X '

IMPORTING

DOCUMENT_DATA = DOCUMENT_DATA

TABLES

object_header = object_header

object_content = object_content

  • OBJECT_PARA =

  • OBJECT_PARB =

ATTACHMENT_LIST = attachlist

  • RECEIVER_LIST =

CONTENTS_HEX = CONTENTS_HEX

EXCEPTIONS

DOCUMENT_ID_NOT_EXIST = 1

OPERATION_NO_AUTHORIZATION = 2

X_ERROR = 3

OTHERS = 4.

If....

CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

EXPORTING

input_length = input_length

  • FIRST_LINE = 0

  • LAST_LINE = 0

IMPORTING

BUFFER = FILE_CONTENT

tables

binary_tab = CONTENTS_HEX

EXCEPTIONS

FAILED = 1

OTHERS = 2.

endif...

if file_typ ne 'pdf'.

IF object_content IS NOT INITIAL.

CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'

  • EXPORTING

  • FIRST_LINE = 0

  • LAST_LINE = 0

  • MIMETYPE = ' '

IMPORTING

BUFFER = FILE_CONTENT

TABLES

text_tab = object_content

  • EXCEPTIONS

  • FAILED = 1

  • OTHERS = 2

.

ENDIF.

IF XSTRLEN( file_content ) > 0.

DATA: cached_response TYPE REF TO if_http_response.

CREATE OBJECT cached_response TYPE cl_http_response EXPORTING add_c_msg = 1.

cached_response->set_data( file_content ).

cached_response->set_header_field( name = if_http_header_fields=>content_type value = file_mime_type ).

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

cached_response->server_cache_expire_rel( expires_rel = 180 ).

DATA: guid TYPE guid_32.

CALL FUNCTION 'GUID_CREATE'

IMPORTING

ev_guid_32 = guid.

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

cl_http_server=>server_cache_upload( url = display_url response = cached_response ).

RETURN.

ENDIF.

Thanks once again for your help!!

Mark

raja_thangamani
Active Contributor
0 Kudos

Use the below code to display the URL..

<%  IF display_url IS NOT INITIAL.
      %>
      <script type="text/javascript">
        window.open("<%= display_url%>").focus();
      </script>

      <%
  ENDIF.
  %>

Raja T

Former Member
0 Kudos

Hello Raja,

The coding open's the same thing as the FM that I am now using.

The only thing that comes up in both your coding and the FM is the path from where the URL came which is in this case a PDF.

Here is what comes up:

&KEY&q:\mwright\Kunden Info\PBS_Preisliste2006-EU.pdf

I have now mixed the tables TOA01 and SRGBTBREL and become all entries from both tables in one table. I can call the pdf from TOA01 and all EXT and RAW entries from SRGBTBREL.

I can call this which is a PDF

FOL 18 4 EXT 32 000000000003

and this: which is a Note

FOL 18 4 RAW 32 000000000003

but I can not call this entry which is a PDF

FOL 18 4 URL 32 000000000012

regards

Mark

raja_thangamani
Active Contributor
0 Kudos

<i>but I can not call this entry which is a PDF

FOL 18 4 URL 32 000000000012</i>

In case of above, what is the value of "file_mime_type"?

Also i would suggest you to add the length as shows below:

    l_len = xstrlen( file_content ).
    cached_response->set_data( data   = file_content 
                        length = l_len ).

Try this & lets know..

Raja T

Message was edited by:

Raja Thangamani

Former Member
0 Kudos

Hello Raja,

As the file_typ is URL the file_mime_type is left blank and goes to the ELSE.

and receives file_mime_type = 'text/html' . as showen above in my coding. The file_typ EXT and RAW are showen correctly. EXT receives the type file_mime_type = 'application/pdf' and RAW is also blank and receives the type file_mime_type = 'text/html' which is correct in this case as it is a text as showen above.

The FM CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' fields input_length,FILE_CONTENT and CONTENTS_HEX are all blank.

In the FM CALL FUNCTION 'SO_DOCUMENT_READ_API1' all fields are blank except object_content and this has the entry line = &KEY&q:\mwright\Kunden Info\PBS_Preisliste2006-EU.pdf

Where should I use your coding and what is the data dec for l_len ? I tried xstring but this does not work with the length.

Here is where I added you code:

*************display in Browser***********************

IF XSTRLEN( file_content ) > 0.

DATA: cached_response TYPE REF TO if_http_response.

DATA: guid TYPE guid_32.

CREATE OBJECT cached_response TYPE cl_http_response EXPORTING add_c_msg = 1.

data: l_len TYPE XSTRING.

l_len = xstrlen( file_content ).

cached_response->set_data( data = file_content length = l_len ).

cached_response->set_data( file_content ).

cached_response->set_header_field( name = if_http_header_fields=>content_type value = file_mime_type ).

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 INTO display_url.

cl_http_server=>server_cache_upload( url = display_url response = cached_response ).

RETURN.

ENDIF.

Thanks for the Help

Mark

Former Member
0 Kudos

Hi Raja,

I changed my coding to:

IF XSTRLEN( file_content ) > 0.

DATA: cached_response TYPE REF TO if_http_response.

DATA: guid TYPE guid_32.

CREATE OBJECT cached_response TYPE cl_http_response EXPORTING add_c_msg = 1.

data: l_len TYPE i.

l_len = xstrlen( file_content ).

cached_response->set_data( data = file_content length = l_len ).

cached_response->set_data( file_content ).

cached_response->set_header_field( name = if_http_header_fields=>content_type value = file_mime_type ).

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 INTO display_url.

cl_http_server=>server_cache_upload( url = display_url response = cached_response ).

RETURN.

ENDIF.

I also changed the file_mime_type = to URL but this causes a dump stating that the type is not known or Corrupted.

regards

Mark

athavanraja
Active Contributor
0 Kudos

if the return object is url

SO_DOCUMENT_READ_API1

gives the url in OBJECT_CONTENT.

which is something like &KEY&http://www.yahoo.com

you have to build a logic to remove &KEY& and pass the remaining to display_url directly

no need to create cached response.

Regards

Raja

Former Member
0 Kudos

Hi Raja,

I already tried that. This does not work as well. I tried changing file_mime_type = 'application/url as well as file_mime_type = 'application/pdf' and file_mime_type = 'url'

The acrobat reader is started but then I receive the message that the data can not be read because the data is the wrong type or damaged.

regards

Mark

athavanraja
Active Contributor
0 Kudos

Mark, if my understanding is right, your question what to do when the attchment type is URL?

right?

if yes you dont have to pass anything to file_mime_type.

you only need to fill the display_url part

Raja

Former Member
0 Kudos

Hi Raja,

Yes I am trying to show a URL, or at least in the table SRGBTBREL it is set as a URL.

I also left the file_mime_type blank and here I become the path showen in my window. q:\mwright\Kunden Info\PBS_Preisliste2006-EU.pdf this is teh path where the PDF is stored. The display_url is : /sap(bD1kZSZjPTEwMA==)/bc/bsp/pbs/cmm_htmlb/45B6F57EEBC92B01E1000000C19BC81C

The funny thing is I can not find this entry in SRGBTBREL-BRELGUID and do not know where the ID 45B6F57EEBC92B01E1000000C19BC81C is comming from.

regards

Mark

athavanraja
Active Contributor
0 Kudos

what does this return

SO_DOCUMENT_READ_API1

in OBJECT_CONTENT tab?

Former Member
0 Kudos

Hi Raja,

this returns the path &KEY&q:\mwright\Kunden Info\VPN_Formular_E.

After getting the info from here I kill the &KEY& so that only q:\mwright\Kunden Info\VPN_Formular_E is left to be processed.

regards

Mark

athavanraja
Active Contributor
0 Kudos

q is a shared drive is it? or a local drive?

if you just copy/paste it in browser do you get the document. (q:\mwright\Kunden Info\VPN_Formular_E)

Raja

Former Member
0 Kudos

Q is a shared drive open for all as view only.

I do not get anything if I paste the path in the browser.

If I call the url from ME23n I can see this as a PDF.

I added the PDF to the record using add ad external URL.

regards

Mark

raja_thangamani
Active Contributor
0 Kudos

Did you look at the Table TOADV which has all the mimetype for respective objects like URL, PDF etc?

Raja T

Former Member
0 Kudos

Hi Raja,

There are no URL's in the table TOADV and the PDF's that are there are not those that I have attached to the document.

I have tried a few other FM that I have found and for the URL entry I always receive the path where the PDF is stored. I also moved the PDF to see what happens and I get the message that the Doc is no longer given. The same thing happens when I use the ME23N to look at the PDF as well.

A URL is an External attachemnt that is not saved in the table SRGBTBREL. I think that the path as to where the Document can be found is stored and this is why I am seeing the path and not the document.

I have been looking to see if the entries are stored in another table but till now I have not found one from which I can call the URl to be showen.

Mark

raja_thangamani
Active Contributor
0 Kudos

Mark,

Look at the table <b>TOADD</b> which has all mimetypes, I believe for URL, HTML mime type will work. You can use mime type as <b>text/html</b> as per the Table entry.

Give a try..

Raja T

Former Member
0 Kudos

Hi Raja,

there is no URL entry in the Table TOADD. I have tried different entries for file_mime_type. Either I get the path showen or nothing but I have not been able to have the information showen for a URL entry. I have also debuged the FM from the ME23N. I compaired both my program and the ME23N and found that in one FM that my program comes back with an empty table as the ME23N finds information needed to call teh next FM which in turn delivers the URL.

I do not think the FM I am using works when calling a URL entry. I have tried different attachments such as : WORD, PPT, RAW, EXL and I can view these with no problem.

Do youknow if there is another FM that I could try to get the URL to display ?

Thanks for all the help you have given

Mark

Former Member
0 Kudos

Hi Raja,

I tried the following in a Z program and it worked fine, but in my BSP program it dumps as there is a class that comes back empty in BSP but not in SAP.

call function 'CALL_BROWSER'

exporting

url = 'q:\mwright\Kunden Info\PBS_Preisliste2006-EU.pdf'

As I said this works fine in SAP but not in BSP. Every FM CL that I have tried delivers the same thing. Either a Dump or the path 'q:\mwright\Kunden Info\PBS_Preisliste2006-EU.pdf' is showen in my BSP window.

Its just funny that I can show everything else from the table SRGBTBREL except a URL

Regards

Mark

raja_thangamani
Active Contributor
0 Kudos

To call the url as it is(Provide if q: is kind of Application/FTP server) without placing in server cookie, just use the below syntax..

pdfurl = 'q:mwrightKunden InfoPBS_Preisliste2006-EU.pdf'.

 <iframe width="100%" height="90%" src="<%= pdfurl %>" />

Or


Javascript -->window.open('q:mwrightKunden InfoPBS_Preisliste2006-EU.pdf');

Raja T

athavanraja
Active Contributor
0 Kudos

since you say that this is working with FM

call function 'CALL_BROWSER'

exporting

url = 'q:\mwright\Kunden Info\PBS_Preisliste2006-EU.pdf'

what happens when you populate it with display_url and open it with window.open?

is it access denied js error?

(earlier you said copy pasting 'q:\mwright\Kunden Info\PBS_Preisliste2006-EU.pdf' in browser address bar doestn work, is it working now?)

Raja

athavanraja
Active Contributor
0 Kudos

using this local file as a link on a webpage would produce access denied error onclicking.

try this. get the mapped machine name for Q drive.

and create linke like below.


<p href="file:///\<machinename><path><filename>.<extn>">test</p>

in the above code replace the two ps with a

Regards

Raja

Message was edited by:

Durairaj Athavan Raja

Former Member
0 Kudos

Hi Raja,

<iframe width="100%" height="90%" src="<%= pdfurl %>" />

That fixed my problem!

I can now call all types of attachments. Thanks for the Help!

Kind Regards

Mark

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mark and Raja,

I got a similar requirement, where I should provide an URL to access the PDF from the SAP table and when clicked on the URL, it should open that PDF on a web page.

Since I am new to BSP application, it will be grateful if you can help me out.

Thanks.

Former Member
0 Kudos

Hi John,

Most of the stuff you get from above. Some of it is old and there are some newer ways but,

In a nutshell

The Attachemnts are found in the SAP tables: toa01, toa02, toa03, so do Selects in them and here are well to get teh info you need:

select * from SRGBTBREL

  INTO CORRESPONDING FIELDS OF TABLE cmm_SRGBTBREL

  where INSTID_A eq pono_pdf.

if sy-subrc eq 0.

loop at cmm_SRGBTBREL into SRGBTBREL_tmp.

    cmmbrel-FOLTP = SRGBTBREL_tmp-INSTID_B(3).

    cmmbrel-FOLYR = SRGBTBREL_tmp-INSTID_B+3(2).

    cmmbrel-FOLNO = SRGBTBREL_tmp-INSTID_B+5(12).

    cmmbrel-OBJTP = SRGBTBREL_tmp-INSTID_B+17(3).

    cmmbrel-OBJYR = SRGBTBREL_tmp-INSTID_B+20(2).

    cmmbrel-OBJNO = SRGBTBREL_tmp-INSTID_B+22(12).

    append cmmbrel to cmm_mix.

endloop.

endif.

Once I have what I need

I use this: CALL FUNCTION 'SCMS_URL_GENERATE'  to get the PDF Info from SAP .

Then this to set to string: CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'

and then this

**************display in Browser************************

  IF  XSTRLEN( file_content ) > 0.

    CREATE OBJECT cached_response TYPE cl_http_response EXPORTING add_c_msg = 1.

    l_len = xstrlen( file_content ).

    cached_response->set_data( data   = file_content length = l_len ).

    cached_response->set_data( file_content ).

    cached_response->set_header_field( name  = if_http_header_fields=>content_type value = file_mime_type ).

    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 INTO display_url.

    cl_http_server=>server_cache_upload( url  = display_url  response = cached_response ).

  RETURN.

  ENDIF.

Layout I use this

<htmlb:tableView id = "PDF_view"

                           table           = "<%= <it_doc> %>"

                           design          = "alternating"

                           headerVisible   = "true"

                           headerText      = "<%=otr(/pbs/cmm/CMM)%><%= pono_pdf %>"

                           sort            = "SERVER"

filter          = "SERVER"

                           visibleRowCount = "8"

                           fillUpEmptyRows = "true"

                           selectionMode   = "SINGLESELECT"

                           onRowSelection  = "OnInputProcessing" >

</htmlb:tableView>

Former Member
0 Kudos

Thank you Mark,

But while executing CALL FUNCTION 'SCMS_URL_GENERATE'  to get the PDF Info from SAP. I am getting an information message as 'Error generating the test frame'.

Help me.

Former Member
0 Kudos

Hi John,

this is how I use the call function.

SRC type SAPB-URI  is defined in my side attributes to pass on


This is how I set the fields to get the Info.

data: docid type SOFOLENTI1-DOC_ID.

data: attachlist type table of SOATTLSTI1.

data: CONTENTS_HEX  TYPE  CONTENTS_HEX_TAB_TYPE.

data: DOCUMENT_DATA  TYPE  SOFOLENTI1.

data: mix_doc type cmm_toa_brel.

types: begin of cmmbrel,

  CLIENT type MANDT,

  BRELGUID type OS_GUID,

  RELTYPE  type OBLRELTYPE,

  INSTID_A type SIBFBORIID,

TYPEID_A type SIBFTYPEID,

CATID_A  type SIBFCATID,

  INSTID_B type SIBFBORIID,

TYPEID_B type SIBFTYPEID,

CATID_B  type SIBFCATID,

  LOGSYS_A type LOGSYS,

ARCH_A   type OBLARCH,

  LOGSYS_B type LOGSYS,

  ARCH_B type OBLARCH,

  UTCTIME  type TZNTSTMPS,

HOMESYS  type LOGSYS,

end of cmmbrel.

This is how I call it:

* this get's the selected entry from the table

event = cl_htmlb_manager=>get_event( runtime->server->request ).

tableview_event ?= event.

*** Markierte Zeile ermitteln

index = tableview_event->selectedrowindex.

* this check is needed to get the next page

* in the table when more than 8 lines are given

If not index is initial.

  FIELD-SYMBOLS: <it_doc>  TYPE STANDARD TABLE.

  ASSIGN ref_it_doc->*  TO <it_doc>.

* the iframe entries have to be cleared so that the correct

* link is called

clear: src, display_url.

read table <it_doc> INDEX index INTO mix_doc.

if mix_doc-FOLTP is initial.

**** PDF für Dokumentenanzeige generieren

    CALL FUNCTION 'SCMS_URL_GENERATE'

EXPORTING

command      = 'get'

contrep      = mix_doc-archiv_id

docid        = mix_doc-arc_doc_id

accessmode   = 'r'

signature    = 'X'

docprot      = ''

security     = 'B'

IMPORTING

absolute_uri = src.

endif.

* get the info from table selection

docid = mix_doc.

* get the needed info from selected doc

CALL FUNCTION 'SO_DOCUMENT_READ_API1'

EXPORTING

document_id = docid

* FILTER = 'X '

IMPORTING

DOCUMENT_DATA = DOCUMENT_DATA

   TABLES

object_header = object_header

object_content = object_content

* OBJECT_PARA =

* OBJECT_PARB =

ATTACHMENT_LIST = attachlist

* RECEIVER_LIST =

CONTENTS_HEX = CONTENTS_HEX

EXCEPTIONS

DOCUMENT_ID_NOT_EXIST = 1

OPERATION_NO_AUTHORIZATION = 2

X_ERROR = 3

   OTHERS                           = 4.

I then give the info to the coding above(note from 22 NOv)

**display in Browser**

Former Member
0 Kudos

Hi Mark,

Firstly I am very thankful for helping me out in this task.

I tried to run your code , but I am getting a syntax errors as some of the fields as not defined for example "Field "<IT_DOC>" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.". 

I am not sure with which table to define with. Help me..

Thanks

Former Member
0 Kudos

HI John,

it should had been in the coding above. You see it 4 lines above the yellow marking:

  FIELD-SYMBOLS: <it_doc>  TYPE STANDARD TABLE.

  ASSIGN ref_it_doc->*  TO <it_doc>.

ref_it_doc is declared in my side attribute with type ref to data.

It is filled over the eventhandler when reading the Toa0* tables and filled in the end with:

ref_it_doc = outtab_tmp.    Which then is sent to the other coding.

Hope this helps you.

I copied all of the coding in the attached word doc. Change the ending back to doc as ist in txt form for here

Former Member
0 Kudos

Thanks Mark

Former Member
0 Kudos

Hi Mark,

I got a similar requirement, where I should use the path of the image(path of image in  server) from one of the Ztables and extract the pdf file stored in trim das server and display the pdf file on the web page using BSP.

Since I am new to BSP , it will be grateful if you help me out.

Thanks,

Former Member
0 Kudos

Hi Ram,

Most of the stuff above should help you out as long as your tables are inside SAP.  I don't program PHP for a living so I don't know as much as 


Former Member
0 Kudos

Thank you Mark. I will try to contact Raja.