cancel
Showing results for 
Search instead for 
Did you mean: 

How to display employee photo in adobe forms from PA30 not from SE78 ?

Former Member
0 Kudos

Hi all,

I have tried the employee photo in adobe forms and i have displayed the photo but it is from SE78. I want to display employee photo from PA30. Any help?

To display employee photo from SE78 i have done the following steps.

1) Employee photo should be in SE78.In SE78 i uploaded the photo as name as personeel number (eg:00000500).

2) HR_IMAGE_EXISTS by this employee photo is exist or not we come through.If exists.

3) Use the class cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp.

4) Now declare a global variable of type Xstring.

5) Now drag the variable from interface to context and create a graphic.

6) Now set the properties  Graphic type as Graphic Content, In field pass the Xstring which is given as global and Mime type as 'BMP'.

Output i got this but the photo is from SE78.I want it from PA30.

Thanks in advance.

Prashanth.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

How to Display Employee Photo in Adobe Forms from PA30

In order to do this follow the below steps.

1) First check whether employee photo is available or not by function module.

               
*******----------------------Employee Photo--------------------------------

data p_exists type c,
p_connect_info
like toav0.


call function 'HR_IMAGE_EXISTS'
exporting
p_pernr        
= wa_dim_emp-key-personnel_number "Employee No
p_tclas         
= 'A'
p_begda         
= sy-datum
*   P_ENDDA                     = '99991231'
importing
p_exists                   
= p_exists
p_connect_info             
= p_connect_info
exceptions
error_connectiontable      
= 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.

2) If employee photo exists then bring the image in binary format.

data : crep_id(2) type c,
doc_id 
type c length 40,
phio_id
type sdok_phid.

crep_id = p_connect_info-archiv_id.
doc_id
= p_connect_info-arc_doc_id.
phio_id
p_connect_info-object_id.

call function 'SCMS_R3DB_IMPORT'
exporting
mandt       
= sy-mandt
crep_id     
= crep_id
doc_id      
= doc_id
phio_id     
= phio_id
tables
content_info
= lt_content_info
content_txt 
= lt_content_txt
content_bin 
= lt_content_bin
exceptions
error_import
= 1
error_config
= 2
others       = 3.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

3) You will get the binary format in LT_CONTENT_BIN table .

4) Now convert this binary to XSTRING Value. For this use the below FM.

read table lt_content_info into wa_lt_content_info index 1.
if sy-subrc = 0.
l_fl
= wa_lt_content_info-first_line.
l_ll
= wa_lt_content_info-last_line.
l_fs
= wa_lt_content_info-comp_size.
endif.

The Above code is to get LAST LINE, FIRST LINE, SIZE pass these values in the below FM to get the XSTRING data.

Here the XSTRING variable is G_PHOTO.

call function 'SCMS_BINARY_TO_XSTRING'
exporting
input_length
= l_fs
first_line  
= l_fl
last_line   
= l_ll
importing
buffer       = g_photo
tables
binary_tab  
= lt_content_bin
exceptions
failed      
= 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.

5) Now we will get the XSTRING Value into G_PHOTO.

6) Now Drag and drop the G_PHOTO from interface  into context.

7)Right Click on G_PHOTO -> Create -> Graphic.

😎 In that

  • Graphic type is Graphic Content.
  • Field should be XSTRING variable i.e G_PHOTO Here.
  • Pass MIME Type as 'BMP'.

9) Follow the below screen.

     In this we have to bind the graphic to image field.

10) Now Bind the variable in Layout as shown in below screen.


We will get the ouput as below screen.

ameencse
Explorer
0 Kudos

Dear For me Not displaying photo(jpeg) in adobe form from pa30 .. i use same as what you explained.. I couldn't see you pics(point number 9 & 10 th pic)

please check my below code..

Please help me to solve the issue, i did same what mentioned up, but still photo not displaying in adobe form.. please check below my code…


REPORT yal_bring_img_frm_pa30_adobefm.

*TYPES: BEGIN OF ty_emp,
* pernr TYPE persno,
* name TYPE emnam,
* END OF ty_emp.

DATA: it_emp TYPE yal_image1,
wa_emp TYPE yal_image.

DATA: org_assignment TYPE STANDARD TABLE OF bapip0001b,
personal_data TYPE STANDARD TABLE OF bapip0002b,
internal_control TYPE STANDARD TABLE OF bapip0032b,
communication TYPE STANDARD TABLE OF bapip0105b,
archivelink TYPE STANDARD TABLE OF bapitoav0,
wa_archivelink TYPE bapitoav0,
wa_org_assign TYPE bapip0001b.

DATA: lt_content_info TYPE STANDARD TABLE OF scms_acinf,
lt_content_txt TYPE STANDARD TABLE OF sdokcntasc,
lt_content_bin TYPE STANDARD TABLE OF sdokcntbin,
lw_file_info TYPE scms_acinf.

