Skip to Content
author's profile photo Former Member
Former Member

How to print employee photo in smartform through application server?

Hi,

I have tried with different function modules and methods. I got it through presentation server , But client requirement is photos stored in application server and it should be get it from Appl. Server and print it on the smartforms.

Please reply ASAP.

thanks in Advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2013 at 07:17 AM

    Hi All,

    Employee Photo Dynamically in Smart forms through Presentation server

    I got this requirement.The below code is helpful to Upload the Image into SE78 and print the Employee photo Dynamically in Smart forms.

    1) First check whether the photo for employee exist in PA30 or not. In order to do this use the below Function Module


    call function 'HR_IMAGE_EXISTS'
    exporting
    p_pernr = t_pernr-pernr
    p_tclas = 'A'
    p_begda = '18000101'
    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.

    Pass Employee number, Begda, Endda and will get the following data.

    P_EXISTS = 1 means Photo Exists ; P_CONNECT_INFO will fill the data as below details in debugging mode.



    MANDT
    200
    SAP_OBJECT
    PREL
    OBJECT_ID
    00000500
    ARCHIV_ID
    Z2
    ARC_DOC_ID
    E33AEFA2BEBC9EF18ABA00151761ADAC
    AR_OBJECT
    HRICOLFOTO
    AR_DATE
    20131022
    DEL_DATE

    RESERVE
    JPG

    2) Now Read the image in JPG format by using below function module.


    call function 'ALINK_RFC_TABLE_GET'
    exporting
    im_docid = p_connect_info-arc_doc_id
    im_crepid = p_connect_info-archiv_id
    importing
    ex_length = length
    tables
    ex_document = it_doc.

    Pass the values p_connect_info-arc_doc_id p_connect_info-archiv_id will get length and binary forma t in the table IT_DOC as shown in the below in debugging mode.

    1 FFD8FFE000104A46494600010100000100010000FFDB00840009060614121014131214141514141418141814141517151417141714151415141515171C261E1719231914141F2F202427292C2C2C151E3135302A35262B2C2901090A0A0E0C0E1A0F0F18291C1F1D2C2C2C2C292C292929292929292D2C2C292C29292C292C2 2 0A8AD713DAE3B6A2BE2B2B3B326FB5ADA51B99DA759EDDEA7CF4E5E6BCD2EDE7975DECA9CF79554FC779CCEC1EB52B22CC44A0DA70071F24AE568EC067514D9DA4A5CBCBD40001DDB49D655DD97A2CF8B89E8B762A4F2C61DB2F0C529F466DE4B89A0A5332510A167B33D95FE16EE53442ACC462E7918E74073E02AAD5FA1AC 3 5C0E40404793CDFDF2A528B279BFBE54A42410842023CFF56EDC544E5684EF52ED0EADDB8AA0B6A6AE071DEB9E44FC17835E4BF87340EB4E88836AF217E93C473A8C7118ABDB3A662915311DC573967D9ED23B474EE7CA67A1A1505936B9BC18F35AE455FAEB0C8A6AD1C6707074CF1BD3DD1F05BCE4D2FB221691F130C4A34 4 1B0D911C6AD041C08201FA2DB69159D79BCA37DA68C7B5BE61661C49DE3EABCACB07091EB61C9BA36574BC2892CCBB09EF63710037A4C15D81D5A6E5262DAF15F7499878BA29486C68AE19B89AD7C1498B1B0A2AB88C71385688B2B3428C5FBABEC350ECBE51E5EEAF48D5CE71AB9CAC5C436806D0028D0E2119A761626AB9C 5 576E1DBA974859CD3EB4393937436FB73158205686E91D320F770F152B92198DB534BE3C78CE89022BA1C23D186DBA3168F7F1D6ECF82AFB3B49262563189CABE203EDB1EE2E6B80D401F65DDA3F851ECC814830C6C6807C30FC28569837A83124D29EBD7E7D658E1B6A8F21E59B9767B45936BC39A80C8D08D58F1E20E45A7 6 C98D812C515CE8CDF88715D6CC37E21C55872636047263604B1441E70DF887147386FC438A9DC98D811C98D812C51039C37E21C541B61822407B5A5A5C5A40C40C69B4ABDE4C6C08E4C6C0A54A9D90E29AA3CB7FE9B98AFB2DFF00761EDEF78FF354889A2D307DD67FB8CDBDEF5F55EABC98D811C98D8169FD664F87E7CCC7F

    Length will be in the below screen shot.

    LENGTH
    5417

    3) Now Convert the image from JPG Format to Binary Format by using the below function module.


    Before calling this Function module pass the parameters as below.


    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_bin = it_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.

    No we will get the binary format in the table IT_BIN which we have given in FM. Binary format looks like below screen shot.

    1 FFD8FFE000104A46494600010100000100010000FFDB00840009060614121014131214141514141418141814141517151417141714151415141515171C261E1719231914141F2F202427292C2C2C151E3135302A35262B2C2901090A0A0E0C0E1A0F0F18291C1F1D2C2C2C2C292C292929292929292D2C2C292C29292C292C2 2 48200A8AD713DAE3B6A2BE2B2B3B326FB5ADA51B99DA759EDDEA7CF4E5E6BCD2EDE7975DECA9CF79554FC779CCEC1EB52B22CC44A0DA70071F24AE568EC067514D9DA4A5CBCBD40001DDB49D655DD97A2CF8B89E8B762A4F2C61DB2F0C529F466DE4B89A0A5332510A167B33D95FE16EE53442ACC462E7918E74073E02AAD5F 3 A6CCA3885C0E40404793CDFDF2A528B279BFBE54A42410842023CFF56EDC544E5684EF52ED0EADDB8AA0B6A6AE071DEB9E44FC17835E4BF87340EB4E88836AF217E93C473A8C7118ABDB3A662915311DC573967D9ED23B474EE7CA67A1A1505936B9BC18F35AE455FAEB0C8A6AD1C6707074CF1BD3DD1F05BCE4D2FB221691F 4 F731DB68A96D1B0D911C6AD041C08201FA2DB69159D79BCA37DA68C7B5BE61661C49DE3EABCACB07091EB61C9BA36574BC2892CCBB09EF63710037A4C15D81D5A6E5262DAF15F7499878BA29486C68AE19B89AD7C1498B1B0A2AB88C71385688B2B3428C5FBABEC350ECBE51E5EEAF48D5CE71AB9CAC5C436806D0028D0E211 5 C86EA8C730855814576E1DBA974859CD3EB4393937436FB73158205686E91D320F770F152B92198DB534BE3C78CE89022BA1C23D186DBA3168F7F1D6ECF82AFB3B49262563189CABE203EDB1EE2E6B80D401F65DDA3F851ECC814830C6C6807C30FC28569837A83124D29EBD7E7D658E1B6A8F21E59B9767B45936BC39A80C8 6 E3B698B871561C98D811C98D812C515CE8CDF88715D6CC37E21C55872636047263604B1441E70DF887147386FC438A9DC98D811C98D812C51039C37E21C541B61822407B5A5A5C5A40C40C69B4ABDE4C6C08E4C6C0A54A9D90E29AA3CB7FE9B98AFB2DFF00761EDEF78FF354889A2D307DD67FB8CDBDEF5F55EABC98D811C98

    4) Now create a folder in the presentation layer in one of the directory. By using below function module.

    call function 'TMP_GUI_CREATE_DIRECTORY'
    exporting
    dirname = 'C:\XYZ'
    no_flush = ' '
    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 download the image of the pernr into this folder by using below function module.

    call function 'GUI_DOWNLOAD'
    exporting
    filename = 'C:\XYZ\test.jpg'
    filetype = 'BIN'
    tables
    data_tab = it_bin
    exceptions
    file_write_error = 1
    no_batch = 2
    gui_refuse_filetransfer = 3
    invalid_type = 4
    no_authority = 5
    unknown_error = 6
    header_not_allowed = 7
    separator_not_allowed = 8
    filesize_not_allowed = 9
    header_too_long = 10
    dp_error_create = 11
    dp_error_send = 12
    dp_error_write = 13
    unknown_dp_error = 14
    access_denied = 15
    dp_out_of_memory = 16
    disk_full = 17
    dp_timeout = 18
    file_not_found = 19
    dataprovider_exception = 20
    control_flush_error = 21
    others = 22.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

    It will download into the path which you have given.


    6) Now upload the file which you have downloaded by using the function module.


    call function 'GUI_UPLOAD'
    exporting
    filename = 'C:\XYZ\test.jpg'
    filetype = 'BIN'
    importing
    filelength = l_content_length
    tables
    data_tab = mime
    exceptions
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    others = 17.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

    Now the binary data will come into the which Table you have given. Mime looks like below table in debugging mode.

    1 FFD8FFE000104A46494600010100000100010000FFDB00840009060614121014131214141514141418141814141517151417141714151415141515171C261E1719231914141F2F202427292C2C2C151E3135302A35262B2C2901090A0A0E0C0E1A0F0F18291C1F1D2C2C2C2C292C292929292929292D2C2C292C29292C292C2 2 0762E12382B22493F1163492A2C2FFC4001A010100030101010000000000000000000000010204030506FFC4002B110002020104010107050100000000000000010211030412213141513242618191A1F0142223527113FFDA000C03010002110311003F00F71421080E3DD4154C3A3BB5309F16F9A27CFF004DDB8A75A7040 3 ED2CD418E21D4ED2705A5B07F55E5661D75E7917569479A8F1701415406C79C3FE59E2DF347387FCB3C5BE6BB0A307005A41071041C2894A2C08E70FF9678B7CD1CE5FF2CFFE4DF34B42581BE72EF9678B7CD1CE9DF2CF16F9A728B8960473B77CB3C5BE6B9CEDDF2CF16F9A71144B037CF1DF01E2DF3409C77C078B7CD2E89 4 DA24D49152E1B8EC5061C20E79146B699FDA8AE4160D982412DA9AEB73E87C1A06499134F00E39F60AF14DC66B618EDD9B366090C68751C4977EDF669BC8D480D3E8CE99CC4070672CFA120F44D7235A11AC762F76D1CD33979B0032236FD07449A1AEBC0E6BE64966DF34690D3AC8C0760ED534CC5C70783419DE19DECB01A 5 478848200A8AD713DAE3B6A2BE2B2B3B326FB5ADA51B99DA759EDDEA7CF4E5E6BCD2EDE7975DECA9CF79554FC779CCEC1EB52B22CC44A0DA70071F24AE568EC067514D9DA4A5CBCBD40001DDB49D655DD97A2CF8B89E8B762A4F2C61DB2F0C529F466DE4B89A0A5332510A167B33D95FE16EE53442ACC462E7918E74073E02A 6 1C9A5A141027935CE4D2D08047268E4C25A1011A4F37F7CA94A2C9E6FEF95290904210808F3FD5BB714EB324D4FF0056EDC510A2634403E8421080594FD4A75241C6B4E9B3C713871A705AB594FD49603226BF319FFD6684A3E7AB431713A8934EDA0C94CB1F471EE7B0904870272D8479A8D159CAC60D1855D4FAE345EEB66 7 B3AF87A9F048F1638107812B2BA79618968ED7B07462570D55561FA533572D4806B406F3493B0C370A1F1A2F6A12DD1B3C8C91DB2A3E8D085C057558E208421002108404693CDFDF2A528B279BFBE54A42410842023DA1D5BB7151E59DD33BCFDD48B43AB76E299971471DEAADF45974C9A10842B140543A712A1F211AA2B75 8 AEF008ECC28B338A8F29D9AA3C9E95CE565F49B491F0FA305B79FB890ACE4E6395877C64B356D4CBDB78B1B78E436D720A9B8B245443B3ED098379D14306C3853FB54A81624D31D79B18120D48191DFB15746B2DF19ADE51EF6BF1BD57920ECBAD0401B158D99A34D639AE63E25E1AC3C81E2061F45D2524977F62141D9234C 9 DA962305A6CCA3885C0E40404793CDFDF2A528B279BFBE54A42410842023CFF56EDC544E5684EF52ED0EADDB8AA0B6A6AE071DEB9E44FC17835E4BF87340EB4E88836AF217E93C473A8C7118ABDB3A662915311DC573967D9ED23B474EE7CA67A1A1505936B9BC18F35AE455FAEB0C8A6AD1C6707074CF1BD3DD1F05BCE4D2F 10 AE9BB3EAE5A580D0D6055F330CDE2B9B5C2262EDB2B65AC96EC1C15AC1926B460A0BDE58ECEA295ED4B816987615C76284D792EEFC135D082836CB5D5686665C012753759F5B549116A94F9474522E826ED6B4D55C95FB4D2395D49363166C2E4CB8B356B3ADCEF2093684D46A60EA2B8852BC9C30D7675AFF000AAED38A034 11 258EA1DAB410306A996BC950D557BA2E0BC7CADA9727B58A9C7814D8E5AE041C410BD0A03EAD07680BCCCC4C57A259512B099B82D5A47DA326B23D31AB5E42FB6A295008236B4E74ED54D09D7594D828372D55151DB9221ADBED14C71FC1EC57CF8BDF473C1978D8CA28F334AD55743B42AEBC05686A9768C22E6D465AD679D 12 18D28B3DA3BA3A5AE312238BA244A9738D4EE009D431470A56C6E6FAE8D64B83742BFD1F3EDEE54D129414571601F6C760FBABE1E199F33B476D188A927A1D42B7B4450AA99888B9E5ECEF85544CD4CD921CE54D6B597742D93DC1554F491898342E716DBE0D3C25C8DFE95C6A39EDFDCBD760BB05E75A11A2EE82F738EB5E8 13 30A662E2C1B8F731DB68A96D1B0D911C6AD041C08201FA2DB69159D79BCA37DA68C7B5BE61661C49DE3EABCACB07091EB61C9BA36574BC2892CCBB09EF63710037A4C15D81D5A6E5262DAF15F7499878BA29486C68AE19B89AD7C1498B1B0A2AB88C71385688B2B3428C5FBABEC350ECBE51E5EEAF48D5CE71AB9CAC5C43680 14 1B13259BFBE54A5164F37F7CA94AA5810842023DA1D5BB71559331A84EF2ACED0EADDB8AA89A6549DE7EEBB62ECE397A29E7E29C564A2C125C46D5B29A95255746B331A80B3EB70EFA68DDA1CAA29A644B2E44340ED5A3966D060AB61B2945652E16DC51518248C1A99396464C85108532047C541AA5B22238D9C93A2D620BC 15 D3151931A4B8EFC00DFE4AD857F2239666B6337775331A89F6BB050A7222F5D2E4F21B084A5342852614DAAE8CAA16B84A417A497A8A02A4B37F7CA94A2C8E6FEF152950B821084047B43AB76E2ABA266779FBAB1B43AB76E2AB9DED1DE7EEBAE3396410E84A1C782AC2A9B7B6ABB77D9C949C7A2B21CB638A9B0E15138C849 16 FA1BF16AFC4FEA649B08EC4A229AD2E7E4E3C0C2243753E268BCD3E232F14C59D66469B7010C16C3F7A2B87446DBBF11DDE2B2284AF6D726B79235BAF815018F8F1042802AED6E3ECB1BF138FE35ADF59365B65E1086DC4E6E79CDCED64F922CAB261CB43B90C76971C5CE77C4E3ACA9555EA60C0B1AB7D9E5E7CEF23A5D0EB 17 4896BA88210E1815C86EA8C730855814576E1DBA974859CD3EB4393937436FB73158205686E91D320F770F152B92198DB534BE3C78CE89022BA1C23D186DBA3168F7F1D6ECF82AFB3B49262563189CABE203EDB1EE2E6B80D401F65DDA3F851ECC814830C6C6807C30FC28569837A83124D29EBD7E7D658E1B6A8F21E59B976 18 69D0B584ECFF0056EDC570394A218D8AA539ABA571A55881B2084088964AE16A03A1CB84A416203F6A00252494E5022E2014C35590B76CD135337C934842E3003857DF778900782D6B986869855419C8018010060AD17C9492E0F3074B4461731AD6F45E455CEED34A018A8D62CA3A24FC263EED0971C2B98692063B8F05713 19 1247DFEF296B99704210808F3FD5BB714DB9A9C9FEADDB8A42944310D7EA39FDD17F1F5AD0F09A763BFEEAC558EA024C28979B5F03BC258408EA1CC4342528246AED12DA52A8925A80E92ABED27615D97BFC4A9EA05A90EB0DFDD77F89568F6565D1E6EF1AFB2BEBD7D728530CAFAF5EBB6A54E77E3F8F5F938A622C3F5FF1E 20 4DF415DC174342B15A1B832E5AF241E8BB1235870D63B08FB274A4F2FA92AB508058426DAE4BAA1274141292BA54038543B44FF4DE3F63BFC4A98ABADA7DD84E3FB5C38B48568F6525D1E72756EF597AF0C521CEA8F5EBD6C4B06BEBCFD7860A3C4750FADBE7E89C17B67CFA3D0F42625651BD8E78FF00D8ABC2566740E2FF0 21 9B228AD7C46EA70E2950E3B698B871561C98D811C98D812C515CE8CDF88715D6CC37E21C55872636047263604B1441E70DF887147386FC438A9DC98D811C98D812C51039C37E21C541B61822407B5A5A5C5A40C40C69B4ABDE4C6C08E4C6C0A54A9D90E29AA3CB7FE9B98AFB2DFF00761EDEF78FF354889A2D307DD67FB8CDB 22 60472636258A1893652F1DA6AA4A28850482108400842100210840084210021084008421002108400842100210840084210021084008421002108407FFD900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 23 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 24 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

    We will get binary length into L_CONTENT_LENGTH.The below screen shot shows the length.

    L_CONTENT_LENGTH
    6132
    F4170000

    7) Now convert the binary to bitmap using the below code.


    create object i_igs_image_converter .
    i_igs_image_converter->input = 'image/jpeg'.
    i_igs_image_converter->output = 'image/x-ms-bmp'.
    i_igs_image_converter->width = '100'.
    i_igs_image_converter->height = '100'.


    call method i_igs_image_converter->set_image
    exporting
    blob = mime
    blob_size = l_content_length.
    call method i_igs_image_converter->execute
    exceptions
    communication_error = 1
    internal_error = 2
    external_error = 3
    others = 4.

    if sy-subrc = 0.
    dpi = '100'.
    call method i_igs_image_converter->get_image
    importing
    blob = blob
    blob_size = blob_size
    blob_type = blob_type.
    endif.

    Blob will fill with the data like below in debbuging mode.

    1 424D66750000000000003600000028000000640000006400000001001800000000003075000048000000480000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 2 FFFFFFFEFEFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFEFEFEFEFEFEFFFFFFFFFFFFFFFFFFFEFEFEFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFDFDFDFEFEFEFEF 3 FEFEFEFDFDFDFEFEFEFDFDFDFEFEFEFEFEFEFDFDFDFDFDFDFEFEFEFEFEFEFEFEFEFEFEFEFDFDFDFDFDFDFEFEFEFEFEFEFD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1D8D5DCD3D0E6DDDAE8DFDCEBE5E3E1E1E0EEEEEEFCFCFCFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFCFEFEFDFEFEFBFBFBE8E7E6ECEAE8F4F1EEF5F 16 CEA354CDA253CCA053C99C51C4974DC2954CC3974FB79053E4CCAFFBF2E7F4F3E4F2F1E4F4ECEDF2EEEEF0F2E9F4F2EDF5F2EDF5F2EEF5F2EEF7F4F0F7F4F0F8F5F1F8F4F1F5F0EDF0EBE8EAE5E2E7E2DFE6E1DEE7E2DFE7E2DFE8E2DFEEE5E2F2E9E6EDE4E1E3DAD7BBB2AFE1D8D5E7DEDBE7E1DFE1E1E1EEEEEEFCFCFCFEF 17 F6F3EFF6F3EFF7F4F0F7F4F0F6F3EFF6F3EEF6F3EDF6F3ECF5F2ECF5F2ECF5F0E8F4EDE0EFE5D4DECDADCAA460CFA455CCA052CB9F53C6994FC5984EC79A51C49951B69258E8D3B9FBF3EBF4F5E7F3F3E7F4EEEEF3EEEEF2F2E9F4F2EDF5F2EDF5F2EEF5F2EEF6F3EFF7F4F0F9F6F2FAF6F2F7F2EFF3EEEBEDE8E5E8E3E0E7E 18 F8F4EFF6F2EDF5F1ECF5F1ECF3F0EBF6F2EFF8F3F0F8F3F1F8F3F1F8F3F1F8F3F0F8F3F0F8F3F0F6F3EFF6F3EFF7F4F0F7F4F0F7F4F0F7F4F0F6F3EFF6F3EEF6F3EDF6F3ECF5F2ECF4F1ECF6F1E9F3EDDFF3E9D7E0CDAECAA45FCEA354CBA051CCA053C79A4FC99C53CA9D54C39952B7955FEDD9C3FAF3EDF4F7EBF4F5EAF6E

    8) Now Convert Bitmap to BDS by using the function module.

    call function 'SAPSCRIPT_CONVERT_BITMAP_BDS'
    exporting
    color = 'X'
    format = 'BMP'
    bitmap_bytecount = length
    importing
    width_tw = l_width_tw
    height_tw = l_height_tw
    width_pix = l_width_pix
    height_pix = l_height_pix
    dpi = dpi

    tables
    bitmap_file = blob
    bitmap_file_bds = l_bds_content
    exceptions
    format_not_supported = 1
    no_bmp_file = 2
    bmperr_invalid_format = 3
    bmperr_no_colortable = 4
    bmperr_unsup_compression = 5
    bmperr_corrupt_rle_data = 6
    tifferr_invalid_format = 7
    tifferr_no_colortable = 8
    tifferr_unsup_compression = 9
    bmperr_eof = 10
    others = 11.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

    By the above FM we get the below details which we given in above FM in debugging mode.

    LENGTH 5417 L_WIDTH_TW 01920 L_HEIGHT_TW 01920 L_WIDTH_PIX 00100 L_HEIGHT_PIX 00100 DPI 075 L_BDS_CONTENT Standard Table[12x1(1022)]

    The L_BDS_CONTENT will have the data as below screen shot in debugging mode.

    9) Now upload the Picture in SE78 by using the below code:

    create object l_bds_object.
    wa_bds_components-doc_count = '1'.
    wa_bds_components-comp_count = '1'.
    wa_bds_components-mimetype = c_bds_mimetype.
    wa_bds_components-comp_size = blob_size. "l_bds_bytecount.
    append wa_bds_components to l_bds_components.
    wa_bds_signature-doc_count = '1'.
    append wa_bds_signature to l_bds_signature.


    call method l_bds_object->create_with_table
    exporting
    classname = c_bds_classname
    classtype = c_bds_classtype
    components = l_bds_components
    content = l_bds_content
    changing
    signature = l_bds_signature
    object_key = l_object_key
    exceptions
    others = 1.
    read table l_bds_signature index 1 into wa_bds_signature
    transporting doc_id.
    p_docid = wa_bds_signature-doc_id.
    call method l_bds_object->update_with_table
    exporting
    classname = c_bds_classname
    classtype = c_bds_classtype
    object_key = l_object_key
    doc_id = p_docid
    doc_ver_no = '1'

    doc_var_id = '1'
    changing
    components = l_bds_components
    content = l_bds_content
    exceptions
    nothing_found = 1
    others = 2.
    wa_stxbitmaps-tdname = t_pernr-pernr.
    wa_stxbitmaps-tdobject = 'GRAPHICS'.
    wa_stxbitmaps-tdid = 'BMAP'.
    wa_stxbitmaps-tdbtype = 'BCOL'.
    wa_stxbitmaps-docid = p_docid.
    wa_stxbitmaps-widthpix = '450'. "'540'."'640' ."l_width_pix.
    wa_stxbitmaps-heightpix = '400'. "'480'. "l_height_pix.
    wa_stxbitmaps-widthtw = '11200'. "'12288'."l_width_tw.
    wa_stxbitmaps-heighttw = '8000'. "'9216'."l_height_tw.
    wa_stxbitmaps-resolution = '100'.
    insert into stxbitmaps values wa_stxbitmaps.

    Now go to SE78 and check the Picture.Please Upload the photo of employee in SE78 by passing employee number as the name of the photo.

    10) Now delete the file which is present on presentation layer by using below FM.


    call method cl_gui_frontend_services=>file_delete
    exporting
    filename = 'C:\XYZ\test.jpg'
    changing
    rc = rc
    exceptions
    file_delete_failed = 1
    cntl_error = 2
    error_no_gui = 3
    file_not_found = 4
    access_denied = 5
    unknown_error = 6
    not_supported_by_gui = 7
    wrong_parameter = 8
    others = 9.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

    11) Now After all the employees delete the floder in the presentation layer which you have created.

    Note: Give the name of the Picture when your are uploading into SE78 as Employee Number so that for every employee we will get pictures individually in SE78 as name as Employee Number.

    Now in order to print Employee Photo dynamically in smart forms. Generally we use graphic window for displaying Logos, Photos etc.

    But here we have to print Employee Photo for particular employee. So in order to do this code as shown below .This code we have to create program lines then we need to write below code before graphic node.

    clear g_count.
    g_count = g_count + 1.
    read table t_pernr index g_count.
    g_pernr = t_pernr-pernr.
    wa_stxbitmaps-tdname = g_pernr.
    wa_stxbitmaps-tdobject = 'GRAPHICS'.
    wa_stxbitmaps-tdid = 'BMAP'.
    wa_stxbitmaps-tdbtype = 'BCOL'.

    call function 'SSFCOMP_PRINT_GRAPHIC'
    exporting
    bm_name = wa_stxbitmaps-tdname
    bm_object = wa_stxbitmaps-tdobject
    bm_id = wa_stxbitmaps-tdid
    bm_type = wa_stxbitmaps-tdbtype
    bm_dpi = '0100'
    exceptions
    error = 1
    non_main_overflow = 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.




    Add a comment
    10|10000 characters needed characters exceeded

    • Hi out there,

      Thank you for this detailled post.

      but I have trouble with step 2.

      * 2) Now Read the image in JPG format by using below function module.

      data ls_bapiret2 TYPE BAPIRET2.

      The content of p_connect_info is:

      MANDT 002 SAP_OBJECT PREL OBJECT_ID 00012345 ARCHIV_ID P1 ARC_DOC_ID DDB2164FF1D13F77E1000000AC1F044C AR_OBJECT HRICOLFOTO AR_DATE 20120118 DEL_DATE RESERVE JPG

      CALL FUNCTION 'ALINK_RFC_TABLE_GET'

      EXPORTING

      im_docid = p_connect_info-arc_doc_id

      im_crepid = p_connect_info-archiv_id

      IMPORTING

      ex_length = length

      EX_MESSAGE = ls_BAPIRET2

      TABLES

      ex_document = it_doc.

      ls_BAPIRET2 =

      Fehler bei HTTP-Zugriff: IF_HTTP_CLIENT->RECEIVE 1 ICM_HTTP_CONNECTION_FAILED

      Any Idea how to handle with this error?

      thank you in advance...

  • Posted on Oct 16, 2013 at 08:56 AM

    Hi Srinivas,

    If you have images in application server , then u can transter the image from application server into se78 .

    View The link for the program :My Experiments with ABAP: Uploading image file into SE78 using ABAP Program

    after uploading in se78 , try to insert images in smartforms as suggested by many.

    Let me also give some reference: How to insert Image in Smartform? | SCN

    Hope this Helps 😊

    Sivaganesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 28, 2013 at 08:13 AM
    Hi,Use the FM HR_IMAGE_EXISTS and SCMS_DOC_URL_READ to get the url of the image of an employee using pernr no. Create a graphics in smartform and set the url dynamically to it. CALL FUNCTION 'HR_IMAGE_EXISTS' EXPORTING p_pernr = pernr IMPORTING p_connect_info = v_info. CALL FUNCTION 'SCMS_DOC_URL_READ' EXPORTING stor_cat = space crep_id = v_info-archiv_id doc_id = v_info-arc_doc_id comp_id = 'DATA' dp_url_only = 'X' IMPORTING url = v_url. Pass this url v_url to the smartform. Regards,Jeffin
    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      You can add only *.BMP format images to smartform.Upload each employee photo into smartform with filename as employee number ie,pernr.So the images will be unique and pass pernr as the url of the image to the smartform.Inthe above code you can get the url of the employee but cant be passed to the smartform because the image doesnt exist in se78,you can assign it to a picture container to dispaly it.

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

      Regards,

      Jeffin

  • Posted on Oct 16, 2013 at 07:13 AM

    You can print the photos if it is uploaded as image in SE78

    check this link

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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 16, 2013 at 07:20 AM

    Hi,

    Smartforms only support images uploaded in SE78.

    Regards,

    Ashish Rawat

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      In this scenario , I have to get the image from PA30 based on employee numbers.For this I used FM

      1. call function 'HR_IMAGE_EXISTS'---->It will check whether photo exits or not in that particular pernr.

      then i used this below FM's for converting data into Binary Format.


      2.call function 'ALINK_RFC_TABLE_GET'

      3.call function 'SCMS_R3DB_IMPORT'.

      In this situation I have tested in AL11 (Appl.Server) , The image exists in AL11.

      Now I have to convert the Binary to Bitmap for uploading the image in SE78.






  • author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2013 at 08:37 AM

    Check this link.It will give some idea.

    http://wiki.scn.sap.com/wiki/display/ABAP/SMART+FORM+guide

    Regards

    Ansumesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 05, 2013 at 02:04 PM

    GO through this link it may helpful for above requirement.

    http://scn.sap.com/message/14482958

    Thanks&regards,

    Srinivas katreddy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 10, 2016 at 10:28 AM

    i have some problem with uploading module the image name is exist in se78 but file does not display.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.