Common Questions and Answers about ABAP/4 and Developments-阿里云开发者社区

开发者社区> 长征1号> 正文

Common Questions and Answers about ABAP/4 and Developments

简介:
+关注继续查看

1. What is the difference between external & internal subroutine?

2. Why do we use ALV?

3. Why do we use GET CURSOR and what is it?

4. Both the events AT SELECTION-SCREEN and AT USER-COMMAND are processed after user input.  
    Then what is the difference between these and when we should use what? 

Sudeshna

Answer 1: 
1) Internal subroutines in the sense ..subroutines which are defined and used in a same program...external in the sense if you create a sub routine in one program and you're calling this subroutine in another program ..then this is external subroutine.

2) ALV gives many advantages than a list like sorting summing getting graphics like that stuff

3) While generating a interactive report we will use get cursor..use is to get the value of the fiel under the cursor..

4) At selection screen is used to validate the fields in a selection screen...and at user command  is used to modify the screen in a selection screen and in genarating secondary lists..

Sarath Reddy

Answer 2: 
1. The name itself implies the internal subroutines defined by form /perform.. can be called within the same prog in which they were declared.....external subroutines can be called outside the program.......

2. SAP LIST VIEWER is ALV  . its main advantage is by using ALV technique we can find totals ,subtotals ,sort in any order etc there itself in the list output of course we need to write all those functionalities  while using ALV...also many functional modules are defined under ALV concept...

3. GETCURSOR is used to trace the position of the cursor in the list ..  
suppose we want to double click on any filled in the list and want to trace data using that field we use getcursor .....

4.AT SELECTION-SCREEN  is used where you have a seperate selection screen using select-options or parameters where as AT USER-COMMAND is used where no selection screen  exists....at.user-command  is mainly used while setting pf-status which means creating our own menu with function codes etc...

Shiva

I had seen some of the standard abap that the table name had *, like *ekpo. What is the meaning? What is the difference between with * and without * ? 

It just lets you use the table a second time. For example: 

select single * from ekpo where ebeln = '12345' and ebelp = '1'. 

select single * from *ekpo where ebeln = '67890' and ebelp = '1'. 

You now have two separate records, one in ekpo and one in *ekpo. 

Another way to do this is to simply use the 'into' argument in the 'select' statement to read the second ekpo record into some other field. The '*' format can be confusing, I think it may be left over from earlier releases, like 2.2.

EKPO is database table and *EKPO is internal table.

Once you select into EKPO, you can use it the same way as *EKPO. 
 

How do I use variables in the FORMAT command?

DATA COLORID TYPE I VALUE 4. 
FORMAT INTENSIFIED ON COLOR = COLORID. 
 

When using CALL 'SYSTEM' id 'COMMAND' field unix-command, how does one capture the results of the command? For example, if the unix-command were the date?

You capture the results in the table e.g TABL, like this  
DATA: BEGIN OF TABL OCCURS 0, 
        LINE(560), 
      END OF TABL.

REFRESH TABL. 
CALL 'SYSTEM' ID 'COMMAND' FIELD PARCOM_LOC 
ID 'TAB' FIELD TABL-*SYS*.  
 

I am working on a program that needs to show number of days between 2 dates. When I scanned the function library, I only found a function to give you the number of years between dates. I can probably code this in ABAP but does anyone know if a function exists to do this.

I wrote this example for you. I think this is what you need.

DATA: DATE_1 LIKE SY-DATUM,  
             DATE_2 LIKE SY-DATUM. 
             DATA DAYS TYPE I.

DATE_1 = SY-DATUM. 
DATE_2 = SY-DATUM + 65. 
DAYS = DATE_2 - DATE_1. 
WRITE:/ 'DATE_2=',DATE_2,'DATE_1=',DATE_1,'DAYS=',DAYS.

Run this code and then you will understand.  
 

How do I concatenate two strings in Abap/4? 

For all SAP Versions  
STR_LENGTH = STRLEN( STRING1 ). 
MOVE STRING1 TO STRING3. 
WRITE STRING2 TO STRING3+STR_LENGTH.

For SAP Version 3.0 choose:

CONCATENATE STRING1 STRING2 INTO STRING3.

If you want a space between both fields:

CONCATENATE STRING1 STRING2 INTO STRING3 SEPARATED BY ' '.

For SAP Version 2.2 choose Functions:

STRING_CONCATENATE for 2 Strings and 
STRING_CONCATENATE_3 for 3 Strings.  
 

