Skip to Content

Employee photo display in adobe forms.

Hi,

I want to show the process to display employee picture in an adobe form report which upload from t-code OAAD.


Step 1: Call FM ‘BAPI_EMPLOYEE_GETDATA’ to get Archive Link ID and Archive Link Document ID.


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_ll
IMPORTING
buffer      = l_url
TABLES
binary_tab   = lt_content_bin
EXCEPTIONS
failed       =
1
OTHERS      = 2.

ENDIF.

Step 5: Append your value to the internal table.

Now go to your Adobe forms.

  • Add Graphic in the table.
  • Change the property Graphic Type as Graphic Content.
  • In Field use your XSTRING field.
  • Set MIME Type as ‘JPG/BMP’.

Enjoy,

Rizvi

10 Comments
You must be Logged on to comment or reply to a post.
      • HI,

        I declare same as what you display,.,.

         

        archivelink TYPE STANDARD TABLE OF  bapitoav0

         

        even though photo not display.. please check below my code..

        ———————————————–


        SPAN {
        font-family: “Courier New”;
        font-size: 10pt;
        color: #000000;
        background: #FFFFFF;
        }
        .L0S31 {
        font-style: italic;
        color: #808080;
        }
        .L0S32 {
        color: #3399FF;
        }
        .L0S33 {
        color: #4DA619;
        }
        .L0S52 {
        color: #0000FF;
        }
        .L0S55 {
        color: #800080;
        }
        .L0S70 {
        color: #808080;
        }
        REPORT  yal_bring_img_frm_pa30_adobefm.

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

        DATAit_emp            TYPE                    yal_image1,
        wa_emp            TYPE                    yal_image.

        DATAorg_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.

        DATAlt_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.

        DATAl_fl              TYPE i,
        l_ll              TYPE i,
        l_fs              TYPE i,
        l_url             TYPE XSTRING.
        *      l_url1             TYPE zXSTRING     .

        *Adobe paramters
        DATAfp_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 textt01.
        PARAMETERSp_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                   sydatum
        *   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        symandt
        crep_id      wa_archivelinkarchiv_id
        doc_id       wa_archivelinkarc_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 sysubrc <> 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 sysubrc IS INITIAL.
        l_fl lw_file_infofirst_line.
        l_ll lw_file_infolast_line.
        l_fs lw_file_infocomp_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 sysubrc 0.
        wa_emppernr p_pernr.
        wa_empname  wa_org_assignname.
        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 sysubrc <> 0.
        MESSAGE ID symsgid TYPE symsgty NUMBER symsgno
        WITH symsgv1 symsgv2 symsgv3 symsgv4.
        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_outputparamspreview    ‘X’.    ” launch print preview
        fp_docparamslangu   ‘E’.
        fp_docparamscountry ‘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 sysubrc <> 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 sysubrc <> 0.
        * Implement suitable error handling here
        ENDIF.

        ENDFORM.                    ” F_CALL_FORM

        ————————————————

  • 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.

    DATAit_emp            TYPE                    yal_image1,
    wa_emp            TYPE                    yal_image.

    DATAorg_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.

    DATAlt_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.

    DATAl_fl              TYPE i,
    l_ll              TYPE i,
    l_fs              TYPE i,
    l_url             TYPE XSTRING.
    *      l_url1             TYPE zXSTRING     .

    *Adobe paramters
    DATAfp_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 textt01.
    PARAMETERSp_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                   sydatum
    *   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        symandt
    crep_id      wa_archivelinkarchiv_id
    doc_id       wa_archivelinkarc_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 sysubrc <> 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 sysubrc IS INITIAL.
    l_fl lw_file_infofirst_line.
    l_ll lw_file_infolast_line.
    l_fs lw_file_infocomp_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 sysubrc 0.
    wa_emppernr p_pernr.
    wa_empname  wa_org_assignname.
    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 sysubrc <> 0.
    MESSAGE ID symsgid TYPE symsgty NUMBER symsgno
    WITH symsgv1 symsgv2 symsgv3 symsgv4.
    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_outputparamspreview    ‘X’.    ” launch print preview
    fp_docparamslangu   ‘E’.
    fp_docparamscountry ‘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 sysubrc <> 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 sysubrc <> 0.
    * Implement suitable error handling here
    ENDIF.

    ENDFORM.                    ” F_CALL_FORM