Skip to end of metadata
Go to start of metadata

 

 

 

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
*&---------------------------------------------------------------------*
*& Report  ZTEST2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT  ZTEST2.
TYPE-POOLS: SBDST.
TABLES: STXBITMAPS.
CONSTANTS:
  C_BDS_CLASSNAME TYPE SBDST_CLASSNAME VALUE 'DEVC_STXD_BITMAP',
  C_BDS_CLASSTYPE TYPE SBDST_CLASSTYPE VALUE 'OT',          " others
  C_BDS_MIMETYPE  TYPE BDS_MIMETP      VALUE 'application/octet-stream',
  C_BDS_ORIGINAL  TYPE SBDST_DOC_VAR_TG VALUE 'OR'.
* Globals and globals for dynpro fields
DATA: G_OBJECTTYPE(20)   TYPE C,
      G_NEW_RESOLUTION   LIKE STXBITMAPS-RESOLUTION,
      G_STXBITMAPS       TYPE STXBITMAPS,
      G_STXH             TYPE STXH,
      G_TECHINFO         TYPE RSSCG,
      T_SIZE(40),
      BDS_DESCRIPTION  LIKE BAPISIGNAT-PROP_VALUE.
CONSTANTS:
      C_OBJECTTYPE_BDS      LIKE G_OBJECTTYPE VALUE 'BDS',
      C_OBJECTTYPE_STDTEXT  LIKE G_OBJECTTYPE VALUE 'OBTEXT',
      C_OBJECTTYPE_GRTEXT   LIKE G_OBJECTTYPE VALUE 'OBGRAPHICS'.
DATA: P_FILENAME       TYPE RLGRAP-FILENAME,
               P_OBJECT         TYPE STXBITMAPS-TDOBJECT,
               P_ID             TYPE STXBITMAPS-TDID,
               P_BTYPE          TYPE STXBITMAPS-TDBTYPE,
               P_FORMAT         TYPE C,
               P_TITLE          LIKE BDS_DESCRIPTION,
               P_RESIDENT       TYPE STXBITMAPS-RESIDENT,
               P_AUTOHEIGHT     TYPE STXBITMAPS-AUTOHEIGHT,
               P_BMCOMP         TYPE STXBITMAPS-BMCOMP.
DATA  L_FILE TYPE STRING..
DATA: L_FILENAME        TYPE STRING,
      L_BYTECOUNT       TYPE I,
      L_BDS_BYTECOUNT   TYPE I.
DATA: L_COLOR(1)        TYPE C,
      L_WIDTH_TW        TYPE STXBITMAPS-WIDTHTW,
      L_HEIGHT_TW       TYPE STXBITMAPS-HEIGHTTW,
      L_WIDTH_PIX       TYPE STXBITMAPS-WIDTHPIX,
      L_HEIGHT_PIX      TYPE STXBITMAPS-HEIGHTPIX.
DATA: L_BDS_OBJECT      TYPE REF TO CL_BDS_DOCUMENT_SET,
      L_BDS_CONTENT     TYPE SBDST_CONTENT,
      L_BDS_COMPONENTS  TYPE SBDST_COMPONENTS,
      WA_BDS_COMPONENTS TYPE LINE OF SBDST_COMPONENTS,
      L_BDS_SIGNATURE   TYPE SBDST_SIGNATURE,
      WA_BDS_SIGNATURE  TYPE LINE OF SBDST_SIGNATURE,
      L_BDS_PROPERTIES  TYPE SBDST_PROPERTIES,
      WA_BDS_PROPERTIES TYPE LINE OF SBDST_PROPERTIES.
DATA  WA_STXBITMAPS TYPE STXBITMAPS.
PARAMETERS: P_FILE TYPE  RLGRAP-FILENAME OBLIGATORY.
PARAMETERS: P_MATNR LIKE MARA-MATNR OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      FIELD_NAME = 'P_FILE'
    IMPORTING
      FILE_NAME  = P_FILE.
