File Controlling - PowerPoint PPT Presentation

About This Presentation
Title:

File Controlling

Description:

... (50), f28(50), f29(50), f30(50), f31(50), f32(50), f33(50), f34(50), f35(50), f36(50), f37(50), f38(50), f39(50), f40(50), end of down. data : fld1(40), ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 10
Provided by: tis104
Category:
Tags: controlling | file

less

Transcript and Presenter's Notes

Title: File Controlling


1
File Controlling
2
File Controlling
1. Upgrade? ?? File Controlling Issue -
SAP??? ?? WS_? ???? ??? Function Module?? ????
?? CL_GUI_FRONTEND_SERVICES Class? Method? ??? ??
???. Function Group ? Class, Function
Module ? Method? ABAP ????? ???? ??? ???? ???.
- Function Group GRAP? ??? ??? Function
Module? ????? ??. CLPB_IMPORT Send Text
Table to Presentation Server Clipboard
CLPB_EXPORT Load Text Table from Presentation
Server Clipboard DOWNLOAD Save Internal
Table as Presentation Server File with File
Length UPLOAD Transfer Presentation
Server File to Internal Table with Length
WS_DOWNLOAD File Transfer from Internal Table
to Presentation Server File WS_UPLOAD
Transfer Presentation Server File to Internal
Table WS_FILENAME_GET Call File Selector
WS_EXCEL Excel File ?? Function
Module? ?? ??? Function?? SFES Function Group??
?? ? ??. (WS_ ? GUI_ ? ??) SFES Function
Group? ??? CL_GUI_FRONTEND_SERVICES Class?
Method?? ???. GUI_FILE_SAVE_DIALOG Get
Download File Name GUI_DOWNLOAD
Download GUI_UPLOAD Upload
CL_GUI_FRONTEND_SERVICEgtCLIPBOARD_EXPORT
Exports data to clipboard
CL_GUI_FRONTEND_SERVICEgtCLIPBOARD_IMPORT
Imports data from clipboard
CL_GUI_FRONTEND_SERVICEgtEXECUTE Starts an
Application or Opens a Document in the Client
CL_GUI_FRONTEND_SERVICEgtFILE_OPEN_DIALOG
Displays a File Open Dialog
CL_GUI_FRONTEND_SERVICEgtFILE_SAVE_DIALOG Shows
a File Save Dialog CL_GUI_FRONTEND_SERVICEgt
GUI_DOWNLOAD Download Data to Client PC
CL_GUI_FRONTEND_SERVICEgtGUI_UPLOAD Upload
Data from Client PC ? ?? Notes - 594356
WS_DOWNLOAD, WS_UPLOAD Function Module?
GUI_DOWNLOAD, GUI_UPLOAD? ??? ?. - 595310,
833576 WS_FILENAME_GET Function Module?
CL_GUI_FRONTEND_SERVICESgtFILE_OPEN_DIALOG,
CL_GUI_FRONTEND_SERVICESgtFILE_SAVE_DIALOG? ???
?.
3
File Controlling
2. Get File Name - CL_GUI_FRONTEND_SER
VICES Class? ?? Method? ???? ???? ????.
DATA L_FILE_TABLE TYPE FILETABLE, L_RC
TYPE I , L_USER_ACTIO TYPE I
, FILE_NAME TYPE STRING .
CALL METHOD CL_GUI_FRONTEND_SERVICESgtFILE_OPEN_
DIALOG EXPORTING WINDOW_TITLE
'File Open' DEFAULT_FILENAME
SPACE FILE_FILTER '.xls'
INITIAL_DIRECTORY 'C\'
MULTISELECTION SPACE CHANGING
FILE_TABLE L_FILE_TABLE RC
L_RC EXCEPTIONS
FILE_OPEN_DIALOG_FAILED 1 CNTL_ERROR
2 ERROR_NO_GUI 3
OTHERS 5. READ TABLE
L_FILE_TABLE INTO FILE_NAME INDEX 1.
DATA LF_SEL_FILE TYPE STRING,
LF_SEL_PATH TYPE STRING, LF_FULL_PATH
TYPE STRING, LF_USER_ACTION TYPE I ,
FILE_NAME TYPE STRING. CALL METHOD
CL_GUI_FRONTEND_SERVICESgtFILE_SAVE_DIALOG
EXPORTING WINDOW_TITLE 'Save
File' DEFAULT_FILE_NAME SPACE
FILE_FILTER '.xls'
INITIAL_DIRECTORY 'C\' CHANGING
FILENAME LF_SEL_FILE PATH
LF_SEL_PATH FULLPATH
LF_FULL_PATH USER_ACTION
LF_USER_ACTION EXCEPTIONS CNTL_ERROR
1 ERROR_NO_GUI 2 OTHERS
4. CONCATENATE LF_SEL_PATH
LF_SEL_FILE INTO FILE_NAME.
? CALL FUNCTION 'WS_FILENAME_GET' ? 4.6C
(SAP_BASIS 41), 4.70 ???? ?? ?? ? CALL FUNCTION
GUI_FILE_SAVE_DIALOG? ??
4
File Controlling
3. ASCII File Read -
CL_GUI_FRONTEND_SERVICESgtGUI_UPLOAD Method? ????
ASCII File?? Data? ?? Internal Table? ????.
CALL METHOD CL_GUI_FRONTEND_SERVICESgtGUI_UPLOAD
EXPORTING FILENAME
FILE_NAME FILETYPE 'ASC'
HAS_FIELD_SEPARATOR C_TAB CHANGING
DATA_TAB ITAB1 EXCEPTIONS
FILE_OPEN_ERROR 1 "File does not
exist, cannot open FILE_READ_ERROR
2 "File read error NO_BATCH
3 "Front-end function cannot be executed
GUI_REFUSE_FILETRANSFER 4 "Incorrect front
end, or error INVALID_TYPE 5
"Incorrect parameter FILETYPE NO_AUTHORITY
6 "No upload authorization
UNKNOWN_ERROR 7 "Unknown error
BAD_DATA_FORMAT 8 "Could not interpret
data in file HEADER_NOT_ALLOWED 9
"Invalid header SEPARATOR_NOT_ALLOWED 10
"Invalid separator HEADER_TOO_LONG
11 "Header information is maximum 1023
UNKNOWN_DP_ERROR 12 "Error when calling
data provider ACCESS_DENIED 13
"No access to file DP_OUT_OF_MEMORY
14 "Not enough memory in data provider
DISK_FULL 15 "Disk full
DP_TIMEOUT 16."Data provider
timeout
? CALL FUNCTION WS_UPLOAD ? ?? ?? ? CALL
FUNCTION 'GUI_UPLOAD' ? ?? ??
5
File Controlling
4. ASCII File Save -
CL_GUI_FRONTEND_SERVICESgtGUI_DOWNLOAD Method?
???? Internal Table Data? ASCII File? ????.
CALL METHOD CL_GUI_FRONTEND_SERVICESgtGUI_DOWNLOAD
EXPORTING FILENAME
FILE_NAME FILETYPE 'ASC'
APPEND SPACE
WRITE_FIELD_SEPARATOR C_TAB CHANGING
DATA_TAB ITAB1 EXCEPTIONS
FILE_WRITE_ERROR 01 "Cannot write to
file NO_BATCH 02 "Front-end
function cannot be executed
GUI_REFUSE_FILETRANSFER 03 "Incorrect
front-end INVALID_TYPE 04
"Invalid value for parameter FILETYPE
NO_AUTHORITY 05 "No download
authorization UNKNOWN_ERROR 06
"Unknown error HEADER_NOT_ALLOWED 07
"Invalid header SEPARATOR_NOT_ALLOWED 08
"Invalid separator FILESIZE_NOT_ALLOWED
09 "File size invalid HEADER_TOO_LONG
10 "Header information is maximum 1023
DP_ERROR_CREATE 11 "Cannot create Data
Provider DP_ERROR_SEND 12 "Error
when sending data with DP DP_ERROR_WRITE
13 "Error when writing data with DP
UNKNOWN_DP_ERROR 14 "Error when calling
data provider ACCESS_DENIED 15
"No access to file DP_OUT_OF_MEMORY
16 "Not enough memory in data provider
DISK_FULL 17 "Disk full
DP_TIMEOUT 18 "Data provider
timeout FILE_NOT_FOUND 19 "Could
not find file DATAPROVIDER_EXCEPTION 20
"General exception error CONTROL_FLUSH_ERROR
21."Error in control framework
? CALL FUNCTION WS_DOWNLOAD ? ?? ?? ? CALL
FUNCTION 'GUI_DOWNLOAD' ? ?? ??
6
File Controlling
5. Excel File Read -
ALSM_EXCEL_TO_INTERNAL_TABLE Function? ???? Excel
File? Data? ????.
DATA FILENAME LIKE RLGRAP-FILENAME VALUE
'C\sample_data.xls'. DATA XLS_DATA1 TYPE
STANDARD TABLE OF ALSMEX_TABLINE
WITH HEADER LINE. CALL FUNCTION
'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING
FILENAME FILENAME
I_BEGIN_COL 1 I_BEGIN_ROW
2 I_END_COL
20 I_END_ROW
10000 TABLES INTERN
XLS_DATA1 EXCEPTIONS INCONSISTENT_PARAMETE
RS 1 UPLOAD_OLE
2 OTHERS 3. LOOP AT
XLS_DATA1. CASE XLS_DATA1-COL. WHEN '001'.
ITAB1-MATNR XLS_DATA1-VALUE. WHEN
'002'. ITAB1-MAKTX XLS_DATA1-VALUE.
ENDCASE. AT END OF ROW. CHECK ITAB1-MATNR
NE SPACE. APPEND ITAB1. ENDAT. ENDLOOP.

