Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamicaly Photo Print in Adobe Form

Former Member
0 Kudos

Hi,

how to fetch the detail form table toahr.

Sap_object = 'PREL', Reserve = 'JPG' and ar_object = 'HRICOLFOTO'.

I Got the ARC_DOC_ID form table toahr.How can i print this emp photo on adobe form.

is this hexadecimal value or string?

please explain the whole process for printing employee photograph on adobe form?

Thanks,

Raju

2 REPLIES 2

Former Member
0 Kudos

I resolved.

From toahr table pass value to ARCHIV_ID , RESERVE & ARC_DOC_ID.

DATA:

         lv_lengt            TYPE sapb-length,

         lv_binlength        TYPE sapb-length,

         lt_archivobject     TYPE TABLE OF docs,

         lt_binarchivobject  TYPE TABLE OF tbl1024.

   REFRESH: lt_archivobject,

            lt_binarchivobject.

   CLEAR: lv_lengt,

          lv_binlength.

*  BREAK-POINT.

   CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'

     EXPORTING

       archiv_id                = 'ZA'

       document_type            = 'JPG'

       archiv_doc_id            = '00155D0B70091ED4BA8425EE2D2A4258'

       all_components           = space

       signature                = space

       compid                   = space

     IMPORTING

       length                   = lv_lengt

       binlength                = lv_binlength

     TABLES

       archivobject             = lt_archivobject

       binarchivobject          = lt_binarchivobject

     EXCEPTIONS

       error_archiv             = 1

       error_communicationtable = 2

       error_kernel             = 3

       OTHERS                   = 4.

   IF sy-subrc NE 0.

     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

   ENDIF.

*  BREAK-POINT.

   IF lt_archivobject[] IS NOT INITIAL.

     DESCRIBE TABLE lt_archivobject LINES lv_rowcount.

     lv_rowcount = lv_rowcount * 1024.

     CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

       EXPORTING

         input_length       = lv_rowcount

        first_line         = 1

        last_line          = lv_rowcount

      IMPORTING

        buffer             = lv_xstring

       TABLES

         binary_tab         = lt_binarchivobject

*     EXCEPTIONS

*       FAILED             = 1

*       OTHERS             = 2

               .

     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.

CALL FUNCTION 'SSFC_BASE64_ENCODE'

   EXPORTING

     bindata                        = lv_xstring

*   BINLENG                        =

  IMPORTING

    B64DATA                        = ls_table-lv_string

* EXCEPTIONS

*   SSF_KRN_ERROR                  = 1

*   SSF_KRN_NOOP                   = 2

*   SSF_KRN_NOMEMORY               = 3

*   SSF_KRN_OPINV                  = 4

*   SSF_KRN_INPUT_DATA_ERROR       = 5

*   SSF_KRN_INVALID_PAR            = 6

*   SSF_KRN_INVALID_PARLEN         = 7

*   OTHERS                         = 8

           .

IF sy-subrc <> 0.

* Implement suitable error handling here

ENDIF.

endif.

IN adobe form 1 - Leave lv_string contents into context attribute IMAGE.

2 - Map IMAGE context attribute into your form to an IMAGE FIELD and check "Embed image data".

0 Kudos

Hi Raju ,

I just did what u suggest but in my adobe form it doesnt seem ?

here is my code snippet,

any help will be appreciated

thank u

best regards

DATA: ls_toahr    TYPE toahr ,

         doc_type    TYPE  toaom-doc_type,

         image_dat   LIKE  tbl1024    OCCURS WITH HEADER LINE.

   DATA: lv_str      TYPE string ,

         lv_str2     TYPE string ,

         image_xstr  TYPE xstring,

         image_len   TYPE       i,

         lv_final_string type string.

   break: magkus.

   SELECT  * INTO ls_toahr

             FROM toahr  WHERE object_id = pernr .

   ENDSELECT.

   IF sy-subrc EQ 0.

     CLEAR :image_dat[]  ,image_dat.

     doc_type = ls_toahr-reserve.

     CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'

       EXPORTING

         archiv_id                = ls_toahr-archiv_id

         document_type            = doc_type

         archiv_doc_id            = ls_toahr-arc_doc_id

       TABLES

         binarchivobject          = image_dat

       EXCEPTIONS

         error_archiv             = 1

         error_communicationtable = 2

         error_kernel             = 3

         OTHERS                   = 4.

     LOOP AT image_dat .

       lv_str2 = image_dat-line.

       CONCATENATE lv_str2 lv_str INTO lv_str.

     ENDLOOP.

     image_xstr = lv_str.

     image_len = XSTRLEN( image_xstr ).

*  describe table image_dat lines image_len.

*

*  image_len = image_len * 1024.

* convert binary data to xstring

     CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

       EXPORTING

         input_length = image_len

         first_line   = 1

         last_line    = image_len

       IMPORTING

         buffer       = image_xstr

       TABLES

         binary_tab   = image_dat

       EXCEPTIONS

         failed       = 1

         OTHERS       = 2.

*CALL FUNCTION 'SSFC_BASE64_ENCODE'

*   EXPORTING

*     bindata                        = image_xstr

**   BINLENG                        =

*  IMPORTING

*    B64DATA                        = lv_final_string

** EXCEPTIONS

**   SSF_KRN_ERROR                  = 1

**   SSF_KRN_NOOP                   = 2

**   SSF_KRN_NOMEMORY               = 3

**   SSF_KRN_OPINV                  = 4

**   SSF_KRN_INPUT_DATA_ERROR       = 5

**   SSF_KRN_INVALID_PAR            = 6

**   SSF_KRN_INVALID_PARLEN         = 7

**   OTHERS                         = 8

*           .

*

*move lv_final_string to pic_data.

*    pic_data =  lv_final_string.

     pic_data image_xstr.

   ENDIF.






and this part is which ım using on adobe form


logo = s_logo.

break magkus.

DATA: ls_form LIKE LINE OF t_form.

LOOP AT t_form INTO ls_form.

CALL FUNCTION 'ZHRPA_F016_F001'

   EXPORTING

     pernr    = ls_form-pernr

   IMPORTING

     pic_data = ls_form-l_picdata.

IMAGEN =   ls_form-l_picdata.

MODIFY t_form FROM ls_Form.

ENDLOOP.