Hi everyone,
I am trying to get BMP images from server and import them into BDS. But I had figured out that BDSCONT2 table was not filled correctly after I compared the scenario that I get the same image from local directory. In this scenario, table is filled correct and I can see the picture at MM03 image tab.
When I uploaded image from frontend, BDS_BUSINESSDOCUMENT_CREATEF function get the path and works fine.
Then I used BDS_BUSINESSDOCUMENT_CREA_TAB function or cl_bds_document_set=>CREATE_WITH_TABLE method to create BDS with internal table. But I can not see the image at MM03. I found that MM03 screen look at BDSCONT2 table to display the images. Table contains fewer rows than it should have.
I did cross check between upload image from local and from server in debug mode. The parameters that I sent to/got from below functions and classes has the same values.
By the way, I can successfully load the image from server to SE78 graphics.
Did I make a mistake when getting content of the image at the below code? Or what could be wrong in this flow?
Thanks in advance.
OPEN DATASET LV_FILENAME_ALL IN BINARY MODE FOR INPUT.
IF SY-SUBRC EQ 0.
CLEAR: XSTR. CLEAR XSTR_TEMP.
DO.
READ DATASET LV_FILENAME_ALL INTO XSTR.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
XSTR_TEMP = XSTR.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET LV_FILENAME_ALL.
CLEAR L_BITMAP.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = XSTR_TEMP
IMPORTING
OUTPUT_LENGTH = L_BYTECOUNT
TABLES
BINARY_TAB = L_BITMAP
.
CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP_BDS'
EXPORTING
COLOR = 'X'
FORMAT = 'BMP'
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.
WA_BDS_COMPONENTS-DOC_COUNT = '1'.
WA_BDS_COMPONENTS-COMP_COUNT = '1'.
WA_BDS_COMPONENTS-MIMETYPE = C_BDS_MIMETYPE.
WA_BDS_COMPONENTS-COMP_SIZE = L_BYTECOUNT.
WA_BDS_COMPONENTS-COMP_ID = WA_PFILE-FILENAME.
APPEND WA_BDS_COMPONENTS TO L_BDS_COMPONENTS.
CLEAR: WA_BDS_COMPONENTS.
IF P_DOCID IS INITIAL. " graphic is new
CLEAR WA_BDS_SIGNATURE.
WA_BDS_SIGNATURE-DOC_COUNT = '1'.
WA_BDS_SIGNATURE-PROP_NAME = 'BDS_DOCUMENTCLASS'.
WA_BDS_SIGNATURE-PROP_VALUE = 'BMP'.
APPEND WA_BDS_SIGNATURE TO L_BDS_SIGNATURE.
CLEAR WA_BDS_SIGNATURE.
WA_BDS_SIGNATURE-DOC_COUNT = '1'.
WA_BDS_SIGNATURE-PROP_NAME = 'BDS_CONTREP'.
WA_BDS_SIGNATURE-PROP_VALUE = ''.
APPEND WA_BDS_SIGNATURE TO L_BDS_SIGNATURE.
CLEAR WA_BDS_SIGNATURE.
WA_BDS_SIGNATURE-DOC_COUNT = '1'.
WA_BDS_SIGNATURE-PROP_NAME = 'BDS_DOCUMENTTYPE'.
WA_BDS_SIGNATURE-PROP_VALUE = 'BDS_IMAGE'.
APPEND WA_BDS_SIGNATURE TO L_BDS_SIGNATURE.
CLEAR WA_BDS_SIGNATURE.
WA_BDS_SIGNATURE-DOC_COUNT = '1'.
WA_BDS_SIGNATURE-PROP_NAME = 'DESCRIPTION'.
MOVE LV_NAME TO WA_BDS_SIGNATURE-PROP_VALUE .
APPEND WA_BDS_SIGNATURE TO L_BDS_SIGNATURE.
CLEAR WA_BDS_SIGNATURE.
WA_BDS_SIGNATURE-DOC_COUNT = '1'.
WA_BDS_SIGNATURE-PROP_NAME = 'LANGUAGE'.
WA_BDS_SIGNATURE-PROP_VALUE = SYST-LANGU.
APPEND WA_BDS_SIGNATURE TO L_BDS_SIGNATURE.
CALL METHOD L_BDS_OBJECT->CREATE_WITH_TABLE
EXPORTING
CLASSNAME = 'PICTURES'
CLASSTYPE = 'OT'
COMPONENTS = L_BDS_COMPONENTS
CONTENT = L_BDS_CONTENT
CHANGING
SIGNATURE = L_BDS_SIGNATURE
OBJECT_KEY = LV_OBJKEY
EXCEPTIONS
OTHERS = 1.