|
SAP Training, Tutorials, Certification and Jobs
Materials
|
||||||||||
|
ADD (ABAP Keyword)
ADD (ABAP Keyword) introduction and details
ADD Variants 1. ADD n TO m. 2. ADD n1 THEN n2 UNTIL nz GIVING m. 3. ADD n1 THEN n2 UNTIL nz TO m. 4. ADD n1 THEN n2 UNTIL nz ...ACCORDING TO sel ...GIVING m. 5. ADD n1 FROM m1 TO mz GIVING m. Variant 1 ADD n TO m. Effect Adds the contents of n to the contents of M and stores the result in m . This is equivalent to: m = m + n. Example DATA: NUMBER TYPE I VALUE 3, SUM TYPE I VALUE 5. ADD NUMBER TO SUM. The field SUM now contains 8, whilst the contents of the field NUMBER remains unchanged at 3. Note The details about conversions and performance described under COMPUTE are identical for ADD . Note Runtime errors BCD_BADDATA : P field contains incorrect BCD format. BCD_FIELD_OVERFLOW : Result field too small (type P ). BCD_OVERFLOW : Overflow with arithmetic operation (type P . COMPUTE_INT_PLUS_OVERFLOW : Integer overflow when adding. Related COMPUTE , ADD-CORRESPONDING . Variant 2 ADD n1 THEN n2 UNTIL nz GIVING m. Effect Adds the contents of the fields n1, n2, ..., nz together and stores the result in m , where n1 is the first, n2 the second and nz the last of a sequence of fields the same distance apart. They can be either database fields or internal fields, but they must all have the same type and length. This is equivalent to: m = n1 + n2 + ... + nz. Example DATA: BEGIN OF NUMBERS, ONE TYPE P VALUE 10, TWO TYPE P VALUE 20, THREE TYPE P VALUE 30, FOUR TYPE P VALUE 40, FIVE TYPE P VALUE 50, SIX TYPE P VALUE 60, END OF NUMBERS, SUM TYPE I VALUE 1000. ADD NUMBERS-ONE THEN NUMBERS-TWO UNTIL NUMBERS-FIVE GIVING SUM. The field SUM now contains 150 but its initial value is unimportant. The fields within the field string NUMBERS remain unchanged. Variant 3 ADD n1 THEN n2 UNTIL nz TO m. Effect Calculates the total as in variant 2 but then adds it to the contents of the field m . This is equivalent to: m = m + n1 + n2 + ... + nz Example DATA: BEGIN OF NUMBERS, ONE TYPE P VALUE 10, TWO TYPE P VALUE 20, THREE TYPE P VALUE 30, FOUR TYPE P VALUE 40, FIVE TYPE P VALUE 50, END OF NUMBERS, SUM TYPE I VALUE 1000. ADD NUMBERS-ONE THEN NUMBERS-TWO UNTIL NUMBERS-FIVE TO SUM. The field SUM now contains 1150. Variant 4 ADD n1 THEN n2 UNTIL nz ...ACCORDING TO sel ...GIVING m. Effect Calculates the total as in variants 2 and 3. In this case, however, the operands from a sequence of fields of the same type are restricted to a partial sequence by the selection specification sel generated by SELECT-OPTIONS or RANGES . The partial sequence results from the indexes that satisfy the condition IN sel (see IF ). Example DATA: BEGIN OF NUMBERS, ONE TYPE P VALUE 10, TWO TYPE P VALUE 20, THREE TYPE P VALUE 30, FOUR TYPE P VALUE 40, FIVE TYPE P VALUE 50, END OF NUMBERS, SUM TYPE I VALUE 1000, INDEX TYPE I. RANGES SELECTION FOR INDEX. SELECTION-SIGN = 'I'. SELECTION-OPTION = 'BT'. SELECTION-LOW = 2. SELECTION-HIGH = 4. APPEND SELECTION. ADD NUMBERS-ONE THEN NUMBERS-TWO UNTIL NUMBERS-FIVE ACCORDING TO SELECTION GIVING SUM. SUM now contains 90. Only the component fields TWO to FOUR were selected from the field string NUMBERS and added together. Variant 5 ADD n1 FROM m1 TO mz GIVING m. Effect The field n1 must be the first in a sequence of consecutive fields of the same type. m1 and mz should contain the numbers of the first and last fields in this sequence to be added together (whether fixed or variable). The total is stored in m . Example DATA: BEGIN OF NUMBERS, ONE TYPE P VALUE 10, TWO TYPE P VALUE 20, THREE TYPE P VALUE 30, FOUR TYPE P VALUE 40, FIVE TYPE P VALUE 50, END OF NUMBERS, START TYPE I VALUE 2, SUM TYPE I VALUE 1000. ADD NUMBERS-ONE FROM START TO 4 GIVING SUM. The field SUM now contains 90. Note Performance The details for conversion and performance specified for COMPUTE are equally valid for ADD . The runtime required for adding two numbers of type I or F is about 2 (standardized microseconds), for type P it is roughly 8 msn. Note Runtime errors Besides the runtime errors listed in variant 1, the error ADDF_INT_OVERFLOW can occur instead of COMPUTE_INT_PLUS_OVERFLOW in other variants. Latest Added TutorialsSAP PRE-SALE(very urgent requirement) - SAP JOBS INDIA SAP PRE-SALE(very urgent requirement) - SAP JOBS INDIA Experiense Required for this job: 6-9 years exp Job Locations: Mumbai Apply for this SAP Job in INDIA SAP ABAP Professionals - SAP JOBS INDIA SAP ABAP Professionals - SAP JOBS INDIA Experiense Required for this job: 5 - 7 years exp Job Locations: Bengaluru / Bangalore, Chennai, Others Apply for this SAP Job in INDIA Junior SAP Consultants - SAP JOBS INDIA Junior SAP Consultants - SAP JOBS INDIA Experiense Required for this job: 0-5 years exp Job Locations: Bengaluru/Bangalore Apply for this SAP Job in INDIA SAP Plant Maintanence with ETM module - SAP JOBS INDIA SAP Plant Maintanence with ETM module - SAP JOBS INDIA Experiense Required for this job: 2-7 years exp Job Locations: Pune Apply for this SAP Job in INDIA SAP Plant Maintainence /PM Consultant/Sr.consultant/TL - SAP JOBS INDIA SAP Plant Maintainence /PM Consultant/Sr.consultant/TL - SAP JOBS INDIA Experiense Required for this job: 3-8 years exp Job Locations: Gurgaon, Kolkata Apply for this SAP Job in INDIA Immediate position for SAP ABAP Professionals. - SAP JOBS INDIA Immediate position for SAP ABAP Professionals. - SAP JOBS INDIA Experiense Required for this job: 5-9 years exp Job Locations: Bengaluru/Bangalore, Chennai, Gurgaon Apply for this SAP Job in INDIA SAP - IS Retail (SRS) Consultant - SAP JOBS INDIA SAP - IS Retail (SRS) Consultant - SAP JOBS INDIA Experiense Required for this job: 5-8 years exp Job Locations: Bengaluru/Bangalore Apply for this SAP Job in INDIA SAP BPC/EPM - SAP JOBS INDIA SAP BPC/EPM - SAP JOBS INDIA Experiense Required for this job: 4-9 years exp Job Locations: Bengaluru/Bangalore, Hyderabad / Secunderabad, Pune Apply for this SAP Job in INDIA LOOKING FOR TECHNICAL AND FUNCTIONAL LEADS AND MANAGERS(SAP) - SAP JOBS INDIA LOOKING FOR TECHNICAL AND FUNCTIONAL LEADS AND MANAGERS(SAP) - SAP JOBS INDIA Experiense Required for this job: 3-8 years exp Job Locations: Bengaluru/Bangalore, Chennai Apply for this SAP Job in INDIA SAP FICO Consultant - SAP JOBS INDIA
SAP FICO Consultant - SAP JOBS INDIA Experiense Required for this job: 5-10 years exp Job Locations: Hyderabad / Secunderabad Apply for this SAP Job in INDIA Most readed 5 TutorialsList of SAP MM Transaction codes This documentation covers the details of SAP MM Transaction codes WRITE - Output to a list ( SAP ABAP Keyword) WRITE ( Output to a list ) is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details. FI Accounts Receivable and Accounts Payable | SAP FI PDF manual The following topics are an introduction to the Accounts Receivable and Accounts Payable application components. List of SAP HR TABLES and Infotypes tables Detailed full list of tables and infotypes used in SAP HR module. Report Programming in HR | SAP PDF study material )
This document is intended for all persons who would like to program their own reports in SAP HR or customize standard ones. The documentation is not intended to be an introduction to programming. It contains just the special features that form part of programming in SAP HR.A general knowledge of ABAP programming and HR applications is a prerequisite. This can be acquired by reading the relevant documentation and attending the courses.This document provides information which enables programmers to become acquainted with the special features of programming in HR. |
![]() SAP Technical PDF Tutorials ABAP SAP Functional PDF Tutorials FI (Financial) SAP References transaction codes TOOLS SQL Trace tool SAP Emerging Technologies
SAP
Advanced Planner and Optimizer (APO)
|
|||||||||||||||||
Custom Search
|
||
|
site contact sapbrain.support@gmail.com All of the product names here are trademarks of their respective companies. The site www.sapbrainsonline.com no way affiliated with SAP AG. Use information on this site at your own risk. Information furnished in the site is collected from various sites and posts from users. This site does not host any files on its server. If any compliants about the posts please contact us at sapbrain.support@gmail.com, we are ready to move the posts. Complete SAP Study materials | SAP JOBS | PDF Tutorials |
||