• ABAP 在屏幕上显示图片


    1.se78 上传 或 预览图片

      图片预览

    2.程序代码

    定义各变量

    DATA: H_PICTURE        TYPE REF TO CL_GUI_PICTURE,
          H_PIC_CONTAINER  TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    
    DATA: GRAPHIC_URL(255) TYPE C,
          GRAPHIC_REFRESH  TYPE CHAR1,
          G_RESULT         TYPE I.
    
    DATA: BEGIN OF GRAPHIC_TABLE OCCURS 0,
            LINE(255)  TYPE X,
          END OF GRAPHIC_TABLE.
    
    DATA: GRAPHIC_SIZE TYPE I.
    
    CONSTANTS: CNTL_TRUE  TYPE I VALUE 1,
               CNTL_FALSE TYPE I VALUE 0.

    pbo

     DATA: L_GRAPHIC_XSTR TYPE XSTRING,
           L_GRAPHIC_CONV TYPE I,
           L_GRAPHIC_OFFS TYPE I.
    
      CALL METHOD CL_SSF_XSF_UTILITIES=>GET_BDS_GRAPHIC_AS_BMP
        EXPORTING
          P_OBJECT  = 'GRAPHICS'
          P_NAME    = 'ENJOY' "图片名称(SE78中维护)
          P_ID      = 'BMAP'
          P_BTYPE   = BMON  "(BMON = black&white, BCOL = colour)
        RECEIVING
          P_BMP     = L_GRAPHIC_XSTR
        EXCEPTIONS
          NOT_FOUND = 1
          OTHERS    = 2.
    
    
      GRAPHIC_SIZE = XSTRLEN( L_GRAPHIC_XSTR ).
    
      CHECK GRAPHIC_SIZE > 0.
    
      L_GRAPHIC_CONV = GRAPHIC_SIZE.
      L_GRAPHIC_OFFS = 0.
    
    
      WHILE L_GRAPHIC_CONV > 255.
        GRAPHIC_TABLE-LINE = L_GRAPHIC_XSTR+L_GRAPHIC_OFFS(255).
        APPEND GRAPHIC_TABLE.
        L_GRAPHIC_OFFS = L_GRAPHIC_OFFS + 255.
        L_GRAPHIC_CONV = L_GRAPHIC_CONV - 255.
      ENDWHILE.
    
    
      GRAPHIC_TABLE-LINE = L_GRAPHIC_XSTR+L_GRAPHIC_OFFS(L_GRAPHIC_CONV).
      APPEND GRAPHIC_TABLE.
    
    
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          TYPE                 = 'image'               "#EC NOTEXT
          SUBTYPE              = CNDP_SAP_TAB_UNKNOWN " 'X-UNKNOWN'
          SIZE                 = GRAPHIC_SIZE
          LIFETIME             = CNDP_LIFETIME_TRANSACTION  "'T'
        TABLES
          DATA                 = GRAPHIC_TABLE
        CHANGING
          URL                  = GRAPHIC_URL
        EXCEPTIONS
          DP_INVALID_PARAMETER = 1
          DP_ERROR_PUT_TABLE   = 2
          DP_ERROR_GENERAL     = 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.
    
       "创建图片容器
       CREATE OBJECT H_PIC_CONTAINER
               EXPORTING CONTAINER_NAME =  'CC_PIC'.  "“定制控制”控件名称
      "创建图片实例
       CREATE OBJECT H_PICTURE
               EXPORTING PARENT = H_PIC_CONTAINER.
        "显示图片
       CALL METHOD H_PICTURE->LOAD_PICTURE_FROM_URL
         EXPORTING
           URL    = GRAPHIC_URL
         IMPORTING
           RESULT = G_RESULT.
     
     
     
    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    励志美文、《抉择》
      
    人的一生常处于抉择之中,如:念哪一间大学?选哪一种职业?娶哪一种女子?……等等伤脑筋的事情。一个人抉择力的有无,可以显示其人格成熟与否。
      
    倒是哪些胸无主见的人,不受抉择之苦。因为逢到需要决定的时候,他总是求询别人说:"嘿,你看怎么做?"
      
    大凡能够成大功业的人,都是抉择力甚强的人。他知道事之成败,全在乎已没有人可以代劳,更没有人能代你决定。
      
    在抉择的哪一刻,成败实已露出端倪。
  • 相关阅读:
    开源 .net license tool, EasyLicense !
    Logging with NLog
    Logging with Log4net (二)
    Logging with Debug And Trace (一)
    ThoughtWorks代码挑战——FizzBuzzWhizz
    开源插件 :MahApps.Metro.IconPacks
    Java地址:
    小程序源码下载[demo整理自github]
    多块图形合并(自动合并相交块)
    Textbox
  • 原文地址:https://www.cnblogs.com/mingdashu/p/6824983.html
Copyright © 2020-2023  润新知