Application Development and Automation 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: 
Read only

data present in internal table, now how to open it in PDF format

Former Member
0 Kudos
1,867

Dear Friends,

my Scenario is..

I have uploaded a pdf file in my database table through GUI_UPLOAD. It is uploaded.

Now when user click on some button then that file should be displayed again in pdf format directly.

(No download to user PC using GUI_download or something)

DBtab ZTST_XL Format

MANDT	MANDT	CLNT	3
KEYA	CHAR5	CHAR	5
KEY2	INT4	INT4	10
LENGTH	INT2	INT2	5
DATA		LCHR	1000

I brought that data again in my internal table by

SELECT * FROM ZTST_XL
    INTO TABLE DBTAB
    WHERE KEYA = 'TEST'.

  LOOP AT DBTAB.
    ITAB-DATA = DBTAB-DATA.
    APPEND ITAB.
  ENDLOOP.

Now I need to open this PDF file in normal format as it opens usually rather than downloading it on users PC .

Any Help regarding this will be very much useful

Thanks & Regards,

Sourabh

19 REPLIES 19
Read only

Former Member
0 Kudos
1,569

Sourav,

you are talking two things.

1. when uploaded from GUI...

2. when fetched from database..

send it to spool and convert the spool to otf..

these are just hints.. please, for both search sdn...

sample link:

[link|http://forumsa.sdn.sap.com/search.jspa?objID=f50&q=displaypdffrominternaltable]

more over.. check the FAQ section..

[FAQ|http://wiki.sdn.sap.com/wiki/display/ABAP/PDFfilesin+SAP#PDFfilesinSAP-HowtodisplayaPDFinSAPGUIforWindows%3F]

Edited by: Soumyaprakash Mishra on Jan 5, 2010 2:39 PM

Read only

0 Kudos
1,569

Dear Soumyaprakash,

Thanks for the instant reply,

Actually I have two buttons on my screen

1) to upload PDF file

2) View that uploaded file

So for 1st button or say for uploading PDF file in data base I created one DBtab structure stated above, and used GUI_UPLOAD fm to upload that PDF into that table. In which data is stored in Binary format or some unreadable format.

Now for 2nd Button I am facing problem because I have to just show that file again in PDF format, not to download it again on user system (otherwise it can be done through GUI_DOWNLOAD fm and then GUI_RUN).

So I m looking for any FM or ny thing through which I can show that dbtab data into PDF format again.

Thanks,

Sourabh

Edited by: Sourabh Jain on Jan 5, 2010 10:35 AM

Read only

viquar_iqbal
Active Contributor
0 Kudos
1,569

Hi

check out this FM

SSFCOMP_PDF_PREVIEW

Pass OTF data and it will display PDF

Thanks

Viquar Iqbal

Read only

Former Member
0 Kudos
1,569

Hi sourabh,

This is one option (in case the front-end is windows)

1. Call FM GUI_RUN

Pass the parameters as below:

COMMAND = CMD

PARAMETER = D:\abc.PDF /C

where d:\abc.pdf is the pdf filename with FULL PATH

/C is required afterwards it (AFTER some space)

Note: In this fashion, we can open any file eg. .DOC, .XLS , .TXT etc, and it will automatically get opened in its associated software eg. Word/Excel/Adobe/Notepad

Regards,

Amit Mittal.

Read only

0 Kudos
1,569

Dear Amit,

Thanks for reply,

I already knew this FM. but their is no file exist on any path because I have that file in my database table in binary format.

I cleared my scenario more in above thread please check.

Thanks

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,569

Hello,

You said:

I have that file in my database table in binary format

So why are you using GUI_UPLOAD? I am sorry, but i am confused

BR,

Suhas

Read only

0 Kudos
1,569

Dear Suhas,

Sorry for Confusion,

Actually I was trying to say that ,, I have already uploaded that pdf file to my database table on click of first button,

now on click of second button I have to show/open that uploaded pdf file.

Read only

0 Kudos
1,569

why dont you just save it in application server with first button.. and from second button you can retrieve and display.. that would be easy i think..

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,569

Ok, i get your point now.

1. You have a PDF file in local m/c, which you upload in to an internal table GUI_UPLOAD & then update to a DB table.

2. You want to display the same PDF when the user clicks the other pushbutton.

Is this what you want to achieve ?

BR,

SUhas

Read only

0 Kudos
1,569

Yup very right Suhas.

And just want to show , not to download on user's PC. (or say directly open the file without downloading to user PC)

@ Soumyaprakash

I cant use Application server (T- CG3Y or CG3Z). It should be DB tab only. (because of some complex req.)

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,569

>

> Dear Suhas,

> Sorry for Confusion,

