当前位置:网站首页>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.
边栏推荐
- #物联网征文#小熊派设备开发实战
- 在北极都可以穿短袖了,温度飙升至32.5℃
- Two minutes recording can pass by second language!The volcano how to practice and become voice tone reproduction technology?
- WPF implements a MessageBox message prompt box with a mask
- 告别手摇织布机的AI时代
- 微服务架构的核心关键点
- ACM longest non-descent subsequence problem
- 曲鸟全栈UI自动化教学(八):框架代码讲解和进一步优化
- 微信小程序支付及退款整体流程
- OpenSSF的开源软件风险评估工具:Scorecards
猜你喜欢
【Adobe Premiere Pro 2020】pr2020安装和基本操作【PR安装、新建项目流程、导入及管理素材项目文件、添加标记、创建出入点剪辑视频、快速剪接及自动音乐卡点的方法
ARP协议原理
《数字经济全景白皮书》银行业智能营销应用专题分析 发布
900页数学论文证明旋转的黑洞不会爆炸,丘成桐:30多年来广义相对论首次重大突破...
C# Get system installed .NET version
世界第4疯狂的科学家,在103岁生日那天去世了
JS 封装节流(后期优化)
Reading and writing after separation, performance were up 100%
李开复花上千万投的缝纫机器人,团队出自大疆
JS封装防抖(代码持续优化)
随机推荐
【微服务~远程调用】整合RestTemplate、WebClient、Feign
非科班AI小哥火了:他没有ML学位,却拿到DeepMind的offer
曼城推出可检测情绪的智能围巾,把球迷给整迷惑了
国产抗新冠口服药每瓶不超300元/ 我国IPv6网络全面建成/ 谷歌入局折叠屏手机...今日更多新鲜事在此...
罗振宇折戟创业板/ B站回应HR称用户是Loser/ 腾讯罗技年内合推云游戏掌机...今日更多新鲜事在此...
学长告诉我,大厂MySQL都是通过SSH连接的
CANopen DS402名词
又有大厂员工连续加班倒下/ 百度搜狗取消快照/ 马斯克生父不为他骄傲...今日更多新鲜事在此...
阿里云新增三大高性能计算解决方案,助力生命科学行业快速发展
西湖大学教授怎么看AI制药革命?|量子位智库圆桌实录
MongoDB-查询中$all的用法介绍
ThreadLocal的简单理解
修改VOT2018.json文件,去掉图片路径中的color
正则表达式(规则,匹配,和实际使用)
ACM longest non-descent subsequence problem
研发需求的验收标准应该怎么写? | 敏捷实践
900页数学论文证明旋转的黑洞不会爆炸,丘成桐:30多年来广义相对论首次重大突破...
专业人士使用的 11 种渗透测试工具
结构体变量的首地址获取注意事项
数字化转型之支撑保障单元