ERP Database - The Unofficial ERP Knowledge Base

Facebook Twitter del.icio.us Digg it
ERP Database contains a huge collection of articles related to ERP System and Software. Many of the articles are specifically related to SAP. All these ERP/SAP articles are freely available to everyone.

If you would like to submit an article or share any document related to ERP or any specific ERP software. Please mail it to support@erpdb.info. Please make sure that the documents are not copyrighted.
Social Bookmarks:

Source Code: Few simple examples

Print This Post Email This Post Written by admin on Oct 30th, 2007 | Filed under: ABAP Programs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
REPORT CHAP0102.
 
* Copying the content of one data object to another
DATA: SOURCE(10) TYPE C,
TARGET LIKE SOURCE.
MOVE SOURCE TO TARGET.
 
* Displaying the contents of fields
WRITE 'ABAP/4 is easy.'.
NEW-LINE.
WRITE 'This text is displayed on a new line.'.
WRITE / 'After the symbol /, text also appears on a new line.'.
 
* Standard control structures (conditions and loops)
IF SOURCE = TARGET.
WRITE / 'Fields source and target have the same content'.
ELSE.
WRITE / 'Fields source and target do not have the same content'.
ENDIF.
 
DO 3 TIMES.
WRITE / SY-INDEX.
ENDDO.
 
* Local subroutine of a single program
DATA: A1 TYPE I,
A2 TYPE I.
PERFORM CALC USING A1
CHANGING A2.
WRITE / A2.
FORM CALC USING F1 LIKE A1
CHANGING F2 LIKE A2.
F2 = F1 + ( F2 * 17 ).
ENDFORM.
 
* Event for drill-down facilities (reacts when a user selects a line)
AT LINE-SELECTION.
WRITE 'This is displayed after double-clicking a line'.
Share

If you like this post, you may as well like these too:

  1. ABAP Programs: Simple examples of field conversion REPORT ZSOURCE0702. * Converting to numbers during computationsDATA: NUMBER_1(4) VALUE ’1771′, NUMBER_2(3), RESULT TYPE I. NUMBER_2 = ’005′.RESULT = NUMBER_1 + NUMBER_2.WRITE / RESULT. NUMBER_2 = ‘ 5′.RESULT = NUMBER_1...
  2. Source Code: Designing a report REPORT ZSOURCE0104. * Declaration of a work area for a Dictionary tableTABLES CUSTOMERS. * Internal table used as snapshot of the database tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER...
  3. ABAP Source Code: Character types REPORT ZSOURCE0403. * Type c is the default type when no type is specified.* Initial value is space, if it is not specified explicitly.DATA: NAME(25) TYPE C, CITY(25), FLAG, SINGLE_CHARACTER...
  4. ABAP Source Code: Types, data, constants REPORT ZSOURCE0402.* Type flag defines an abstract typeTYPES FLAG TYPE C. * Field address_flag will allocate space in main memory at runtimeDATA ADDRESS_FLAG TYPE FLAG VALUE ‘X’.* Constants are defined...
  5. ABAP Source Code: Three approaches to define data objects REPORT ZSOURCE0401.* 1. Elementary typesDATA: CUSTOMER_NAME_1(25) TYPE C, VENDOR_NAME_1(25) TYPE C. * 2. Reference to an existing fieldDATA: CUSTOMER_NAME_2(25) TYPE C, VENDOR_NAME_2 LIKE CUSTOMER_NAME_2. * 3. Reference to a non-elementary...
  6. Source Code: Working with database tables and internal tables REPORT ZSOURCE0103. * Declaration of a work area for a Dictionary tableTABLES CUSTOMERS. * Internal table used as snapshot of the database tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER...
  7. ABAP Source Code: Syntax of ABAP/4 Programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 * Declaration...
  8. Examples and Demo Progams by SAP Stuck while programming and want to find out similar sample codes? SAP provides a vast list of demo programs on almost all the areas. Here are some of the places...
  9. Transaction Code to Access Other Transaction Code with Values Many times in SAP, you may come across situations where in the users wants to have a separate transaction codes for some of the tables which can be easily maintained...
  10. Source List The purpose of the source determination process is to automatically assign a source of supply to a purchase requisition. If the requester has set the Source Determination indicator in the...
  11. How to Create Source List? Use Transaction ME01. Enter the Material Number and the Plant Data. Enter source list records, validity period, period of time material is procurable, Vendor Number, responsible Purchasing  Organization (or number...
  12. What is the Source List? The Source List identifies preferred sources of supply for certain materials. If the Source List has been properly maintained, it will identify both the source of a material and the...
  13. ABAP Programs: A simple query 1 2 3 4 5 6 7 REPORT ZSOURCE1101. * Work area for a database table TABLES CUSTOMERS. * Reading all entries of the database table SELECT * FROM CUSTOMERS....
  14. ABAP Programs: Simple Form REPORT ZSOURCE1001. * Global field of the programDATA FLAG VALUE ‘G’.* Displaying the global fieldWRITE FLAG.* Calling a formPERFORM SET_FLAG.* Displaying the global field againWRITE FLAG.* Defining a formFORM SET_FLAG.*...
  15. ABAP Programs: A simple internal table REPORT ZSOURCE1201.* Work area for a database tableTABLES CUSTOMERS.* Defining an internal tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100.* Reading all entries of the database table into the internal tableSELECT *...



Leave a Reply