There are no items in your cart
Add More
Add More
Item Details | Price |
---|
Enter the Input Parameters
DMS Document Number in Export Parameters
FUNCTION ZDMS_DOCUMENTS_CREATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IP_DOKAR) TYPE DOKAR OPTIONAL
*" VALUE(IP_FILE_NAME) TYPE STRING OPTIONAL
*" VALUE(IP_FILE_TYPE) TYPE CHAR20 OPTIONAL
*" VALUE(IP_DESCRIPTION) TYPE DKTXT OPTIONAL
*" VALUE(IP_XSTRING) TYPE XSTRING OPTIONAL
*" EXPORTING
*" VALUE(EP_MSG) TYPE STRING
*" VALUE(EP_DOKNR) TYPE DOKNR
*"----------------------------------------------------------------------
"This FM will return the DMS attachment output in binary format
**************************************************************************************
"Tables
DATA: LT_OBJECTLINKS TYPE TABLE OF BAPI_DOC_DRAD.
DATA: LT_OBJECTDESCR TYPE TABLE OF BAPI_DOC_DRAT.
DATA: LT_OBJECTFILES TYPE TABLE OF BAPI_DOC_FILES2.
DATA RETURN TYPE BAPIRET2.
"Structures
DATA: LS_DOCDATA TYPE BAPI_DOC_DRAW2.
DATA: LS_OBJECTLINK TYPE BAPI_DOC_DRAD.
DATA: LS_OBJECTDESCR TYPE BAPI_DOC_DRAT.
DATA: LS_OBJECTFILE TYPE BAPI_DOC_FILES2.
DATA : GS_TDWAT TYPE TDWAT,
ACCESS_INFO LIKE STANDARD TABLE OF SCMS_ACINF WITH HEADER LINE,
GT_BIN TYPE STANDARD TABLE OF RAW255,
GS_BIN TYPE RAW255.
"Variables
DATA: LV_FILENAME TYPE STRING,
DV_EXTENSION TYPE STRING,
DV_FILENAME TYPE STRING,
DV_FILENAME1 TYPE STRING,
DV_DOCTYPE TYPE DOKAR, "VALUE 'Z01',
DV_OBJTYPE TYPE DOKOB VALUE 'KNA1',
DV_DKTXT TYPE DKTXT,
GV_FLAG TYPE FLAG.
IF IP_DOKAR IS NOT INITIAL AND
IP_FILE_NAME IS NOT INITIAL AND
IP_FILE_TYPE IS NOT INITIAL AND
ip_description IS NOT INITIAL AND
IP_XSTRING IS NOT INITIAL.
"document type description
* SELECT SINGLE * FROM TDWAT INTO CORRESPONDING FIELDS OF GS_TDWAT WHERE DOKAR = IP_DOKAR.
*
* CONCATENATE 'Test' GS_TDWAT-DARTXT INTO DV_DKTXT SEPARATED BY '/'.
dv_dktxt = ip_description.
CONCATENATE '/tmp/' IP_FILE_NAME INTO LV_FILENAME.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = IP_XSTRING
IMPORTING
OUTPUT_LENGTH = ACCESS_INFO-COMP_SIZE "gv_filesize
TABLES
BINARY_TAB = GT_BIN.
OPEN DATASET LV_FILENAME FOR OUTPUT IN BINARY MODE.
LOOP AT GT_BIN INTO GS_BIN.