cancel
Showing results for 
Search instead for 
Did you mean: 

Employee photo not display from PA30 to adobe forms.

ameencse
Explorer
0 Kudos

Dear All,

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


PascalBremer
Advisor
Advisor

I would suggest you generate a pdf with additional information: https://launchpad.support.sap.com/#/notes/944221

Then you can use the xdp + xfd.xml (runtime data) to debug your scenario in livecycle designer or check if the image is included in the runtime data.
I assume there might be an issue with your template, but as I have neither of these files I cannot comment on this.

Best regards
Pascal

Accepted Solutions (0)

Answers (1)

Answers (1)

ameencse
Explorer
0 Kudos

Dear Pascal,

Please check my Adobe form Screen shots..

PascalBremer
Advisor
Advisor
0 Kudos

What is the binding path of your GRAPHIC field?
Did you check if lv_emp_photo is filled in the runtime data?