12-04-2008 5:19 AM
Hi All,
I am creating a Z-transaction with create, change and display options. The user needs 2 to 3 fields where he/she can attach a google map or a pdf or a word file. Could anyone please suggest how I can go about this such that during creation process the user can attach a file and then the same is displayed in the display screen and a click on that could lead to opening of the map or the pdf file stored on the system. If anyone has done the same, cud you please provide the code also.
Regards,
BP.
12-04-2008 5:48 AM
First of all you need to create a conatiner on screen then
for displaying word document you need to refer class CL_GUI_DOCUMENTS.
Sample code :
************************************************************************************************************************
data: custom_container type ref to cl_gui_custom_container,
word_doc type ref to cl_gui_documents.
*&&custom container--
create object custom_container
exporting container_name = 'CUST_CONT'.
create object word_doc
exporting
parent = custom_container
SHELLSTYPE =
LIFETIME =
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
others = 5
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call method word_doc->open_document
exporting
GUID =
GUIDTOUSE = SPACE
DOCUMENT_ID =
CONTREP_ID =
document_class = 'WORDPRO.APPLICATION'
OBJECT_TYPE =
OBJECT_ID =
DOCUMENT_TYPE = 'WORD.BASIC'
exceptions
implace_not_supported = 1
others = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
************************************************************************************************************************
for PDF document you need to refer class CL_GUI_PDFVIEWER
Sample code : refer to program SAP_PDF_VIEWER_DEMO
12-04-2008 6:24 AM
Hi Vivek,
Thanks for your reply, but my requirement is such:
The user is entering details with respect to a property. In the process, he has to attach a link to the JPG file which is the google picture of that property. On another occasion, he may have to attach some text documents also which may be PDF or Word file in nature.
Requirement is that he needs that such a file should be opened in the in their respective software and not in the current screen. Like the PDF could be opened up using any of the PDF readers etc.
My screen will only have a button attach to attach the name of the file and store the same in a database table. When displayed, the click on button open should open the same in the respective software for the same.
So I need process which will cater to the above.
Please help me in this regard,
Thanks,
BP
12-04-2008 6:32 AM
12-04-2008 6:06 AM
hi
you can upload these files
you go to transaction SE38> Program Name>Documentation>Change>Document--> Upload.
try this
hope this helps
regards
Aakash Banga