Professional Documents
Culture Documents
*& Include
ZWWWFILLFORM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&
Form FillExcelForm
*&---------------------------------------------------------------------*
FORM FillExcelForm
using it_Val type table
Doc
type OLE2_OBJECT.
Types:
tt_Sort_Val type standard table of ZWWW_VALUES.
Field-symbols:
<it_Values> type ZWWW_VALUES,
<it_SortVal> type tt_Sort_Val.
Data:
Cnt
type i,
RowsCount type i value 1,
VAR_Error type sy-subrc,
CharValue(2048),
FORM_NAME
TempDir
FileData
w_FileName
type
type
type
type
Data:
App
Range
Find
Offset
Cell
RangeTempl
QTables
QTable
type
type
type
type
type
type
type
type
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT.
*
*
At End of VAR_NAME.
If Cnt > 0.
Cnt = Cnt * RowsCount.
Call method of Range 'Copy'.
Call method of Offset 'Resize' = Offset
EXPORTING
#1 = Cnt.
Call method of Offset 'Insert'.
EndIf.
Continue.
EndAt.
At End of VAR_NUM.
If not <IT_VALUES>-VAR_NAME is initial.
Cnt = Cnt + 1.
EndIf.
EndAt.
EndLoop.
Var_Error = 0.
Loop at <it_SortVal> assigning <IT_VALUES>.
CharValue = <IT_VALUES>-VALUE.
*
*
If <IT_VALUES>-FIND_TEXT is initial.
Set property of Find 'Value' = CharValue.
"<IT_VALUES>-VALUE.
Case <IT_VALUES>-VAL_TYPE.
when space or 'S' or 'T' or 'R'.
Call method of Range 'Cells' = Cell
EXPORTING
#1 = 1
#2 = 1.
Set property of Cell 'Value' = CharValue.
Call method of Cell 'TextToColumns'
EXPORTING
#1 = Cell
#2 = 1. "xlDelimited
when 'V'.
*
*
*
w_FileName = FileData.
Call function 'GUI_DELETE_FILE'
EXPORTING
FILE_NAME = FileData
EXCEPTIONS
others
= 1.
EndIf.
EndIf.
At End of VAR_NUM.
If not <IT_VALUES>-VAR_NAME is initial.
Call method of Range 'Offset' = Range
EXPORTING
#1 = RowsCount.
*
Call method of Range 'Select'.
EndIf.
EndAt.
EndLoop.
Loop at <it_SortVal> assigning <IT_VALUES>
where VAL_TYPE = 'V' or VAL_TYPE = 'D' .
Case <IT_VALUES>-VAL_TYPE.
when 'V'.
Call method of App 'Range' = Range
EXPORTING
#1 = <IT_VALUES>-VALUE.
Call method of Range 'Delete'.
when 'D'.
Call method of App 'Range' = Range
EXPORTING
#1 = <IT_VALUES>-VAR_NAME.
Call method of Range 'Delete'.
EndCase.
EndLoop.
ENDFORM.
" FillExcelForm
*&---------------------------------------------------------------------*
*&
Form FillWordForm
*&---------------------------------------------------------------------*
FORM FillWordForm
using it_Val type table
Doc
type OLE2_OBJECT.
Types:
tt_Sort_Val type standard table of ZWWW_VALUES.
Field-symbols:
<it_Values> type ZWWW_VALUES,
<it_SortVal> type tt_Sort_Val.
Data:
VAR_Error type sy-subrc,
CharValue(2048).
Data:
RangeStart type i,
RangeEnd type i,
RangeSize type i.
Data:
NewStart type i,
NewEnd type i,
NewSize type i.
Data:
App
Item
Range
RangeTempl
CurrRange
Find
Bookmark
Duplicate
Cell
type
type
type
type
type
type
type
type
type
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT,
OLE2_OBJECT.
*
*
At new VAL_TYPE.
At new VAR_NUM.
If not <IT_VALUES>-VAR_NUM is initial.
Call method of Range 'Move'
EXPORTING
#1 = '10'
#2 = '1'.
Call method of Range 'Select'.
CALL FUNCTION 'FLUSH'.
If <IT_VALUES>-VAL_TYPE = 'V'.
Call method of Item 'Bookmarks' = RangeTempl
EXPORTING
#1 = <IT_VALUES>-VALUE.
If sy-subrc = 0.
Call method of RangeTempl 'Range' = RangeTempl.
Get property of RangeTempl 'Start' = NewStart.
Get property of RangeTempl 'End' = NewEnd.
Call method of RangeTempl 'Copy'.
Call method of Range 'Paste'.
*
*
*
If sy-subrc <> 0.
Call method of App 'Run'
EXPORTING
#1 = <IT_VALUES>-VALUE.
EndIf.
*
*
*
*
*
*
*
*
*
*
Case <IT_VALUES>-VAL_TYPE.
when 'V'.
Call method of Item 'Bookmarks' = Bookmark
EXPORTING
#1 = <IT_VALUES>-VALUE.
Call method of Bookmark 'Range' = Range.
Call method of Range 'Delete'.
CALL FUNCTION 'FLUSH'.
Call method of Bookmark 'Range' = Range.
Call method of Range 'Cells' = Cell.
Call method of Cell 'Delete'.
CALL FUNCTION 'FLUSH'.
when 'D'.
Call method of Item 'Bookmarks' = Bookmark
EXPORTING
#1 = <IT_VALUES>-VAR_NAME.
Call method of Bookmark 'Range' = Range.
Call method of Range 'Delete'.
CALL FUNCTION 'FLUSH'.
Call method of Bookmark 'Range' = Range.
Call method of Range 'Cells' = Cell.
Call method of Cell 'Delete'.
CALL FUNCTION 'FLUSH'.
EndCase.
EndLoop.
CALL FUNCTION 'FLUSH'.
ENDFORM.
" FillWordForm
Form FUNCTION_ZBDS_OPENFORM2.
*"-------------------------------------------------------------------*"*" :
*" IMPORTING
*"
REFERENCE(DESCRIPTION) TYPE C
*"
REFERENCE(DOC_CLASSNAME) TYPE SBDST_CLASSNAME
*"
REFERENCE(DOC_CLASSTYPE) TYPE SBDST_CLASSTYPE
*"
REFERENCE(DOC_OBJECT) TYPE SBDST_OBJECT_KEY
*"
VALUE(OPTIMIZE) TYPE N DEFAULT 300
*"
VALUE(DECIMAL_SEPARATOR) TYPE C DEFAULT '.'
*"
VALUE(PRINTDIALOG) TYPE C DEFAULT 'X'
*"
VALUE(PROTECT) TYPE C DEFAULT 'X'
*"
VALUE(DEBUG_MODE) TYPE C DEFAULT ''
*" TABLES
*"
IT_VALUES OPTIONAL
*"-------------------------------------------------------------------Data:
bds_instance type ref to cl_bds_document_set,
*
doc_classname type sbdst_classname,
*
doc_classtype type sbdst_classtype,
*
doc_object
type sbdst_object_key,
control
TYPE REF TO i_oi_container_control,
AppStr(80),
document
TYPE REF TO i_oi_document_proxy,
r_doc_signature type line of sbdst_signature,
t_doc_signature type sbdst_signature with header line,
t_doc_component TYPE sbdst_components,
t_doc_uri
TYPE sbdst_uri,
r_doc_uri
TYPE LINE OF sbdst_uri,
item_url(256)
TYPE c,
Hnd type CNTL_HANDLE,
Doc type OLE2_OBJECT,
App type OLE2_OBJECT,
Item type OLE2_OBJECT,
Dialogs
type OLE2_OBJECT,
ItemDlg
type OLE2_OBJECT,
Res(250),
ScreenUpdating type i,
FileType(30),
Ext(255),
Begin of AppParam,
DecimalSeparator,
ThousandsSeparator,
UseSystemSeparators(10),
End of AppParam.
Perform AssignCharX.
CHECK control IS INITIAL.
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = control.
*
*
*
*
*
IMPORTING
document_proxy
= document.
*
*
*
*
If Res = -1.
return_code = 0.
EndIf.
CALL FUNCTION 'FLUSH'.
EndIf.
EndCase.
Endform. "ENDFUNCTION.