‎2007 Mar 22 12:44 PM
I need a customized program to generate CV ( resume )
which i have a question regarding retrieve employee photo.
appreciate any advice on how to retrieve employee photo into CV program which is likely to be mail merge in MS word.
Thanks
‎2007 Mar 22 1:55 PM
Hi,
For display photos
1. Create Object Pc_Main_Container
Exporting
container_name = 'G_MAIN_JPG_CONTAINER'
Exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
2. Create Object G_Jpg_Viewer
Exporting
Parent = pc_Main_Container
Exceptions
Error = 1
Others = 2.
3. Call Method pc_Jpg_Viewer->Load_Picture_From_Url
Exporting
Url = w_FileName
Importing
Result = w_Error_Code
Exceptions
Error = 1
Others = 2.
4. Call Method pc_Jpg_Viewer->Set_Visible
Exporting
Visible = 'X'
Exceptions
Cntl_Error = 1
Cntl_System_Error = 2
Others = 3.
You can do a mail merge using OLE.
The following is sample OLE, it will give you some basic idea related to OLE
report ztest MESSAGE-ID sy.
*Working directory such as SapWorkDir
PARAMETERS : p_file LIKE rlgrap-filename.
INCLUDE ole2incl.
INCLUDE docsincl.
DATA: h_word TYPE ole2_object,
h_docs TYPE ole2_object,
h_doc TYPE ole2_object,
h_merge TYPE ole2_object.
INITIALIZATION.
CALL FUNCTION 'WS_QUERY'
EXPORTING
query = 'CD'
IMPORTING
return = p_file.
CONCATENATE p_file 'Merge.DOC' INTO p_file.
START-OF-SELECTION.
* Create Word Application object
IF h_word-header = space OR h_word-handle EQ -1.
CREATE OBJECT h_word 'WORD.APPLICATION'.
IF sy-subrc NE 0.
MESSAGE i002 WITH sy-msgli.
ELSE.
SET PROPERTY OF h_word 'VISIBLE' = 1.
ENDIF.
ENDIF.
* Get Documsnts collection as property of Application object
GET PROPERTY OF h_word 'DOCUMENTS' = h_docs.
* Open a word file
CALL METHOD OF h_docs 'OPEN' = h_doc
EXPORTING #1 = p_file.
* Invoke mail merge
* The Word windows will be visible
GET PROPERTY OF h_doc 'MAILMERGE' = h_merge.
SET PROPERTY OF h_merge 'DESTINATION' = 1.
CALL METHOD OF h_merge 'EXECUTE'.
* Terminate Word
CALL METHOD OF h_word 'QUIT' EXPORTING #1 = 0.
* Free objects
FREE OBJECT : h_merge,
h_doc,
h_docs,
aRs
‎2007 Mar 22 1:55 PM
Hi,
For display photos
1. Create Object Pc_Main_Container
Exporting
container_name = 'G_MAIN_JPG_CONTAINER'
Exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
2. Create Object G_Jpg_Viewer
Exporting
Parent = pc_Main_Container
Exceptions
Error = 1
Others = 2.
3. Call Method pc_Jpg_Viewer->Load_Picture_From_Url
Exporting
Url = w_FileName
Importing
Result = w_Error_Code
Exceptions
Error = 1
Others = 2.
4. Call Method pc_Jpg_Viewer->Set_Visible
Exporting
Visible = 'X'
Exceptions
Cntl_Error = 1
Cntl_System_Error = 2
Others = 3.
You can do a mail merge using OLE.
The following is sample OLE, it will give you some basic idea related to OLE
report ztest MESSAGE-ID sy.
*Working directory such as SapWorkDir
PARAMETERS : p_file LIKE rlgrap-filename.
INCLUDE ole2incl.
INCLUDE docsincl.
DATA: h_word TYPE ole2_object,
h_docs TYPE ole2_object,
h_doc TYPE ole2_object,
h_merge TYPE ole2_object.
INITIALIZATION.
CALL FUNCTION 'WS_QUERY'
EXPORTING
query = 'CD'
IMPORTING
return = p_file.
CONCATENATE p_file 'Merge.DOC' INTO p_file.
START-OF-SELECTION.
* Create Word Application object
IF h_word-header = space OR h_word-handle EQ -1.
CREATE OBJECT h_word 'WORD.APPLICATION'.
IF sy-subrc NE 0.
MESSAGE i002 WITH sy-msgli.
ELSE.
SET PROPERTY OF h_word 'VISIBLE' = 1.
ENDIF.
ENDIF.
* Get Documsnts collection as property of Application object
GET PROPERTY OF h_word 'DOCUMENTS' = h_docs.
* Open a word file
CALL METHOD OF h_docs 'OPEN' = h_doc
EXPORTING #1 = p_file.
* Invoke mail merge
* The Word windows will be visible
GET PROPERTY OF h_doc 'MAILMERGE' = h_merge.
SET PROPERTY OF h_merge 'DESTINATION' = 1.
CALL METHOD OF h_merge 'EXECUTE'.
* Terminate Word
CALL METHOD OF h_word 'QUIT' EXPORTING #1 = 0.
* Free objects
FREE OBJECT : h_merge,
h_doc,
h_docs,
aRs
‎2007 Mar 31 9:08 AM