START-OF-SELECTION.
  DATA: P_NAMEX    TYPE STXBITMAPS-TDNAME.
  MOVE P_MATNR TO P_NAMEX.
  DATA: FILELENGTH  TYPE  I.
  DATA: BEGIN OF L_BITMAP OCCURS 0,
          L(64) TYPE X,
        END OF L_BITMAP.
  L_FILE = P_FILE.
*SELECT SINGLE * FROM STXBITMAPS WHERE TDNAME = P_NAMEX.
*  IF SY-SUBRC NE 0.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                = L_FILE
      FILETYPE                = 'BIN'
    IMPORTING
      FILELENGTH              = L_BYTECOUNT
    TABLES
      DATA_TAB                = L_BITMAP
    EXCEPTIONS
      FILE_OPEN_ERROR         = 2
      FILE_READ_ERROR         = 3
      NO_BATCH                = 1
      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.
*    call method l_bds_object->get_info
*         exporting
*              classname  = c_bds_classname
*              classtype  = c_bds_classtype
*              object_key = l_object_key
*         changing
*              signature  = l_bds_signature
*         exceptions
*              nothing_found  = 1
*              others         = 2.
  BREAK-POINT.
  DATA: P_DOCID          TYPE STXBITMAPS-DOCID.
  DATA: P_RESOLUTION  LIKE  STXBITMAPS-RESOLUTION.
  DATA: L_OBJECT_KEY TYPE SBDST_OBJECT_KEY.
  CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP_BDS'
    EXPORTING
      COLOR                    = 'X'
      FORMAT                   = 'BMP'
      RESIDENT                 = P_RESIDENT
      BITMAP_BYTECOUNT         = L_BYTECOUNT
      COMPRESS_BITMAP          = 'X'
    IMPORTING
      WIDTH_TW                 = L_WIDTH_TW
      HEIGHT_TW                = L_HEIGHT_TW
      WIDTH_PIX                = L_WIDTH_PIX
      HEIGHT_PIX               = L_HEIGHT_PIX
      DPI                      = P_RESOLUTION
      BDS_BYTECOUNT            = L_BDS_BYTECOUNT
    TABLES
      BITMAP_FILE              = L_BITMAP
      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
      OTHERS                   = 7.
  IF SY-SUBRC <> 0.
*???
  ENDIF.
  CREATE OBJECT L_BDS_OBJECT.
  WA_BDS_COMPONENTS-DOC_COUNT  = '1'.
  WA_BDS_COMPONENTS-COMP_COUNT = '1'.
  WA_BDS_COMPONENTS-MIMETYPE   = C_BDS_MIMETYPE."application/octet-stream
  WA_BDS_COMPONENTS-COMP_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.
  L_OBJECT_KEY = P_NAMEX.
  CALL METHOD L_BDS_OBJECT->CREATE_WITH_TABLE
    EXPORTING
      CLASSNAME  = C_BDS_CLASSNAME "DEVC_STXD_BITMAP
      CLASSTYPE  = C_BDS_CLASSTYPE "OT
      COMPONENTS = L_BDS_COMPONENTS
      CONTENT    = L_BDS_CONTENT
    CHANGING
      SIGNATURE  = L_BDS_SIGNATURE
      OBJECT_KEY = L_OBJECT_KEY
    EXCEPTIONS
      OTHERS     = 1.
  IF SY-SUBRC = 0.
    READ TABLE L_BDS_SIGNATURE INDEX 1 INTO WA_BDS_SIGNATURE
    TRANSPORTING DOC_ID.
    IF SY-SUBRC = 0.
      P_DOCID = WA_BDS_SIGNATURE-DOC_ID.
      WA_STXBITMAPS-TDNAME     = P_NAMEX.
      WA_STXBITMAPS-TDOBJECT   = 'GRAPHICS'.
      WA_STXBITMAPS-TDID       = 'BMAP'.
      WA_STXBITMAPS-TDBTYPE    = 'BCOL'.
      WA_STXBITMAPS-DOCID      = P_DOCID.
      WA_STXBITMAPS-WIDTHPIX   = L_WIDTH_PIX.
      WA_STXBITMAPS-HEIGHTPIX  = L_HEIGHT_PIX.
      WA_STXBITMAPS-WIDTHTW    = L_WIDTH_TW.
      WA_STXBITMAPS-HEIGHTTW   = L_HEIGHT_TW.
      WA_STXBITMAPS-RESOLUTION = P_RESOLUTION.
      WA_STXBITMAPS-RESIDENT   = P_RESIDENT.
      WA_STXBITMAPS-AUTOHEIGHT = P_AUTOHEIGHT.
      WA_STXBITMAPS-BMCOMP     = P_BMCOMP.
      INSERT INTO STXBITMAPS VALUES WA_STXBITMAPS.
    ENDIF.
  ENDIF.