DATA: l_fl TYPE i,
l_ll TYPE i,
l_fs TYPE i,
l_url TYPE XSTRING.
* l_url1 TYPE zXSTRING .

*Adobe paramters
DATA: fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams,
error_string TYPE string,
lv_form_name TYPE fpname,
fm_name TYPE rs38l_fnam.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text–t01.
PARAMETERS: p_pernr TYPE persno.
SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.
PERFORM f_get_data.
PERFORM f_call_form.
*&———————————————————————*
*& Form F_GET_DATA
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM f_get_data .
CALL FUNCTION ‘BAPI_EMPLOYEE_GETDATA’
EXPORTING
employee_id = p_pernr

date = sy–datum
* EXTENSION =
* READDB = FALSE
* ORGTXT_LG =
* JOBTXT_LG =
* POSTXT_LG =
* AUTHORITY_CHECK = ‘X’
* IMPORTING
* RETURN =
TABLES
org_assignment = org_assignment
personal_data = personal_data
internal_control = internal_control
communication = communication
archivelink = archivelink.

*step 2: user can upload more than one picture so i took the latest one.

SORT archivelink BY ar_date DESCENDING.
READ TABLE archivelink INTO wa_archivelink INDEX 1.

*Step 3: Call FM ‘SCMS_R3DB_IMPORT’ and pass Archive Link ID and Archive Link Document ID to get binary document contents.

CALL FUNCTION ‘SCMS_R3DB_IMPORT’
EXPORTING
mandt = sy–mandt
crep_id = wa_archivelink–archiv_id
doc_id = wa_archivelink–arc_doc_id
TABLES
content_info = lt_content_info
content_txt = lt_content_txt
content_bin = lt_content_bin
EXCEPTIONS
error_import = 1
error_config = 2
OTHERS = 3.
IF sy–subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

*Step 4: Now call FM ‘SCMS_BINARY_TO_XSTRING’ the XSTRING value.

READ TABLE lt_content_info INTO lw_file_info INDEX 1.

IF sy–subrc IS INITIAL.
l_fl = lw_file_info–first_line.
l_ll = lw_file_info–last_line.
l_fs = lw_file_info–comp_size.

CALL FUNCTION ‘SCMS_BINARY_TO_XSTRING’
EXPORTING
input_length = l_fs
first_line = l_fl
last_line = l_fl
IMPORTING
buffer = l_url
TABLES
binary_tab = lt_content_bin
EXCEPTIONS
failed = 1
OTHERS = 2.

ENDIF.

READ TABLE org_assignment INTO wa_org_assign
WITH KEY perno = p_pernr.
IF sy–subrc = 0.
wa_emp–pernr = p_pernr.
wa_emp–name = wa_org_assign–name.
APPEND wa_emp TO it_emp.
ENDIF.
ENDFORM. ” F_GET_DATA


*&———————————————————————*
*& Form F_CALL_FORM
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM f_call_form .
CALL FUNCTION ‘FP_JOB_OPEN’
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_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.

lv_form_name = ‘YAL_IMAGE’.

CALL FUNCTION ‘FP_FUNCTION_MODULE_NAME’
EXPORTING
i_name = lv_form_name
IMPORTING
e_funcname = fm_name.
* E_INTERFACE_TYPE =
* EV_FUNCNAME_INBOUND =

* Set output parameters and open spool job
fp_outputparams–preview = ‘X’. ” launch print preview
fp_docparams–langu = ‘E’.
fp_docparams–country = ‘US’.
*fp_docparams-fillable = ‘X’.

* Generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
lv_emp_photo = l_url
it_emp = it_emp
* IMPORTING
* /1BCDWB/FORMOUTPUT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4
.
IF sy–subrc <> 0.
* Implement suitable error handling here
ENDIF.

* Close spool job
*call function ‘FP_JOB_CLOSE’.
CALL FUNCTION ‘FP_JOB_CLOSE’
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy–subrc <> 0.
* Implement suitable error handling here
ENDIF.

ENDFORM. ” F_CALL_FORM


Answers (3)

Answers (3)

ameencse
Explorer
0 Kudos

Please help me to solve the issue, i did same what mentioned up, but still photo not displaying in adobe form.. please check below my code…


REPORT yal_bring_img_frm_pa30_adobefm.

*TYPES: BEGIN OF ty_emp,
* pernr TYPE persno,
* name TYPE emnam,
* END OF ty_emp.

DATA: it_emp TYPE yal_image1,
wa_emp TYPE yal_image.

DATA: org_assignment TYPE STANDARD TABLE OF bapip0001b,
personal_data TYPE STANDARD TABLE OF bapip0002b,
internal_control TYPE STANDARD TABLE OF bapip0032b,
communication TYPE STANDARD TABLE OF bapip0105b,
archivelink TYPE STANDARD TABLE OF bapitoav0,
wa_archivelink TYPE bapitoav0,
wa_org_assign TYPE bapip0001b.