> Actually I was trying to say that ,, I have already uploaded that pdf file to my database table on click of first button,

> now on click of second button I have to show/open that uploaded pdf file.

So you just want to show the PDF file you have uploaded to the DB on click of the 2nd button.

Now you can use the method CL_GUI_FRONTEND_SERVICES=>EXECUTE for this after the user clicks the 2nd button

CALL METHOD cl_gui_frontend_services=>execute
      EXPORTING
        DOCUMENT              = lv_document "The filepath you have used for GUI_UPLOAD 
      EXCEPTIONS
        cntl_error             = 1
        error_no_gui           = 2
        bad_parameter          = 3
        file_not_found         = 4
        path_not_found         = 5
        file_extension_unknown = 6
        error_execute_failed   = 7
        synchronous_failed     = 8
        not_supported_by_gui   = 9
        OTHERS                 = 10.

Hope i am clear.

BR,

Suhas

Read only

0 Kudos
1,569

suhas..

i think what he wants is: one person will upload it to one table as bin format.. and another person can use the second button to retrieve data from that table and display the pdf... he doesnt want to download it again...

Read only

0 Kudos
1,569

Hi Sourabh,

According to my opinion, it is difficult to do this. (i.e. opening a file in adobe, having its binary contents in internal table, without downloading to front-end machine).

Other SAP functions, if they are providing such functionality (eg.Busines Document Service etc), they also download the file (behind the scenes, in some temp folder), and the application opens it using GUI_RUN.

Your concern is that the file should not get downloaded to front-end machine, as it will create a lot of files (in the long term) just for viewing purpose. Hence according to my opinion, we can do what standard sap does.

1. Get temporary folder of the front end OS

Use FM GUI_GET_DESKTOP_INFO

Pass parameter TYPE = 4 ( 4 means get temporary folder, there are other functions also)

So you will get the temporary folder such as

C:\DOCUME1\UserNameOfMachine\LOCALS1\Temp

2. Using GUI_DOWNLOAD, download the file to this temporary folder

3. Using GUI_RUN open it.

Since we are downloading to temp folder, the operating system will automatically take care / user will take care of this temp folder, and it will get deleted if the user clears the temp folder. Temp folder is for this purpose only.

Hope this helps.

Regards,

Amit Mittal.

Read only

0 Kudos
1,569

Yeah Thanks Amit/Soumyaprakash

Now u guys got my requirement

well I have also tried for this by every means,,,, but no result tats hy posted here.

I have already tried whit this Temp folder method, Its working by this.

and I think, their is no need to get the temp folder address,

we just have to pass 'C:\temp\file name.pdf' in parameter of GUI_DOWNLOAD, it will automatically create this folder there and store this file.

Well THANKS A LOT guys for working and trying for this.

will keep this thread open for some days,might be their is some way to do this.

Again Thanks for ALL ,

Sourabh Jain

Read only

0 Kudos
1,569

Hi again,

"we just have to pass 'C:\temp\file name.pdf' in parameter of GUI_DOWNLOAD, it will automatically create this folder there and store this file."

If the folder is c:\temp, then it is just a normal folder. My point was that the system/OS has some pre-defined system folders, one of them is temp folder, and it lies in some other path and not c:\temp.

This temp folder is user wise, and it may be different in different operating systems. This temp folder has a SPECIAL meaning in the system, and it is administered by the OS automatically.

Hence, instead of using c:\temp, we should use the system temp folder (pre-defined system path), to really consider it as a temporary folder.

Regards,

Amit Mittal.

Read only

0 Kudos
1,569

Dear Amit

Thanks Again,

Got it. Very good point,

I didn't thought about that , even it will provide little bit security as well (as user based) in this case.

Thanks Again.

Closing This Thread as It seems , We cant directly open any PDF file from SAP without downloading it to OS.

Read only

0 Kudos
1,569

Thread Closed

Read only

Former Member
0 Kudos
1,569

This message was moderated.

Read only

Former Member
0 Kudos
1,569

Hi Sourabh,

Sorry got rejected because i used sms language... so i am posting it again... You will have to create a smartform of the same PDF type which You have uploaded.

When the user clicks on the display button then You will have to call the FM SSF_FUNCTION_MODULE_NAME, pass the form name to that and get the FM name(which will be unique). Call the FM which you have got now and get the JOB_OUTPUT_INFO table ( importing section) to one table. Pass that table to FM convert OTF .. Then display it or save it .

Check the below eg code.

<MODIFIED BY MODERATOR - RESPECT THE 2,500 CHARS LIMIT>

Cheers,

Sanil

Edited by: Alvaro Tejada Galindo on Jan 5, 2010 10:36 AM