Has anyone been successful in suppressing the selection screen that is automatically displayed when using logical data bases. I want to run a job in the background using a logical database and I do not want the user prompted for the parameters. I want to pass the parameters in the program.

Try using the SUBMIT rep USING SELECTION-SET 'variant' WITH .... 
command in the report to pass the variant thru the program 
 

I would like to know how to execute from ABAP code an external Unix program and check for a return code? 

There are different ways to this:

(1) OPEN DATASET <file> FOR OUTPUT 'unix command' 
CLOSE DATASET <file> 
This command executes the unix command and writes the output into <file> 
Look into OSS Note 9391.

(2) or try the following program but unfortunately the command CALL SYSTEM is 
not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.

REPORT ZUNIXCOM .

DATA: U_COMMAND(200). 
* Table for system messages 
DATA: BEGIN OF RT OCCURS 100 , 
LINE(100) , 
END OF RT .

START-OF-SELECTION .

MOVE 'unix command' to U_COMMAND . 
REFRESH RT. 
CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND 
ID 'TAB' FIELD RT-*SYS* . 
LOOP AT RT. 
WRITE : / RT-LINE . 
ENDLOOP. 

专注于企业信息化,最近对股票数据分析较为感兴趣,可免费分享股票个股主力资金实时变化趋势分析工具,股票交流QQ群:457394862

本文转自沧海-重庆博客园博客,原文链接:http://www.cnblogs.com/omygod/archive/2007/12/16/996998.html,如需转载请自行联系原作者

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
使用NAT网关轻松为单台云服务器设置多个公网IP
在应用中,有时会遇到用户询问如何使单台云服务器具备多个公网IP的问题。 具体如何操作呢,有了NAT网关这个也不是难题。
26785 0
阿里云服务器怎么设置密码?怎么停机?怎么重启服务器?
如果在创建实例时没有设置密码,或者密码丢失,您可以在控制台上重新设置实例的登录密码。本文仅描述如何在 ECS 管理控制台上修改实例登录密码。
10062 0
阿里云服务器端口号设置
阿里云服务器初级使用者可能面临的问题之一. 使用tomcat或者其他服务器软件设置端口号后,比如 一些不是默认的, mysql的 3306, mssql的1433,有时候打不开网页, 原因是没有在ecs安全组去设置这个端口号. 解决: 点击ecs下网络和安全下的安全组 在弹出的安全组中,如果没有就新建安全组,然后点击配置规则 最后如上图点击添加...或快速创建.   have fun!  将编程看作是一门艺术,而不单单是个技术。
10882 0
阿里云服务器安全组设置内网互通的方法
虽然0.0.0.0/0使用非常方便,但是发现很多同学使用它来做内网互通,这是有安全风险的,实例有可能会在经典网络被内网IP访问到。下面介绍一下四种安全的内网互联设置方法。 购买前请先:领取阿里云幸运券,有很多优惠,可到下文中领取。
11818 0
腾讯云服务器 设置ngxin + fastdfs +tomcat 开机自启动
在tomcat中新建一个可以启动的 .sh 脚本文件 /usr/local/tomcat7/bin/ export JAVA_HOME=/usr/local/java/jdk7 export PATH=$JAVA_HOME/bin/:$PATH export CLASSPATH=.
4654 0
阿里云ECS云服务器初始化设置教程方法
阿里云ECS云服务器初始化是指将云服务器系统恢复到最初状态的过程,阿里云的服务器初始化是通过更换系统盘来实现的,是免费的,阿里云百科网分享服务器初始化教程: 服务器初始化教程方法 本文的服务器初始化是指将ECS云服务器系统恢复到最初状态,服务器中的数据也会被清空,所以初始化之前一定要先备份好。
7361 0
阿里云服务器如何登录?阿里云服务器的三种登录方法
购买阿里云ECS云服务器后如何登录?场景不同,云吞铺子总结大概有三种登录方式: 登录到ECS云服务器控制台 在ECS云服务器控制台用户可以更改密码、更换系统盘、创建快照、配置安全组等操作如何登录ECS云服务器控制台? 1、先登录到阿里云ECS服务器控制台 2、点击顶部的“控制台” 3、通过左侧栏,切换到“云服务器ECS”即可,如下图所示 通过ECS控制台的远程连接来登录到云服务器 阿里云ECS云服务器自带远程连接功能,使用该功能可以登录到云服务器,简单且方便,如下图:点击“远程连接”,第一次连接会自动生成6位数字密码,输入密码即可登录到云服务器上。
22383 0
+关注
345
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载