- 浏览: 174334 次
- 性别:
- 来自: 成都
文章分类
Class Methods used in the sample Code
CL_RSAN_UT_FILES F4 F4 Help for Choosing File Name from GUI or App. Server
CL_RSAN_UT_APPSERV_FILE_WRITER: APPSERVER_FILE_WRITE Write Data to Specified File on Application Server
CL_RSAN_UT_APPSERV_FILE_READER: APPSERVER_FILE_READ Read Specified File from Application Server
Sample Code
One Form routine in sample code narrates how the list materials selected from MAKT table can be written to application server file. Another form-routine narrates how to read the contents of file using the methods listed in above table.
CL_RSAN_UT_FILES F4 F4 Help for Choosing File Name from GUI or App. Server
CL_RSAN_UT_APPSERV_FILE_WRITER: APPSERVER_FILE_WRITE Write Data to Specified File on Application Server
CL_RSAN_UT_APPSERV_FILE_READER: APPSERVER_FILE_READ Read Specified File from Application Server
Sample Code
One Form routine in sample code narrates how the list materials selected from MAKT table can be written to application server file. Another form-routine narrates how to read the contents of file using the methods listed in above table.
*&-------------------------------------------------------------------- *& Report ZVK_CL_RSAN_UT_APPSERV *& *&-------------------------------------------------------------------- *& Purpose : Use of Class CL_RSAN_UT_APPSERV_FILE_READER & *& CL_RSAN_UT_APPSERV_FILE_WRITER for Read/write operations *& on Application Server Files *&-------------------------------------------------------------------- REPORT zvk_cl_rsan_ut_appserv. ** Text Elements * p_matnr - Material from - to * p_filenm - File Name TYPE-POOLS : rsanm, abap. TABLES : mara. TYPES : BEGIN OF ty_makt, matnr TYPE matnr, maktx TYPE maktx, END OF ty_makt. DATA : lt_makt TYPE STANDARD TABLE OF ty_makt, ls_makt TYPE ty_makt, lt_file_table TYPE rsanm_file_table, ls_file_table TYPE rsanm_file_line. DATA : lv_applserv TYPE char01, lv_title TYPE string, lv_gui_extension TYPE string, lv_gui_ext_filter TYPE string, lv_canceled TYPE as4flag, lv_applserv_logical TYPE as4flag, lv_applserv_al11 TYPE as4flag, lv_file_name TYPE string, lv_lines_written TYPE i. SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME. SELECT-OPTIONS : p_matnr FOR mara-matnr OBLIGATORY. SELECTION-SCREEN END OF BLOCK b1. SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME. PARAMETERS : p_filenm LIKE ibipparms-path OBLIGATORY. SELECTION-SCREEN END OF BLOCK b2. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filenm. CLEAR : lv_canceled , lv_file_name. MOVE 'X' TO lv_applserv. MOVE 'Select File from Application Server' TO lv_title. MOVE ' ' TO lv_applserv_logical. MOVE 'X' TO lv_applserv_al11. CALL METHOD cl_rsan_ut_files=>f4 EXPORTING i_applserv = lv_applserv i_title = lv_title i_gui_extension = lv_gui_extension i_gui_ext_filter = lv_gui_ext_filter i_applserv_logical = lv_applserv_logical i_applserv_al11 = lv_applserv_al11 IMPORTING e_canceled = lv_canceled CHANGING c_file_name = lv_file_name EXCEPTIONS failed = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. IF lv_canceled NE 'X'. MOVE lv_file_name TO p_filenm. ENDIF. ENDIF. START-OF-SELECTION. MOVE p_filenm TO lv_file_name. PERFORM extract_data. PERFORM convert_data. PERFORM write_data_to_appserver. PERFORM read_data_from_appserver. *&-------------------------------------------------------------------- *& Form extract_data *&------------------------------------------------------------------- * text *--------------------------------------------------------------------- FORM extract_data. REFRESH : lt_makt. SELECT matnr maktx FROM makt INTO TABLE lt_makt WHERE matnr IN p_matnr AND spras EQ sy-langu. IF sy-subrc NE 0. MESSAGE 'No data selected' TYPE 'I' DISPLAY LIKE 'E'. STOP. ENDIF. ENDFORM. "extract_data *&------------------------------------------------------------------- *& Form convert_data *&------------------------------------------------------------------- * text *-------------------------------------------------------------------- FORM convert_data. REFRESH : lt_file_table. CLEAR : ls_file_table. IF lt_makt[] IS NOT INITIAL. LOOP AT lt_makt INTO ls_makt. CLEAR : ls_file_table. CONCATENATE ls_makt-matnr ls_makt-maktx INTO ls_file_table SEPARATED BY '|'. APPEND ls_file_table TO lt_file_table. ENDLOOP. ENDIF. ENDFORM. "convert_data *&-------------------------------------------------------------------- *& Form write_data_to_appserver *&-------------------------------------------------------------------- * Form routine for Creating the File in Application Server * ========================================================= * Parameter i_overwrite has relevant if an existing file is chosen to * write the contents * if Value of Parameter i_overwrite is 'X' then File is overwritten * otherwise the data is appended to existing file. * ========================================================= *----------------------------------------------------------------------* FORM write_data_to_appserver. IF lt_file_table[] IS NOT INITIAL. CLEAR : lv_lines_written. CALL METHOD cl_rsan_ut_appserv_file_writer=>appserver_file_write EXPORTING i_filename = lv_file_name i_overwrite = abap_true i_data_tab = lt_file_table IMPORTING e_lines_written = lv_lines_written EXCEPTIONS open_failed = 1 write_failed = 2 close_failed = 3 OTHERS = 4. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. WRITE :/ 'Data written to ', lv_file_name. WRITE :/ 'No of Lines Written ', lv_lines_written. ENDIF. ENDIF. ENDFORM. "write_data_to_appserver *&-------------------------------------------------------------------- *& Form read_data_from_appserver *&-------------------------------------------------------------------- * Form routine to read the contents of the file in application serveR *--------------------------------------------------------------------- FORM read_data_from_appserver. REFRESH : lt_file_table. CALL METHOD cl_rsan_ut_appserv_file_reader=>appserver_file_read EXPORTING i_filename = lv_file_name CHANGING c_data_tab = lt_file_table EXCEPTIONS open_failed = 1 read_failed = 2 close_failed = 3 OTHERS = 4. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. WRITE :/ 'Contents of file ', lv_file_name. WRITE :/ '================================='. LOOP AT lt_file_table INTO ls_file_table. WRITE :/ ls_file_table. ENDLOOP. ENDIF. ENDFORM. "read_data_from_appserver
发表评论
-
DISABLE button(FCODE) from the GUI-Status
2014-08-04 15:54 6321. Goto-> Attributes->Pus ... -
Handy SAP function module to automate user events
2013-11-28 09:49 751*Begin-Auto triggers ENTER comm ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 819FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 744FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
Unpermitted combination of business object BUS2032 and sales doc. category H
2013-01-25 14:20 4135Q: create New Sales Order using ... -
Function Module: get all users who have specific role
2013-01-25 14:16 679CALL FUNCTION 'RSRA_USERS_O ... -
Create a SELECT-OPTIONS in a module pool screen
2012-03-07 15:35 1027source:http://abap-explorer.blo ... -
Converting OTF data from script to Spool Request
2012-03-06 17:25 0source:http://forums.sdn.sap.co ... -
Calculate the days, months and years between 2 dates.
2012-02-21 16:14 835FORM compute_2date_diff. DAT ... -
Retrieving Domain fixed values
2012-02-16 11:13 811source:http://www.saptechnical. ... -
If 1 equals 2, what’s the purpose?
2012-02-16 10:59 837source:http://sapport.blogspot. ... -
get status name for batch input session
2012-01-31 14:47 922Line 601 in program SAPMSBDC_CC ... -
create zip folder with cl_abap_zip
2011-12-05 18:11 1210REPORT ztest. DATA: gv_file ... -
MIRO
2011-11-29 10:39 2066from: http://help-sap.blogspot. ... -
Create Vendor or Customer_master Data
2011-11-23 16:22 2920To Create or Change Vendor_mast ... -
Pay attention to the following points when using append structures
2011-10-27 13:43 1310You cannot create append str ... -
Help Views
2011-10-20 10:46 739source:http://help.sap.com/saph ... -
What is the Different Types and Usage of Views
2011-10-19 23:06 848source:http://www.sap-img.com/a ... -
Upload a Comma Delimited CSV file that contains commas in data
2011-09-23 17:22 2234source:http://wiki.sdn.sap.com/ ... -
What is the difference between SET SCREEN and CALL SCREEN ?
2011-09-19 21:50 763source:http://www.saptechies.co ...
相关推荐
RSA算法是第一个能同时用于加密和数字签名的算法,也易于理解和操作。RSA是被研究得最广泛的公钥算法,从提出到现在已近二十年,经历了各种攻击的考验,逐渐为人们接受,普遍认为是目前最优秀的公钥方案之一。...
DR:我是AndreiBârsan,拥有我自己的帖子和相关媒体(例如,张贴的屏幕截图和图表),但是该网站的源代码是根据MIT许可发布的。 所有网站内容,除了帖子和相关媒体的版权(c)2015 Authors-根据MIT许可发布。 ...
IJCAI 2020论文“”的源代码 先决条件 火炬(1.0.1) 恩特克 麻木 六 代码 ├──config.py ├──数据├──DataLoader.py ├──data_prepare.py ├──eval_utils.py ├──杂项│├──init.py │├──...
gürsan家具为您提供装饰解决方案。 在线平台,您可以在其中找到具有许多建议的产品。 我们在办公家具领域的创新思路,我们的原始设计和优质服务在此过程中,直到销售后,我们提供国内外的着名项目,为您的工作空间...
RSAn4060"等字符串很可能是扫描错误或随机字符。对于这些内容,我们只能推测这可能是加密测试的一部分,也可能是在扫描过程中产生的噪音数据。 6. 特定字符串:"Bob"和"Alice"可能是测试题中用于描述通信双方的代号...
Mihai Bîrsan的演讲,正如描述中所提及的,不仅提供了“幻灯片”和代码,还可能包括了其他辅助材料,这些都旨在增强观众的理解和参与。 "JavaScript"是标签,这意味着这个演示可能专注于JavaScript这门编程语言。...
磐yöntemikulanırsanızkullanın,çevirmenlerimizinbirçokdilde AMA mutlaka PHP ILE kodlamayapabildiğini,komutsatırından混帐kullanabildiğini,GitHub的kullanabildiğini,HTML已经XML belgelerü...