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,如需转载请自行联系原作者
目录
相关文章
|
1月前
|
前端开发 开发工具 Android开发
小技巧分享 - 使用 Visual Studio Code 查看和修改 ABAP 代码试读版
小技巧分享 - 使用 Visual Studio Code 查看和修改 ABAP 代码试读版
15 0
小技巧分享 - 使用 Visual Studio Code 查看和修改 ABAP 代码试读版
|
1月前
|
开发者 供应链 BI
SAP ABAP CALL SUBSCREEN 代码解析
SAP ABAP CALL SUBSCREEN 代码解析
52 0
|
1月前
|
BI
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示
20 0
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示
|
2月前
|
存储 数据处理 开发者
ABAP 如何把 unicode 代码点转换成字符
ABAP 如何把 unicode 代码点转换成字符
20 0
|
1月前
|
存储
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
21 0
|
3月前
|
SQL 数据库
小技巧:如何让 ABAP OPEN SQL 代码具有自解释性(Self-Explained)
小技巧:如何让 ABAP OPEN SQL 代码具有自解释性(Self-Explained)
25 0
|
1月前
|
开发工具 Web App开发 IDE
如何对 SAPGUI 里的 ABAP 代码语法检查功能进行自定义增强配套代码
如何对 SAPGUI 里的 ABAP 代码语法检查功能进行自定义增强配套代码
9 2
如何对 SAPGUI 里的 ABAP 代码语法检查功能进行自定义增强配套代码
|
1月前
|
开发者 数据库
使用 SAP ABAP 代码下载一个 note 到本地 ABAP 系统
使用 SAP ABAP 代码下载一个 note 到本地 ABAP 系统
12 0
|
2月前
|
BI
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示试读版
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示试读版
16 0

热门文章

最新文章