ALSMEX_TABLINE Structure ALSMEX_TABLINE Structure
ROW Flexible Excel Upload Row number
COL Column
VALUE Comment String Value
7
File Controlling
6. Excel File Save -
MS_EXCEL_OLE_STANDARD_DAT Function? ???? Excel
File? Data? ????.
DATA BEGIN OF H_CAT OCCURS 0, IDX(02)
TYPE N , "Index FIELD(30) TYPE C ,
"Field Name TITLE(20) TYPE C , "Title
END OF H_CAT. DATA BEGIN OF DOWN OCCURS
0, F1(50) , F2(50) , F3(50) , F4(50) ,
F5(50) , F6(50) , F7(50) , F8(50) ,
F9(50) , F10(50), F11(50), F12(50),
F13(50), F14(50), F15(50), F16(50),
F17(50), F18(50), F19(50), F20(50),
F21(50), F22(50), F23(50), F24(50), F25(50),
F26(50), F27(50), F28(50), F29(50), F30(50),
F31(50), F32(50), F33(50), F34(50),
F35(50), F36(50), F37(50), F38(50),
F39(50), F40(50), END OF DOWN. DATA
FLD1(40), FLD2(40), CNT(2),
TABIX TYPE I. FIELD-SYMBOLS ltFgt,
ltVgt. PERFORM ADD_FIELDCAT USING '01'
'MATNR' Material , '02' 'MAKTX'
Description, '03' 'MEINS' Unit
, '04' 'WAERS' Currency ,
'05' 'NETPR' Price .
LOOP AT ITAB1. TABIX SY-TABIX. LOOP AT
H_CAT. CNT SY-TABIX. FLD1
H_CAT-FIELD. CONCATENATE 'DOWN-F' CNT INTO
FLD2. ASSIGN (FLD2) TO ltVgt. ASSIGN
COMPONENT FLD1 OF STRUCTURE ITAB1 TO ltFgt. ltVgt
ltFgt. ENDLOOP. APPEND DOWN. CLEAR
DOWN. ENDLOOP. CALL FUNCTION 'MS_EXCEL_OLE_STANDA
RD_DAT' EXPORTING FILE_NAME FILENAME
TABLES DATA_TAB DOWN_TABLE FIELDNAMES
FIELDNAME. -----------------------------------
-------------- FORM ADD_FIELDCAT USING P_IDX
P_FIELD P_TITLE. MOVE P_IDX TO H_CAT-IDX
, P_FIELD TO H_CAT-FIELD,
P_TITLE TO H_CAT-TITLE. APPEND H_CAT. ENDFORM.
8
File Controlling
7. Excel File Save - XXL_FULL_API
Function? ???? Excel Data? Pivot Table? ????.
DATA BEGIN OF IT_DATA OCCURS 0, MATNR
LIKE MARA-MATNR, ???? MAKTX LIKE
MAKT-MAKTX, SVC ?? LGPBE LIKE
MARD-LGPBE, ?? Bin FRLAB(20) TYPE C,
????? LGORT(20) TYPE C,
?????? GIREM(20) TYPE C,
?????? END OF IT_DATA. DATA XMPLT_O
TYPE TABLE OF GXXLT_O WITH HEADER LINE,
XMPLT_P TYPE TABLE OF GXXLT_P WITH HEADER LINE,
XMPLT_H TYPE TABLE OF GXXLT_H WITH HEADER
LINE, XMPLT_V TYPE TABLE OF GXXLT_V WITH
HEADER LINE, XMPLT_S TYPE TABLE OF GXXLT_S
WITH HEADER LINE. XMPLT_V-COL_NO 1
. XMPLT_V-COL_NAME '????' . APPEND XMPLT_V
. XMPLT_V-COL_NO 2 . XMPLT_V-COL_NAME
'SVC??' . APPEND XMPLT_V . XMPLT_V-COL_NO 3
. XMPLT_V-COL_NAME '??BIN' . APPEND XMPLT_V
. XMPLT_V-COL_NO 4 . XMPLT_V-COL_NAME
'?????' . APPEND XMPLT_V .
XMPLT_V-COL_NO 5 . XMPLT_V-COL_NAME '??????'
. APPEND XMPLT_V . XMPLT_H-COL_NO 1
. XMPLT_H-ROW_NO 1 . XMPLT_H-COL_NAME
'??????' . APPEND XMPLT_H . XMPLT_S-COL_NO 1
. XMPLT_S-COL_TYP 'STR' . XMPLT_S-COL_OPS
'DFT' . XMPLT_S-COL_SRC 0 . XMPLT_S-COL_CUR 0
. APPEND XMPLT_S . XMPLT_S-COL_NO 2
. XMPLT_S-COL_TYP 'STR' . XMPLT_S-COL_OPS
'DFT' . XMPLT_S-COL_SRC 0 . XMPLT_S-COL_CUR 0
. APPEND XMPLT_S . XMPLT_S-COL_NO 3
. XMPLT_S-COL_TYP 'STR' . XMPLT_S-COL_OPS
'DFT' . XMPLT_S-COL_SRC 0 . XMPLT_S-COL_CUR 0
. APPEND XMPLT_S .
9
File Controlling
CALL FUNCTION 'XXL_FULL_API' EXPORTING
N_VRT_KEYS 5 N_ATT_COLS 1
N_HRZ_KEYS 1 SEMA_TYPE
'X' FILENAME 'TEST' HEADER_1
'DATA' HEADER_2 'PIVOT'
NO_DIALOG ' ' TABLES VKEY
XMPLT_V HKEY XMPLT_H
DATA IT_DATA SEMA
XMPLT_S ONLINE_TEXT XMPLT_O
PRINT_TEXT XMPLT_P EXCEPTIONS
CANCELLED_BY_USER 01 DATA_TOO_BIG
02 DIM_MISMATCH_DATA 03
DIM_MISMATCH_SEMA 04 DIM_MISMATCH_VKEY
05 ERROR_IN_HKEY 06 ERROR_IN_SEMA
07 FILE_OPEN_ERROR 08
FILE_WRITE_ERROR 09 OTHERS
10.
XMPLT_S-COL_NO 4 . XMPLT_S-COL_TYP 'STR'
. XMPLT_S-COL_OPS 'DFT' . XMPLT_S-COL_SRC 0
. XMPLT_S-COL_CUR 0 . APPEND XMPLT_S
. XMPLT_S-COL_NO 5 . XMPLT_S-COL_TYP 'STR'
. XMPLT_S-COL_OPS 'DFT' . XMPLT_S-COL_SRC 0
. XMPLT_S-COL_CUR 0 . APPEND XMPLT_S
. XMPLT_S-COL_NO 6 . XMPLT_S-COL_TYP 'NUM'
. XMPLT_S-COL_OPS 'ADD' . XMPLT_S-COL_SRC 0
. XMPLT_S-COL_CUR 0 . APPEND XMPLT_S .
? COL_TYP - STR String - DAT Date
- MON Month - PCT Percent - NUM
Numeric ? COL_OPS - DFT Default -
ADD Additional
? N_VRT_KEYS N_ATT_COLS? Internal Table? Field
?? ???? ??.
Write a Comment
User Comments (0)
About PowerShow.com