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.


Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com