SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Export graphic object from SE78



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming -> Graphics
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 13, 2008 7:36 pm    Post subject: Export graphic object from SE78 Reply with quote

Author: Keerthi Hiremath

In release 46C, the transaction code SE78, used for storing graphic objects, does not provide a way to extract the objects once stored. I needed to get the logos out of SAP. Yeah, I could have scanned it again, but where is the fun in that? Here is the code. It is very simple - cobbled together from SAP function modules. It is released under the GPL license - just kidding.

Code:
*&---------------------------------------------------------------------*
*& Report  Z_EXPORT_GRAPHIC_FROM_SE78                                  *
*&                                                                     *
*&---------------------------------------------------------------------*
*&   This program exports logos from SE78 to a pc file in .bmp format  *
*&                                                                     *
*&---------------------------------------------------------------------*

report  z_export_graphic_from_se78    .

*
*-----------------------------------------------------------------------
* Description: This program extracts graphic logos from the BDS and
*              saves it as a .bmp file on the pc.  Transaction SE78
*              does not provide a way to export logos.
* Author     : Keerthi Hiremath
* Date       : 15JAN2003
* Request    :
* Design doc :
*
*
*-----------------------------------------------------------------------
*                 M O D I F I C A T I O N    L O G
*-----------------------------------------------------------------------
*-----------------------------------------------------------------------
*@DAT                         D A T A
*-----------------------------------------------------------------------
type-pools: sbdst .
data : git_content type sbdst_content.
data : git_rawdata type w3mime occurs 0,
       g_bitmaptypeout type c.
data : begin of git_bitmap occurs 0,
             line(1000),
       end   of git_bitmap.
data : g_bytecount type i.
*-----------------------------------------------------------------------
*@SSL             S E L E C T I O N   S C R E E N
*-----------------------------------------------------------------------
selection-screen: begin of block b01 with frame title text-b01.
parameters      : p_obj like stxbitmaps-tdobject default 'ZOGLGRPOBJ',
                  p_nam like stxbitmaps-tdname,
                  p_id  like stxbitmaps-tdid default 'ZC',
                  p_ref like stxbitmaps-tdbtype default 'BMON'.
selection-screen: end   of block b01.
selection-screen: begin of block b02 with frame title text-b02.
parameters      : p_file like rlgrap-filename.
selection-screen: end   of block b02.
*-----------------------------------------------------------------------
*@INI                 I N I T I A L I Z A T I O N.
*-----------------------------------------------------------------------
initialization.
*

*-----------------------------------------------------------------------
*@SOS             S T A R T   O F   S E L E C T I O N
*-----------------------------------------------------------------------
start-of-selection.
*
  perform sapscript_get_graphic_bds.
  perform sapscript_convert_bitmap.
  perform ws_download.
*
*-----------------------------------------------------------------------
*@EOS                E N D   O F   S E L E C T I O N
*-----------------------------------------------------------------------
end-of-selection.
*

*-----------------------------------------------------------------------
*@TOP                   T O P   O F   P A G E
*-----------------------------------------------------------------------
top-of-page.
*

*-----------------------------------------------------------------------
*               A T   S E L E C T I O N   S C R E E N
*-----------------------------------------------------------------------
at selection-screen on value-request for p_nam.
*
  data: l_return type i.
  ranges: r_obj for stxbitmaps-tdobject.
  data: l_bitmaps type table of stxbitmaps with header line.
  data: lit_scrfields type table of dynpread with header line.
*
  r_obj-sign = 'I'.
  r_obj-option = 'EQ'.
  r_obj-low = 'ZOGLGRPOBJ'.
  append r_obj.
*
  call function 'SAPSCRIPT_SEARCH_GRAPHIC_BDS'
    exporting
      selection_screen         = 'X'
      select_entry             = 'X'
      selection_show           = 'X'
    importing
      e_object                 = p_obj
      e_id                     = p_id
      e_name                   = p_nam
      e_btype                  = p_ref
    tables
      t_objects                = r_obj
*    T_IDS                    = R_IDS
*    T_BTYPES                 = R_REFS
      t_selections             = l_bitmaps
    exceptions
      nothing_found            = 1
      selection_canceled       = 2
      internal_error           = 3
      others                   = 4
            .
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  else..
    lit_scrfields-fieldname = 'P_ID'.
    lit_scrfields-fieldvalue = p_id.
    append lit_scrfields.
    call function 'DYNP_VALUES_UPDATE'
      exporting
        dyname                     = 'Z_EXPORT_GRAPHIC_FROM_SE78'
        dynumb                     = '1000'
      tables
        dynpfields                 = lit_scrfields
*     EXCEPTIONS
*       INVALID_ABAPWORKAREA       = 1
*       INVALID_DYNPROFIELD        = 2
*       INVALID_DYNPRONAME         = 3
*       INVALID_DYNPRONUMMER       = 4
*       INVALID_REQUEST            = 5
*       NO_FIELDDESCRIPTION        = 6
*       UNDEFIND_ERROR             = 7
*       OTHERS                     = 8
              .
    if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.

  endif.

*
*-----------------------------------------------------------------------
*@FOR                          F O R M S
*-----------------------------------------------------------------------
*
*
*&---------------------------------------------------------------------*
*&      Form  SAPSCRIPT_GET_GRAPHIC_BDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form sapscript_get_graphic_bds.
*
  call function 'SAPSCRIPT_GET_GRAPHIC_BDS'
       exporting
            i_object       = p_obj
            i_name         = p_nam
            i_id           = p_id
            i_btype        = p_ref
       importing
            e_bytecount    = g_bytecount
       tables
            content        = git_content
       exceptions
            not_found      = 1
            bds_get_failed = 2
            bds_no_content = 3
            others         = 4.
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
*
endform.                    " SAPSCRIPT_GET_GRAPHIC_BDS

*&---------------------------------------------------------------------*
*&      Form  SAPSCRIPT_CONVERT_BITMAP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form sapscript_convert_bitmap.
*                                                assign
  call function 'SAPSCRIPT_CONVERT_BITMAP '
       exporting
            old_format               = 'BDS'
            new_format               = 'BMP'
            bitmap_file_bytecount_in = g_bytecount
            itf_bitmap_type_in       = '*'
       importing
            bitmap_file_bytecount    = g_bytecount
            itf_bitmap_type_out      = g_bitmaptypeout
       tables
            bitmap_file              = git_rawdata
            bds_bitmap_file          = git_content
       exceptions
            no_bitmap_file           = 1
            format_not_supported     = 2
            bitmap_file_not_type_x   = 3
            no_bmp_file              = 4
            bmperr_invalid_format    = 5
            bmperr_no_colortable     = 6
            bmperr_unsup_compression = 7
            bmperr_corrupt_rle_data  = 8
            bmperr_eof               = 9
            bdserr_invalid_format    = 10
            bdserr_eof               = 11
            others                   = 12.
  if sy-subrc <> 0.
*   MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
*
endform.                    " SAPSCRIPT_CONVERT_BITMAP

*&---------------------------------------------------------------------*
*&      Form  WS_DOWNLOAD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form ws_download.
*
  call function 'WS_DOWNLOAD'
       exporting
            bin_filesize            = g_bytecount
            filename                = p_file
            filetype                = 'BIN'
       tables
            data_tab                = git_rawdata
       exceptions
            file_open_error         = 1
            file_write_error        = 2
            invalid_filesize        = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            others                  = 10.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
*
endform.                    " WS_DOWNLOAD
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming -> Graphics All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.