*--OAER
  DATA: SIGN    TYPE TABLE OF BAPISIGNAT WITH HEADER LINE,
      COMP    TYPE TABLE OF BAPICOMPON WITH HEADER LINE,
      CONTENT TYPE TABLE OF BAPICONTEN WITH HEADER LINE,
      CONTHEX TYPE TABLE OF SOLIX WITH HEADER LINE,
      DOCID TYPE SOFOLENTI1-DOC_ID,
      OBJKEY TYPE BAPIBDS01-OBJKEY,
      DOC_DATA TYPE  SOFOLENTI1.
*
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME = L_FILE
      FILETYPE = 'BIN'
    TABLES
      DATA_TAB = CONTENT.
  BREAK FTELLI.
  OBJKEY = P_NAMEX.
  SIGN-DOC_COUNT = '00000001'.
  SIGN-PROP_NAME = 'BDS_DOCUMENTCLASS'.
  SIGN-PROP_VALUE = DOC_DATA-OBJ_TYPE.
  APPEND SIGN.
  SIGN-DOC_COUNT = '00000001'.
  SIGN-PROP_NAME = 'BDS_CONTREP'.
  SIGN-PROP_VALUE = ''.
  APPEND SIGN.
  SIGN-DOC_COUNT = '00000001'.
  SIGN-PROP_NAME = 'BDS_DOCUMENTTYPE'.
  SIGN-PROP_VALUE = 'BDS_IMAGE'.
  APPEND SIGN.
  SIGN-DOC_COUNT = '00000001'.
  SIGN-PROP_NAME = 'DESCRIPTION'.
  SIGN-PROP_VALUE = DOC_DATA-OBJ_DESCR.
  APPEND SIGN.
  SIGN-DOC_COUNT = '00000001'.
  SIGN-PROP_NAME = 'LANGUAGE'.
  SIGN-PROP_VALUE = SYST-LANGU.
  APPEND SIGN.
  COMP-DOC_COUNT = 1.
  COMP-COMP_COUNT = 1.
*    comp-comp_id = doc_data-obj_descr.
  COMP-MIMETYPE = 'image/jpeg'.
  COMP-COMP_SIZE = DOC_DATA-DOC_SIZE.
  APPEND COMP.
  CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CREA_TAB'
    EXPORTING
      CLASSNAME       = 'PICTURES'
      CLASSTYPE       = 'OT'
      OBJECT_KEY      = OBJKEY "p_matnr
    TABLES
      SIGNATURE       = SIGN
      COMPONENTS      = COMP
      CONTENT         = CONTENT
    EXCEPTIONS
      NOTHING_FOUND   = 1
      PARAMETER_ERROR = 2
      NOT_ALLOWED     = 3
      ERROR_KPRO      = 4
      INTERNAL_ERROR  = 5
      NOT_AUTHORIZED  = 6
      OTHERS          = 7.
  COMMIT WORK AND WAIT.
  REFRESH: CONTENT, CONTHEX, SIGN, COMP.

 

 

 

  • No labels