DATA: lt_content_info TYPE STANDARD TABLE OF scms_acinf,
lt_content_txt TYPE STANDARD TABLE OF sdokcntasc,
lt_content_bin TYPE STANDARD TABLE OF sdokcntbin,
lw_file_info TYPE scms_acinf.

DATA: l_fl TYPE i,
l_ll TYPE i,
l_fs TYPE i,
l_url TYPE XSTRING.
* l_url1 TYPE zXSTRING .

*Adobe paramters
DATA: fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams,
error_string TYPE string,
lv_form_name TYPE fpname,
fm_name TYPE rs38l_fnam.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text–t01.
PARAMETERS: p_pernr TYPE persno.
SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.
PERFORM f_get_data.
PERFORM f_call_form.
*&———————————————————————*
*& Form F_GET_DATA
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM f_get_data .
CALL FUNCTION ‘BAPI_EMPLOYEE_GETDATA’
EXPORTING
employee_id = p_pernr

date = sy–datum
* EXTENSION =
* READDB = FALSE
* ORGTXT_LG =
* JOBTXT_LG =
* POSTXT_LG =
* AUTHORITY_CHECK = ‘X’
* IMPORTING
* RETURN =
TABLES
org_assignment = org_assignment
personal_data = personal_data
internal_control = internal_control
communication = communication
archivelink = archivelink.

*step 2: user can upload more than one picture so i took the latest one.

SORT archivelink BY ar_date DESCENDING.
READ TABLE archivelink INTO wa_archivelink INDEX 1.

*Step 3: Call FM ‘SCMS_R3DB_IMPORT’ and pass Archive Link ID and Archive Link Document ID to get binary document contents.

CALL FUNCTION ‘SCMS_R3DB_IMPORT’
EXPORTING
mandt = sy–mandt
crep_id = wa_archivelink–archiv_id
doc_id = wa_archivelink–arc_doc_id
TABLES
content_info = lt_content_info
content_txt = lt_content_txt
content_bin = lt_content_bin
EXCEPTIONS
error_import = 1
error_config = 2
OTHERS = 3.
IF sy–subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

*Step 4: Now call FM ‘SCMS_BINARY_TO_XSTRING’ the XSTRING value.

READ TABLE lt_content_info INTO lw_file_info INDEX 1.

IF sy–subrc IS INITIAL.
l_fl = lw_file_info–first_line.
l_ll = lw_file_info–last_line.
l_fs = lw_file_info–comp_size.

CALL FUNCTION ‘SCMS_BINARY_TO_XSTRING’
EXPORTING
input_length = l_fs
first_line = l_fl
last_line = l_fl
IMPORTING
buffer = l_url
TABLES
binary_tab = lt_content_bin
EXCEPTIONS
failed = 1
OTHERS = 2.

ENDIF.

READ TABLE org_assignment INTO wa_org_assign
WITH KEY perno = p_pernr.
IF sy–subrc = 0.
wa_emp–pernr = p_pernr.
wa_emp–name = wa_org_assign–name.
APPEND wa_emp TO it_emp.
ENDIF.
ENDFORM. ” F_GET_DATA
*&———————————————————————*
*& Form F_CALL_FORM
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM f_call_form .
CALL FUNCTION ‘FP_JOB_OPEN’
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_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.

lv_form_name = ‘YAL_IMAGE’.

CALL FUNCTION ‘FP_FUNCTION_MODULE_NAME’
EXPORTING
i_name = lv_form_name
IMPORTING
e_funcname = fm_name.
* E_INTERFACE_TYPE =
* EV_FUNCNAME_INBOUND =

* Set output parameters and open spool job
fp_outputparams–preview = ‘X’. ” launch print preview
fp_docparams–langu = ‘E’.
fp_docparams–country = ‘US’.
*fp_docparams-fillable = ‘X’.

* Generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
lv_emp_photo = l_url
it_emp = it_emp
* IMPORTING
* /1BCDWB/FORMOUTPUT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4
.
IF sy–subrc <> 0.
* Implement suitable error handling here
ENDIF.

* Close spool job
*call function ‘FP_JOB_CLOSE’.
CALL FUNCTION ‘FP_JOB_CLOSE’
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy–subrc <> 0.
* Implement suitable error handling here
ENDIF.

ENDFORM. ” F_CALL_FORM


sahirn
Active Contributor
0 Kudos

Check if this blog by Rizvi Saleheen helps:

http://scn.sap.com/docs/DOC-41805

Regards,

Sahir.

former_member215344
Contributor
0 Kudos

Hi Prasanth,

Check this thread:

http://scn.sap.com/thread/3438798

Thanks,

Ajay Bose

Former Member
0 Kudos

I have tried that but its download into presentation layer and upload it to the SE78 in BMP format

But i want directly from PA30 to adobe forms