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:

ABAP Programs: Simple examples of field conversion

Print This Post Email This Post Written by admin on Nov 8th, 2007 | Filed under: ABAP Programs

REPORT ZSOURCE0702.

* Converting to numbers during computations
DATA: 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 + NUMBER_2.
WRITE / RESULT.

* Padding character fields with blanks
DATA: OLD_CUSTOMER_NAME(10) VALUE ‘Edison’,
NEW_CUSTOMER_NAME(25).
MOVE OLD_CUSTOMER_NAME TO NEW_CUSTOMER_NAME.
WRITE / NEW_CUSTOMER_NAME.

* Calculating dates
DATA: ANY_DATE TYPE D,
SAME_DAY_OF_NEXT_WEEK TYPE D.

ANY_DATE = ’19991231′.
SAME_DAY_OF_NEXT_WEEK = ANY_DATE + 7.
WRITE / SAME_DAY_OF_NEXT_WEEK.

ANY_DATE = ’20000228′.
SAME_DAY_OF_NEXT_WEEK = ANY_DATE + 7.
WRITE / SAME_DAY_OF_NEXT_WEEK.

———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info

Share

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

  1. Source Code: Few simple examples 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...
  2. 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.*...
  3. 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....
  4. 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 *...
  5. ABAP Programs: Working with Field symbols REPORT CHAP2401. * Defining a Field Symbol FIELD-SYMBOLS < FS>. * Variable for later use DATA FIELD VALUE 'X'. * Assigning a field to a Field Symbol ASSIGN FIELD TO...
  6. ABAP Programs:Using Field Symbols for components of a structure REPORT ZSOURCE2403. * Table work area for later use TABLES CUSTOMERS. * Defining a Field Symbol FIELD-SYMBOLS <OUTPUT>. * Displaying all fields of all table entries SELECT * FROM CUSTOMERS....
  7. ABAP Programs :Using Field Symbols for variable parts of fields REPORT ZSOURCE2402. DATA: EXTERNAL_RECORD(4000), POSITION TYPE I, LENGTH TYPE N. FIELD-SYMBOLS < ENTRY>. EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'. DO. LENGTH = EXTERNAL_RECORD+POSITION(4). IF LENGTH = 0. EXIT. ENDIF. ADD 4 TO POSITION....
  8. FIELD-SYMBOLS: ABAP Keyword a day FIELD-SYMBOLS: <fs>. FIELD-SYMBOLS: <fs> TYPE t. FIELD-SYMBOLS: <fs> TYPE LINE OF t. FIELD-SYMBOLS: <fs> LIKE s. FIELD-SYMBOLS: <fs> LIKE LINE OF s. Field Symbols are placeholders or symbolic names for...
  9. FIELD-GROUPS: Abap keyword a day FIELD-GROUPS creates a field group for an extract dataset. FIELD-GROUPS: This statement would define a field group and these also define the actual line structure of extract dataset. Here is...
  10. 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...
  11. Unicode Conversion Tips and Tricks for Improving the Conversion Time This document on tips and tricks on Unicode Conversion is meant to improve the conversion time needed for a Unicode conversion. It...
  12. Use Variables for Currency Conversion in BIW As of SAP BW 3.5, you will have additional options to create variables for the following components of a currency conversion type: Exchange rate type: The exchange rate type distinguishes...
  13. 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...
  14. ABAP Programs: Importing from the ABAP/4 Memory REPORT ZSOURCE1402. * Internal tables which will be imported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH HEADER LINE, NEW_BOOKINGS LIKE BOOKINGS OCCURS...
  15. ABAP Programs: Exporting to the ABAP/4 Memory REPORT ZSOURCE1401. * Work areas TABLES: CUSTOMERS, BOOKINGS. * Internal tables which will be exported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH...



Leave a Reply