当前位置:网站首页>ABAP interview questions: how to use the System CALL interface of the ABAP programming language, direct execution ABAP server operating System's shell command?
ABAP interview questions: how to use the System CALL interface of the ABAP programming language, direct execution ABAP server operating System's shell command?
2022-08-09 13:03:00 【Wang Zixi】
Suppose we want to view the details of a certain file directory in the Linux system where the ABAP application server is installed. If you log in directly to the Linux Shell, use the `ls -l` command.
Example: `ls -l //bas/CGC5/src/krn/abap/runt`
In fact, we can use the CALL keyword provided by ABAP to initiate a call to the operating system shell command line directly at the ABAP application layer.The execution result of the latter is returned to the ABAP layer, so that ABAP application developers can perform some processing and develop some tools on this basis.
I wrote a simple ABAP report to wrap this call of the CALL keyword:
REPORT zlinux.PARAMETERS: command TYPE string LOWER CASE DEFAULT 'ls -l //bas/CGC5/src/krn/abap/runt'.DATA: commtext(120) ,itab(255) OCCURS 10 WITH HEADER LINE,lv_folder TYPE string.START-OF-SELECTION.PERFORM init.CALL 'SYSTEM' ID 'COMMAND' FIELD commtext ID 'TAB' FIELD itab[].LOOP AT itab ASSIGNING FIELD-SYMBOL().FIND REGEX '^.*\.c|^.*\.cpp|^.*\.h' IN .IF sy-subrc = 0.WRITE: / COLOR COL_NEGATIVE.DATA(lv_line) = CONV char255( ).HIDE lv_line.ELSE.WRITE: / .ENDIF.ENDLOOP.AT LINE-SELECTION.PERFORM display_source.FORM display_source.SPLIT lv_line AT space INTO TABLE DATA(lt_file).DATA(index) = lines( lt_file ).DATA(lv_file_name) = lv_folder && '/' && lt_file[ index ].DATA(lv_op) = |cat { lv_file_name } |.SUBMIT zlinux WITH command EQ lv_op.ENDFORM.FORM init.commtext = command.SPLIT commtext AT space INTO TABLE DATA(lt_table).CHECK lines( lt_table ) = 3.lv_folder = lt_table[3].ENDFORM.
After execution, you can specify the Linux command to be executed, such as pwd, which is the command line for printing the current working path in Linux, that is, the meaning of Print Working Directory.
The result is /usr/sap/AG3/DVEBMGS54/work
Execute `ps -aux` to print the process details of the current operating system in ABAP:
For the syntax of CALL, you can check SAP official help [document](CALL, System Function Call - ABAP Keyword Documentation).
The CALL keyword is generally used for the internal implementation of the SAP system and cannot be used in the development of SAP ABAP applications.CALL will call the system function cfunc. You can specify a data object containing the function name for cfunc. This data object must be a Flat Character like type.
This function must be entered in the sapactab.h file.Modifying a function or creating a new one requires recompiling and linking the ABAP kernel.Hence the need to be able to access the C source code files.
边栏推荐
- 一甲子,正青春,CCF创建六十周年庆典在苏州举行
- 1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点
- Programmer's Exclusive Romance - Use 3D Engine to Realize Fireworks in 5 Minutes
- shell脚本------函数的格式,传参,变量,递归,数组
- JS 封装节流(后期优化)
- ThreadLocal的简单理解
- 智驾科技完成C1轮融资,此前2轮已融4.5亿元
- HAproxy:负载均衡
- Two minutes recording can pass by second language!The volcano how to practice and become voice tone reproduction technology?
- IDEA 关闭/开启引用提示Usages
猜你喜欢
虚拟机安装出现的问题汇总
用 API Factory 产品生成 API 文档
问题来了:4GB物理内存的机器上申请8G内存能成功吗?
WPF 实现带蒙版的 MessageBox 消息提示框
脱光衣服待着就能减肥,当真有这好事?
h264协议
告别手摇织布机的AI时代
Shell之常用小工具(sort、uniq、tr、cut)
Information system project managers must memorize the core test sites (63) The main process of project portfolio management & DIPP analysis
web课程设计
随机推荐
【Untitled】
C# 获取系统已安装的.NET版本
AQS同步组件-FutureTask解析和用例
PM2之配置文件
goalng-sync/atomic原子操作
网页控制台控制编辑框
2022 Niu Ke Duo School (6) M. Z-Game on grid
全面了解什么是TPS、QPS以及两者的区别
WeChat Mini Program Payment and Refund Overall Process
The grep command Shell regular expressions, the three musketeers
香港服务器如何进行加密?
又有大厂员工连续加班倒下/ 百度搜狗取消快照/ 马斯克生父不为他骄傲...今日更多新鲜事在此...
go基础之web获取参数
The latest interview summary in 20022 brought by Ali senior engineer is too fragrant
十分钟教会你如何使用VitePress搭建及部署个人博客站点
【微服务~远程调用】整合RestTemplate、WebClient、Feign
Django cannot link mysql database
智驾科技完成C1轮融资,此前2轮已融4.5亿元
LeetCode_单调栈_中等_456.132 模式
张朝阳对话俞敏洪:一边是手推物理公式,一边是古诗信手拈来