如何编写上传(PC->AS)和下载(AS->PC)程序示例

ABAP文件下载示例
本文展示了一个使用ABAP编程语言实现文件下载的例子,包括文本文件和二进制文件的处理流程。通过定义数据结构、打开文件、读取内容到内部表并最终调用GUI_DOWNLOAD函数来完成下载。

REPORT Z_HO_TTT .

parameters: pm_cr type TRKORR obligatory.

data: c_file(80), d_file(80).

DATA: C_L TYPE STRING, D_L TYPE STRING.

data: str(12).

str = pm_cr.

*shift str left by 3 places.
*str+7(1) = '.'.
*str+8(3) = pm_cr(3).

concatenate '/usr/sap/trans/cofiles/' pm_cr into c_file.
CONCATENATE 'C:/' pm_cr INTO C_L.
str(1) = 'R'.
concatenate '/usr/sap/trans/data/' pm_cr INTO D_FILE.
CONCATENATE 'C:/' pm_cr INTO D_L.

DATA: BEGIN OF I_LIST OCCURS 0,
    STR(500),
    END OF I_LIST.

DATA: I TYPE I, J TYPE I.
*文本文件下载
OPEN DATASET C_FILE FOR INPUT IN TEXT MODE.
DO.
  READ DATASET C_FILE INTO I_LIST.
  IF SY-SUBRC NE 0.
    EXIT.
  ENDIF.
  APPEND I_LIST.
ENDDO.
close dataset c_file.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                  =
    filename                      = C_L
*   FILETYPE                      = 'ASC'
  tables
    data_tab                      = I_LIST
          .

REFRESH I_LIST.
CLEAR: I_LIST.
CLEAR: I.
*二进值文件下载
OPEN DATASET D_FILE FOR INPUT IN BINARY MODE.
DO.
  READ DATASET D_FILE INTO I_LIST LENGTH J.
  IF SY-SUBRC NE 0 AND J = 0.
    EXIT.
  ENDIF.
  I = I + J.
  APPEND I_LIST.
ENDDO.
close dataset D_file.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    BIN_FILESIZE                  = I
    filename                      = D_L
    FILETYPE                      = 'BIN'
  tables
    data_tab                      = I_LIST. 

### 在 Windows 中找到高级系统设置并配置启动恢复选项的翻译 #### Finding Advanced System Settings and Configuring Startup and Recovery Options in Windows Advanced system settings are essential for optimizing performance, adjusting visual effects, and configuring files. Below are the steps to locate these settings and adjust the startup and recovery options: 1. **Accessing Advanced System Settings** - Click on the **Start Menu**. - Right-click on **This PC** or **Computer** and select **Properties**. - In the **System Properties** window, navigate to the **Advanced** tab. - Under the **Startup and Recovery** section, click on the **Settings** button to configure specific options [^1]. 2. **Configuring Startup and Recovery Options** - After clicking the **Settings** button, a new window will appear with various configuration options: - **System failure**: Choose actions such as writing debugging information, automatically restarting the system, or displaying error messages. - **Kernel memory dump**: Select this option to save memory usage data during system crashes for later analysis. - **Small memory dump (64 KB)**: This option stores minimal crash-related data and is suitable for basic diagnostics. - **Automatic restart**: Enable this feature if you want the system to restart automatically after a crash [^2]. 3. **Additional Notes** - If the system fails to start normally, consider using **Advanced Boot Options** by pressing the **F8** key during boot-up. This mode provides troubleshooting tools, including **Safe Mode**, which loads only essential drivers and services for diagnosing issues [^4]. - For systems like Windows 7, ensure that the **Repair Your Computer** option is available in the advanced boot menu. If it's missing, additional steps may be required to restore access to this feature [^3]. #### 示例代码:使用命令行调整启动设置 ```batch :: Open System Properties through command line rundll32.exe sysdm.cpl, EditEnvironmentVariables ``` ```batch :: Accessing Advanced Boot Options via Command Prompt bcdedit /set {default} bootmenupolicy legacy ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值