ABAP Programs: Converting number fields
* Using numeric texts and packed numbers
DATA: NO_EMPLOYEES(4) TYPE N,
NO_ROOMS TYPE P,
EMPLOYEES_PER_ROOM TYPE P DECIMALS 2.
EMPLOYEES_PER_ROOM = NO_EMPLOYEES / NO_ROOMS.
* Rounding with integers and packed numbers
DATA: INCOME TYPE I VALUE ’10000′,
TAX TYPE P DECIMALS 2 VALUE ’0.2′,
NET_INCOME TYPE P DECIMALS 2,
ROUNDED_NET_INCOME TYPE I.
NET_INCOME = INCOME * ( 1 – TAX ).
ROUNDED_NET_INCOME = INCOME * ( 1 – TAX ).
WRITE: / NET_INCOME, ROUNDED_NET_INCOME.
INCOME = ’10002′.
NET_INCOME = INCOME * ( 1 – TAX ).
ROUNDED_NET_INCOME = INCOME * ( 1 – TAX ).
WRITE: / NET_INCOME, ROUNDED_NET_INCOME.
Type rest of the post here
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info
If you like this post, you may as well like these too:
- ABAP Programs: Converting character fields REPORT ZSOURCE0703. * Truncating fields or padding with blanksDATA: SHORT_NAME(8), LONG_NAME(16).MOVE ‘Washington’ TO: SHORT_NAME, LONG_NAME.WRITE: / SHORT_NAME, LONG_NAME. * Take care of intermediate stepsLONG_NAME = SHORT_NAME = ‘Washington’.WRITE: / SHORT_NAME,...
- ABAP Programs: Converting date fields * Using the built-in calendarDATA: RECEIVING_DATE TYPE D, LAST_ADMISSIBLE_DATE TYPE D. RECEIVING_DATE = ’19980223′.LAST_ADMISSIBLE_DATE = RECEIVING_DATE + 10.WRITE / LAST_ADMISSIBLE_DATE. RECEIVING_DATE = ’19980305′.LAST_ADMISSIBLE_DATE = RECEIVING_DATE + 10.WRITE / LAST_ADMISSIBLE_DATE. RECEIVING_DATE...
- ABAP Programs: Using system fields REPORT ZSOURCE0409. WRITE: / ‘Current date’, SY-DATUM, / ‘Current table index’, SY-TABIX, / ‘Loop counter’, SY-INDEX, / ‘System return code’, SY-SUBRC.———————ABAPer, mail: abap.community@gmail.com http://www.erpdb.info...
- ABAP Programs: Copying fields REPORT ZSOURCE0701. * move fieldsDATA: NAME(25), COUNTER TYPE I.DATA: SOURCE LIKE NAME, TARGET LIKE SOURCE.MOVE: ‘Edison’ TO NAME, 17 TO COUNTER.MOVE SOURCE TO TARGET.* Using the compute command (keyword can...
- ABAP Programs: Selecting Single Fields REPORT ZSOURCE1106.* Work area for a database tableTABLES CUSTOMERS.* Selecting single fieldsDATA: CID LIKE CUSTOMERS-ID, CNAME LIKE CUSTOMERS-NAME.SELECT ID NAME INTO (CID,CNAME) FROM CUSTOMERS. WRITE: / CID, CNAME.ENDSELECT. ~~~ end...
- ABAP Programs: Setting the layout position of fields REPORT ZSOURCE0804. DATA: POS TYPE I, LEN TYPE I. WRITE AT 5 ‘position 5′.POS = 20.WRITE AT POS ‘position 20′.POSITION 40.WRITE ‘position 40′. POS = 10. LEN = 20.NEW-LINE.WRITE AT...
- 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....
- Default Screen Number The default screen number in an ABAP program is 1000. The screen number can be viewed by choosing system–> status while on the selection-screen....
- Define Number Range Intervals for Cash Journal Document You have to define a number range interval for cash journal documents. Each document then receives a unique number that does not clash with the G/L document number. Note: This...
- Characteristics and Value Fields In the operating concern two things are basically defined Characteristics Value Fields Characteristics are nothing but those aspects on which we want to break down the profit logically such as...
- 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...
- Add Fields to SAP Table An Append Structure or a customizing include can be used to add fields to the Table. Append structures are created by adding fields to the end of a table while...
- SAP System Fields SAP System Fields AlphabeticalSAP System Fields Categorised ~ end of post ~ ———————ABAPer, mail: abap.community@gmail.com http://www.erpdb.info...
- 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...
- Find the Fields or Tables accessed for a Transaction A common way to find the technical data underlying a transaction is to place your cursor in the field, press the key F1, and then click on the button Technical...



















Leave a Reply